texts: Unity - How To Customize Buttons Graphics

texts:
inside my buttons I added some variables (as you can see in the code below).

public UnityEngine.UI.Text itemInfo;
void Update () {
    itemInfo.text = itemName + "\nCost: " + (costo_stringa = ConvertiroreProiettili.Instance.GetCurrencyInString(costo, false, false))
    + "\nBullets: " + tickValue + "/s" + "\nLiv: " + count;

but in this way are one below the other as a list, how do I order them as I will, and also add a picture?
like this


texts: What causes Box2D revolute joints to separate?

texts:
I have created a rag doll using dynamic bodies (rectangles) and simple revolute joints (with lower and upper angles). When my rag doll hits the ground (which is a static body) the bodies seem to fidget and the joints separate.

It looks like the bodies are sticking to the ground, and the momentum of the rag doll pulls the joint apart (see screenshot below).

I'm not sure if it's related, but I'm using the Badlogic GDX Java wrapper for Box2D. Here's some snippets of what I think is the most relevant code:

private RevoluteJoint joinBodyParts(
    Body a, Body b, Vector2 anchor,
    float lowerAngle, float upperAngle) {

    RevoluteJointDef jointDef = new RevoluteJointDef();

    jointDef.initialize(a, b, a.getWorldPoint(anchor));

    jointDef.enableLimit = true;
    jointDef.lowerAngle = lowerAngle;
    jointDef.upperAngle = upperAngle;

    return (RevoluteJoint)world.createJoint(jointDef);
}

private Body createRectangleBodyPart(
    float x, float y, float width, float height) {

    PolygonShape shape = new PolygonShape();
    shape.setAsBox(width, height);

    BodyDef bodyDef = new BodyDef();
    bodyDef.type = BodyType.DynamicBody;
    bodyDef.position.y = y;
    bodyDef.position.x = x;

    Body body = world.createBody(bodyDef);

    FixtureDef fixtureDef = new FixtureDef();
    fixtureDef.shape = shape;
    fixtureDef.density = 10;

    fixtureDef.filter.groupIndex = -1;
    fixtureDef.filter.categoryBits = FILTER_BOY;
    fixtureDef.filter.maskBits = FILTER_STUFF | FILTER_WALL;

    body.createFixture(fixtureDef);
    shape.dispose();

    return body;
}

I've skipped the method for creating the head, as it's pretty much the same as the rectangle method (just using a cricle shape).

Those methods are used like so:

    torso = createRectangleBodyPart(x, y + 5, 0.25f, 1.5f);
    Body head = createRoundBodyPart(x, y + 7.4f, 1);

    Body leftLegTop = createRectangleBodyPart(x, y + 2.7f, 0.25f, 1);
    Body rightLegTop = createRectangleBodyPart(x, y + 2.7f, 0.25f, 1);
    Body leftLegBottom = createRectangleBodyPart(x, y + 1, 0.25f, 1);
    Body rightLegBottom = createRectangleBodyPart(x, y + 1, 0.25f, 1);

    Body leftArm = createRectangleBodyPart(x, y + 5, 0.25f, 1.2f);
    Body rightArm = createRectangleBodyPart(x, y + 5, 0.25f, 1.2f);

    joinBodyParts(torso, head, new Vector2(0, 1.6f), headAngle);

    leftLegTopJoint = joinBodyParts(torso, leftLegTop, new Vector2(0, -1.2f), 0.1f, legAngle);
    rightLegTopJoint = joinBodyParts(torso, rightLegTop, new Vector2(0, -1.2f), 0.1f, legAngle);
    leftLegBottomJoint = joinBodyParts(leftLegTop, leftLegBottom, new Vector2(0, -1), -legAngle * 1.5f, 0);
    rightLegBottomJoint = joinBodyParts(rightLegTop, rightLegBottom, new Vector2(0, -1), -legAngle * 1.5f, 0);

    leftArmJoint = joinBodyParts(torso, leftArm, new Vector2(0, 1), -armAngle * 0.7f, armAngle);
    rightArmJoint = joinBodyParts(torso, rightArm, new Vector2(0, 1), -armAngle * 0.7f, armAngle);


texts:
I know steam has nothing to do with whether the game has dynamic libraries or not, but a lot of games should be using the same dynamic libraries.

Does Steam currently have a way to reuse 1 dynamic library across multiple games, without creating copies of said library of course? I've taken a look into my own Steam library by taking 2 Source games and wild picking a few dynamic libraries and checking if the other one has them. I didn't really find a lot of matches, but I did find matches and I did find similar libraries. (valve_bink.dll and binkw32 for example)


texts: Run Game on Android Even Removed from Application stack (Unity)

texts:
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.


texts: onSceneTouchEvent Triggering more than once on one click in Andengine

texts:
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.


texts:
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?


texts: How to rotate an image on touch using RotateToAction in libGDX?

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


texts: Direct3D fails to render when on Laptop with nvidia optimus

texts: I'm developing a Direct3D control which needs to run on a Dell XPS with a NVIDIA Optimus. I'm using SharpDX and C#.  When I write code for the app on a workstation with only an NVIDIA graphics card it runs correctly. When I move it to the laptop, I select the NVIDIA graphics adaptor via code, however it does not render to the window. How can I get this to work correctly? Has anyone else seen this?


texts:
I am making a roguelike card game like dream quest, and I want to improve my dungeon/level save method.

Here's what my levels look like:

I checked dream quest saves but I don't like their method because it uses a simple text file for all the information. it's also really messy, repetitive and not extendable.

I used the format below for the first couple of months:

[
  [
    "Wall",
    "Wall",
    "Room",
    "Room",
    "Room",
    "Merchant",
    "Room",
    "Room",
    "Wall",
    "Wall",
  ],
  [
    "Wall",
    "Wall",
    ...
  ]
]

But at the time I did not have multiple enemies, merchants, items. I simply read the file by using an enum which matched the strings used in the save format (item, enemy, merchant etc.) then passed them into an array to create the board.

As I started to create different kinds of enemies, items, and merchants, my current game wouldn't support this. I don't want to create an enum like enemy1, enemy2, enemy3 ...

How can I improve the scalability & legibility of this save game format, so I don't have to keep adding new enum categories for each variety of content?


texts: Making more complicated systems(entity-component-system model question)

texts:
I'm using a model where entities are collections of components and components are just data. All the logic goes into systems which operate on components. Making basic systems(for Rendering and handling collision) was easy. But how do I do more compilcated systems? For example, in a CollisionSystem I can check if entity A collides with entity B. I have this code in CollisionSystem for checking if B damages A:

if(collides(a, b)) {
HealthComponent* hc = a->get<HealthComponent();
hc.reduceHealth(b->get<DamageComponent>()->getDamage());

But I feel that this code shouldn't belong to Collision system. Where should code like this be and which additional systems should I create to make this code generic?


texts: Extract smaller frustum from camera frustum?

texts:
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.


texts:
I work as a multi-purpose engineer/developer at a very small startup game company. Recently, I've been asked to help out with audio development and editing, and I've been mostly able to hold my own.

I'm unfamiliar with sample rates though: I understand what they are, and I know 44100 Hz is considered a safe default because it's CD Quality.

However: Is there a practical max sample rate above which the human ear can no longer hear an improvement? In graphics, we have a guideline that humans cannot tell the difference above 60 frames of animation per second (although some people are starting to say 75-90 Hz, I think). Is there a similar upper limit in audio development?


texts: How to keep player rotated toward a sphere when within a certain radius?

texts: 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!


texts:
I'm writing a little game in as3 using Starling, and I need to check collision between 2 boats that can rotate. I don't need the pixel perfect collision, but bounds collision is not enough too. The boat look more or less like this:

I was thinking about create one square on the back of the boat and a triangle on the front, than for each boat, check if the square collide with the other boat square or triangle, and the same for the triangle.

I just don't know how to do that, I don't know if it's possible with the Shape.hitTest, or if it's the best way to do that.

What can I do?


texts: Unity / How to access my screen pixels outside of unity?

texts:
I want to run unity in background and get the pixel colors of my screen.
i didnt find anything on the assetstore or somewhere else that could make that possible.

Texture.ReadPixels()
also does only work for the game camera

What is the way to solve this?


texts:
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):


texts: Use libgdx box2d for dynamically generated top down map

texts:
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


texts:
I am trying to create a simple platformer game with libgdx.
I implemented a collision detection for the player's bounding box with the map's tiles using the Rectangle.overlaps method.

In response I am trying to find out at what edge the player hits the tile and then react accordingly.

Somehow it happens that when the player collides on the X axis, the response of a collision on the Y axes happens (player gets moved to the top of the tile).

I was looking into the SAT (Seperating Axis Theorem), but I don't feel like it's applicable here, since I am not trying to draw any line betwen the Rectangles. In fact, since Rectangle.overlaps() is used I am only reacting to a collision already happening.

Here the source:

private void resolveCollision() {
    setUpPlayerRec(allObjects.get(0));
    for (Rectangle r2 : tiles) {
        if (!playerRec.overlaps(r2)) {
            continue;
        } else {
            onCollisionWithTile(r2);
        }
    }
}

private void onCollisionWithTile(Rectangle r2) {
    Gdx.app.log("Collision Detected", "Player collided with tile");

    float diff;

    if (playerRec.x +playerRec.width < r2.x) {
        // LEFT EDGE OF TILE
        controlledPlayer.getPosition().x =(r2.x - playerRec.width);
        controlledPlayer.getVelocity().x = 0;
    } else if (playerRec.x > r2.x + r2.width) {
        // RIGHT EDGE OF TILE
        controlledPlayer.getPosition().x =(r2.x + r2.width);
        controlledPlayer.getVelocity().x = 0;
    }

    if (playerRec.y < r2.y) {
        // HIT TOP OF TILE
        diff = (playerRec.y + playerRec.height) - r2.y;
        controlledPlayer.getPosition().y -= Math.abs(diff);
        jumptime = MAXJUMP;
        controlledPlayer.setJumpState(JUMP_STATE.GROUNDED);
    } else if (playerRec.y < r2.y + r2.height) {
        // HIT BOTTOM OF TILE
        controlledPlayer.setJumpState(JUMP_STATE.GROUNDED);
        jumptime = 0;
        diff = playerRec.y - (r2.y + r2.height);
        controlledPlayer.getPosition().y = r2.y + r2.height;
    }
}


texts: Why is that when I use Rigidbody the object falls through the floor?

texts:
It keeps falling through the floor.

On the object I added a Rigidbody and it already has a box collider.

And the floor:

I want to make a bouncing ball effect. I'm using the official unity tutorial:

Tutorial

However, my object falls through the floor.


texts: Running one action on multiple sprites simultaneously

texts:
I have created a spiraling animation for a football. I want to be able to run it on 2 sprites simultaneously.

This is what I have done:

CCAnimation* footballAnim = [CCAnimation animationWithFrame:@"Football" frameCount:60 delay:0.005f];
spiral = [CCAnimate actionWithAnimation:footballAnim];
CCRepeatForever* repeat = [CCRepeatForever actionWithAction:spiral];
[Sprite1 runAction: repeat];
[Sprite2 runAction: repeat];

However, the action is only run on the first sprite. What am I doing wrong?


texts:
I have a component which renders a few different cameras and the images. However, this obscures my UI when in Screen Space - Overlay mode.

I can put the canvas in WorldSpace mode, which works, but then the UI is affected by the image effect I've built and is, of course, not locked to the camera.

Suggestions?

Update - additional details

At design time, the OVR camera rig contains a single camera centered between the "eyes." This component is attached to the camera rig's centerEyeAnchor.

At run time, the rig creates two additional cameras - one for each eye. These aren't supposed to be modified by user code. (Among other things, their projection matrices are pretty weird.)

I need to modify the image per eye.

I created a new component which create two additional cameras per eye. One renders a low-res version of the entire scene, the other renders a high-res image of a portion of the screen, each to a dedicated RenderTexture.

Pseudocode:

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

/// called twice per frame - once per eye
void OnPreRender()
{
}

/// called twice per frame - once per eye
void OnRenderImage(RenderTexture source, RenderTexture destination)
{
  /// low-res render of entire scene
  var camOuter = m_cameras[...];
  /// hi-res render of part of the scene - 10-20% of original image area
  var camInner = m_cameras[...];

  /// update cameras to match current eye camera
  camOuter.copyFrom(Camera.current);
  camOuter.targetTexture = m_outerTexture;

  /// render scene to low-res texture
  camOuter.Render();

  camInner.copyFrom(Camera.current);
  camInner.targetTexture = m_innerTexture;

  /// target texture that the Oculus wants to render to
  var ovrTexture = Camera.current.targetTexture;

  /// save projection matrix
  var originalProjectionMatrix = camInner.projectionMatrix;

  var scale = new Vector3(m_innerTexture.width * 1.0f / ovrTexture.width, m_innerTexture.height * 1.0f / ovrTexture.height);

  /// zoom/pan matrix to clip to part of the scene
  var gazeMatrix = Matrix4x4.Scale(scale);

  /// offset projection
  gazeMatrix.m03 += (1 - 2 * gaze.x) * scale.x;
  gazeMatrix.m13 += (1 - 2 * gaze.y) * scale.y;

  camOuter.projectionMatrix = gazeMatrix & originalPRojectionMatrix;

  /// render hi-res portion of the scene centered at gaze pixel
  camOuter.Render();

  /// restore projection matrix
  cam.projectionMatrix = originalProjectionMatrix;

  /// composite images
  m_material.SetTexture("InnerTexture", m_innerTexture);
  m_material.SetTexture("OuterTexture", m_outerTexture);
  Graphics.Blit(null, destination, m_material);

}

(I'm also worried that there may be additional scene renders happening in the background.)

The problem is that the UI does not render if set to Screenspace - Overlay or Screenspace - Camera. I can get it to render in Worldspace, which may be the only way to do this, but then it seems I'd need to create yet another hi-res texture matching the viewport dimensions and render the UI layer to that, and keep it locked to the current eye's camera position. Alternatively, I could re-use one of the current cameras, I guess, and just tweak its settings.

Is there a better way to do this?

Ideally, I'd like to have the engine just render the UI as it does in other applications without having to jump through hoops. However, at this point, I'll take anything I can get that works and looks good.

Update the 2nd

Okay, it looks like the UI is rendered perfectly if I use a regular camera instead of the OVR rig. :( Having the rig in the scene, though, prevents it from drawing at all.


texts: How to improve performance for expensive functions in 2d city builder

texts:
I've already searched for answers but I was not able to figure out the best approach for handling expensive functions/calculations.

In my current game (a 2d tile-based city building) the user is able to place buildings, build roads etc. All of the buildings need a connection to a junction the user has to place at the border of the map. If a building is not connected to this junction, a "Not connected to road" sign will popup above the affected building (otherwise it has to be removed). Most of the buildings have a radius and might be related to each others as well (e.g. a fire department can help all houses within a radius of 30 tiles). That is what I also need to update/check when the road connection changes.

Yesterday I ran into a big performance issue. Lets have a look at the following scenario:
A user can of course also erase buildings and roads. So if a user now breaks the connection right after the junction I need to update many buildings at the same time. I think one of the first advice would be to avoid nested loops (which definitely is a big reason in this scenario) but I have to check...

if a building is still connected to the junction in case that a road tile has been removed (I do that only for affected buildings by that road). (Might be a smaller issue in this scenario)
the list of radius tiles and get buildings within radius (nested loops - big issue!).

// Go through all buildings affected by erasing this road tile.
foreach(var affectedBuilding in affectedBuildings) {
    // Get buildings within radius.
    foreach(var radiusTile in affectedBuilding.RadiusTiles) {
        // Get all buildings on Map within this radius (which is technially another foreach).
        var buildingsInRadius = TileMap.Buildings.Where(b => b.TileIndex == radiusTile.TileIndex);

        // Do stuff.
    }
}

This all breaks down my FPS from 60 to almost 10 for one second.

So would could I do. My ideas would be:

Not using the main thread (Update function) for this one but another thread. I might run into problems of locking when I start using multithreading.
Using a queue to handle a lot of calculations (what would be the best approach in this case?)
Keep more information in my objects (buildings) to avoid more calculations (e.g. buildings in radius).

Using the last approach I could remove one nesting in form this foreach instead:

// Go through all buildings affected by erasing this road tile.
foreach(var affectedBuilding in affectedBuildings) {
    // Go through buildings within radius.
    foreach(var buildingInRadius in affectedBuilding.BuildingsInRadius) {
        // Do stuff.
    }
}

But I don't know if this is enough. Games like Cities Skylines have to handle way much more buildings if the player has a big map. How do they handle those things?! There might be a updating queue since not all the buildings do update at the same time.

I'm looking forward to your ideas and comments!

Thanks a lot!


texts: Linear color workflow with render to texture - Banding in alpha channel?

texts:
In OpenGL, I am using GL_SRGB8_ALPHA8 for the OpenGL internal texture format for my textures and render targets. This eliminated some banding I was seeing in dark opaque areas. However, in the following screenshot, you can see there is still some banding in the nearly-opaque black pixels on the left side. The render target is transparent in the areas where you see the checkerboard pattern.

Semitransparent pixels in SRGB formatted textures and render target textures appear too transparent when rendered to the screen, and pixels that are very nearly opaque (254, 253, 252 alpha) show noticeable banding as you can see in the sample image.

I've seen the issue with both SRGB formatted render target textures and ordinary textures with SRGB format.

The banding appears to go away if I don't call glEnable(GL_FRAMEBUFFER_SRGB).

I'm using premultiplied alpha, but I'm pretty sure I've eliminated that as a cause of the issue. I'm not doing anything to the sampled color in the pixel shader.

My blend functions:

// Non-premultipled alpha textures
glBlendFuncSeparate( GL_SRC_ALPHA,  GL_ONE_MINUS_SRC_ALPHA,
                     GL_ONE,        GL_ONE_MINUS_SRC_ALPHA);

// Premultiplied alpha textures
glBlendFuncSeparate( GL_ONE,        GL_ONE_MINUS_SRC_ALPHA,
                     GL_ONE,        GL_ONE_MINUS_SRC_ALPHA);

I tried exporting my render target to a PNG, and the true alpha values stored in the render target are increasing by 1 at each band. The texture appears much more opaque in image editors than it does in my app.

Any advice as to what could cause this kind of alpha banding?


texts: Is the statement in Scratchapixel about transforming points correct?

texts:
I am reading this lesson from scratchapixel. To my understanding (and the example given in the same website) M is the matrix that transforms from local to world.

Giong through the paragraph before figure 7, though, I get the following:

  If we know the 4x4 matrix M that transforms a coordinate system A into a coordinate system B ...

Say A is the local coord system and B is the world coord system. Therefore M transforms from local to world.

  ... then if we transform a point whose coordinates are originally defined with respect to A with the inverse of M (...), we get the coordinates of P with respect to B.

We know, A = local coord system. The Plocal = local point coords are (-0.5, 0.5, -0.5). Then, as the quoted text says, we transform Plocal with the inverse of M to get the point w.r.t. to B = woorld coord system

However, this last operation (statement) confuses me, since the example they give the do Pworld = Plocal * M. But from the quoted text I understand that Pworld = inv(M) * Plocal

Can someone help me figuring out what am I missing? Is the wording of the text wrong?


texts:
Continuing from this question (new question - now unrelated)

So I have a thorough background in programming already (algorithms, math, logic, graphing problems, etc.) however I've never attempted to code a game before. In fact, I've never had anything more than minimal input from a user during the execution of a program. Generally input was given from a file or passed through console, all necessary functions were performed, then the program terminated with an output. I decided to try and get in on the world of game development. From several posts I've seen around gamedev.stackexchange.com XNA seems to be a favorite, and it was recommended to me when I asked where to start.

I've downloaded and installed Visual Studio 2010 along with the XNA Framework and now I can't seem to get moving in the right direction.

I started out looking on Google for "xna game studio tutorial", "xna game development beginners", "my first xna game", etc. I found lots of crap. The official "Introduction to Game Studio 4.0" gave me this (plus my own train of thought happily pasted on top thanks to MSPaint):

http://tinypic.com/r/2w1sgvq/7 (broken image)

The "Get Additional Help" link (my best guess, since there was no "Continue" or "Next" link) lead me to this page:

http://tinypic.com/r/2qa0dgx/7 (broken image)

I tried every page. The forum was the only thing that seemed helpful, however searching for "beginner", "newbie", "getting started", "first project", and similar on the forums turned up many threads with specific questions that are a bit above my level ("beginner to collision detection", for instance)

Disappointed I returned to the XNA Game Studio home page. Surely their own website would have some introduction, tutorial, or at least a useful link to a community. EVERYTHING on their website was about coding Windows Phone 7.... Everything.

Giving up on any official documentation after a while, I went back to Google. I managed to locate www.xnadevelopment.com. The website is built around XNA Game Studio 3.0, but how different can 3.0 be from 4.0?.... Apparently different enough.

http://tinypic.com/r/5d8mk9/7 (broken image)

Figuring that this was the correct folder, I right-clicked....

Hmm... maybe by "Add Content Reference" they mean "Add a reference to an existing file (content)"? Let's try it (after all- it's my only option)

At this point I gave up. I'm back. My original goal in my last question was to create a keyboard-navigable 3D world (no physics necessary, no logic or real game necessary). After my recent failures my goal has been revised. I want to display an image on the screen.

Hopefully in time I'll be able to move it with the keyboard.


texts: Should I use Game Engines to learn to make 3D games?

texts:
HI i am a software engineering student in his second-last year.

I am proficient with C,C++,C# and java programming languages, and being a student of engineering I have studied calculus, vectors etc in both 2D and 3D & various other mathematical, probability and statistical topics.

I have made several 2D games, my most recent being a Super Mario-like game with side-scrolling and multiple levels.

Due to my these small game projects,i have become really interested in making games.

So now i want to move ahead to learn to make games in 3D.

Now I know that there are several game engines available which can take care of rendering details and other "low-level" stuff for me...

My Question is:

1) Is it a good idea to learn to program everything yourself, from making 3D shapes, terrains (using polygons meshes) etc, to programming mechanism for collision detection, lighting etc, considering my motive is to learn how to make games in 3D (but am not too eager to get into the game industry quickly, want to build a solid foundation first)

Or could I do without these details & work on the abstraction-level which the game engines (like UDK) provide ??

3) If I should try to develop from scratch, then  can anybody suggest which API to use: Direct3D or OpenGL?? (which i would be more comfortable with, in light of my above mentioned skills) & can anybody also give me references to some good books, reading materials, tutorials, etc to get me started?? (I wouldn't mind theory as long as it helps me make a sound foundation)

Many Thanx in advance (for even reading my question, i know it's lengthy... but i need a DETAILED answer... :D :D )


texts:
I don't know if there's an accepted solution to this wicked problem. I'm thinking about the design of an online PvP game. A key aspect of the game, something that is just a given, and not my choice, is that people will join the game at very different times. New players can still show up after there are already powerful players established.

How is it possible to balance such a game so that latecomers aren't immediately crushed by the powerful players? I've played several games like this, and the only way I've seen to mitigate this is to have regular restarts, where new game worlds are released periodically to give everyone a fair start. In one of my own games, I tried a protection system, where new players were immune from attack for 25 days. This worked, until the 25 days were up, whereby the crushing commenced as normal.

This scenario causes a lot of frustration with new players, and makes many of them quit right away. Are there any genius solutions that might help? One I have in mind is keeping new players more physically distant from old ones so it takes the powerful players a while to find the newbies, giving them time to defend themselves. Thoughts?


texts: I have a sphere shot out of a cannon which i need to get lined up with another sphere when and if the two spheres collide. Considering that both spheres are moving (one in X and the other is shot at the first one) how would i animate the cannon sphere to line up if the collision occurs? I can use a bool to check if collision but how do i animate the projectile in the animation tab so that the projectile takes into consideration the always changing position of the X moving sphere ?


texts:
I'm attempting to manually setup a matrix in my vertex shader
purely because I like to learn as much as possible about anything I do usually.

So the problem is that I'm getting an GL_INVALID_OPERATION
when too me my code seems clear as crystal complete.

const GLfloat modelviewmatrix[] = {
    1.0f , 0.0f , 0.0f , 0.0f,
    0.0f, 1.0f, 0.0f , 0.0f ,
    0.0f, 0.0f, 1.0f, 0.0f,
    0.0f, 0.0f, 0.0f, 1.0f
};

GLint locationID = glGetUniformLocation(ShaderPrograms, "modelviewMatrix");

std::cout << "location->" <<locationID << std::endl;
glUniformMatrix4fv(locationID, 1, GL_FALSE, modelviewmatrix);

GLenum error;

error = glGetError();

if (error != GL_NO_ERROR)
{
    std::cout << "not working" << std::endl;
}

if (error == GL_INVALID_OPERATION)
{
    std::cout << "INVALID OPERATION" << std::endl;
}
if (error == GL_NO_ERROR)
{
    std::cout << "No Error! -> CODE CHECKING <-" << std::endl;
}

if (error == GL_INVALID_VALUE)
{
    std::cout << "NO VALUE" << std::endl;
}

if (error == GL_OUT_OF_MEMORY)
{
    std::cout << "NO MEMORY" << std::endl;
}

if (error == GL_STACK_OVERFLOW)
{
    std::cout << "NO OVERFLOW" << std::endl;
}

if (error == GL_INVALID_FRAMEBUFFER_OPERATION)
{
    std::cout << "invalid framebuffer <-" << std::endl;
}

if (error == GL_OUT_OF_MEMORY)
{
    std::cout << "Out of Memory" << std::endl;
}

//VERTEX SHADER

#version 330 core

layout (location = 0) in vec3 position;

uniform mat4 modelviewMatrix;
uniform mat4 projection;

void main()
{

    gl_Position = modelviewMatrix * vec4(position.x, position.y, position.z, 1.0);
}

What could be causing the problem , why is it causing it
. how did you find out and what did you use too figure it out please?.

OpenGL 3.30+ , GLSL 3.30 core , Win10 64bit.

figured out what the problem was I was using glUseProgram
after I was doing uniforms instead of doing that before.

full source here ->
http://pastebin.com/zD7YEDjp


texts: Where is the part of the code of the mouse click in the TopDownCharacter blueprint?

texts:
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:


texts: Move Camera After Player Moves Certain Distance

texts:
I've got a 3D mobile game with the player centered in the middle of the screen, and a camera looking down on top of the player. The player is controller by an on-screen joystick. Currently when the joystick is touched to move the player, the camera instantly moves along with the player. This is okay, but what I want to have happen is to allow the player to move in a small circular area freely without the camera moving. Once the player reaches the edge of the pre-defined area, I'd like the camera to start moving with the player again. If the player starts moving back towards the camera location (x,y) then I'd like the camera to stop moving and allow the player to roam freely again.

I've got this sort of working with the following code using LateUpdate, but as I move the player near the edge of the max distance from the camera the movements get jumpy.

public class CameraController {
    const float MAX_DISTANCE = 5f;

    void LateUpdate()
    {
        if (Joystick.IsTouched)
        {
            // This properly shows the distance the player is from the camera
            float distance = GetPlayerDistance();

            if (distance > MAX_DISTANCE)
            {
                // Move camera the same way the player is being moved.
                // This works and moves the camera and player properly in sync.

                // This causes jerky and unsmooth movement when the distance
                // is close (above/below/equal) to the max in subsequent frames.
            }
        }
        else if (transform.position.x != player.position.x || transform.position.y != player.position.y)
        {
            // Lerp the camera position back to be directly above the player
            // when the joystick is let go and the camera and players' x or
            // y position don't match. This works great.
        }
    }
}

I am having trouble figuring out how to get this working properly. I can't seem to come up with a way to determine when the player should be allowed to move freely after they have already hit the max distance from the camera. When it first starts, the player can move freely fine, and when letting go of the joystick, the camera animates back properly. The issue arises once the max distance is hit.

I've also tried parenting the player to the camera to have them move in sync when the threshold is hit, but I am unable to determine when to un-parent them because the ship can't move freely to get closer to the camera. Any thoughts on this approach? It works perfect except I can't figure out when to un-parent the two game objects.

Thanks in advance for any help/thoughts!


texts:
Usually in 3d drawing you want to ideally have fewer larger textures rather than lots of smaller ones, and make sure you render the same kinds of textures at the same time. So there is less texture swapping going on behind the scenes.

This is not a difficult thing to do as most textures are purely used for models or terrains/structures. So you may have a terrain texture, a structures texture and a couple of player/enemy textures. Then just draw the terrain, the structures and any enemies and the player, only requiring a few texture swaps there, and if you are also using some sort of model instancing for the enemies you can get away with some other improvements there.

Anyway now enter the 2d drawing world, rather than applying a texture and then drawing lots of vertices using it you are giving a texture to each draw command. So I am wondering how XNA handles this behind the scenes.

Take for example a top down 2d game, you have a tileset for the level containing many ground sprites, an enemy sprite sheet which may contain anywhere from 10-20 enemies sprites and animations, then possibly a player/equipment sheet which contains anything for them.

Now in this instance if I were to draw my level which was lets say 64x64 tiles (a tile being an x,y,tileSetIndex), and I have a tileset with 8x8 sprites (lets say 32x32 each):

var tileSetSourceRect = someTilesetEntity.GetSourceRectForIndex(tile.tileSetIndex);
mySpriteBatch.Draw(someTilesetEntity.TilesetTexture, tileSetSourceRect , tile.Position, Color.White);

assuming no real optimisations and just looping through every tile would this just retain the tilesetTexture in memory, or is it going to keep removing/adding the texture after every Draw() call? As I do not know how it can manage this unless it keeps some state under the hood between draw calls (maybe thats what Begin/End is for on spriteBatches).

So will I be getting 4096 (64x64 tiles itterated) texture swaps, or will it only do 1 texture swap in this instance?


texts: Resources.Load doesn't grab values of my child class

texts:
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?


texts: how to structure game logic for user interfaces of different nature (gui, tui, cli)?

texts:
I would like to implement a simple game logic engine that is agnostic to the rendering system, but I don't know how to do that, really... so I would like to have advise and know the state of the art!
the idea is to have a "logic" class that contains the step to be done to advance the game, for instance "show this to the user" or "wait for user input on this choice": while it was easy to make it work in a textual user interface like this:
forever {
    switch logic_get_next_action() {
        // Writes a message to the user on the provided output
        when MESSAGE: write(stdout, logic_get_message());
        // Writes multiple choices, then waits for an input
        when CHOICE: {
            for c in logic_get_choices() {
                write(stdout, c);
            }
            logic_update_state(read(stdin));
        }
        ...
    }

}

initially I thought that decoupling from stdin and stdout would be enough, and I could devise some sort of encoding that would allow me to use another kind of interface, but I realized this is very textual-centered, and relies on some synchronicity.
for instance it relies on the writes in choice to happen and be concluded before the read, and also blocks on read.
I suppose a more asynchronous solution is needed here but not really sure on how to proceed: don't want to be trapped in local choices! for instance after the textual prototype I am using an immediate mode GUI toolkit now, but what changes will I have to make if I ever switch to a retained mode?


texts:
Let's say I have two Canvases: BackgroundCanvas and UICanvas.

Now, on BackgroundCanvas I have multiple moving, not clickable objects so I removed the GraphicRaycaster (+ 69 to performance).

On the UICanvas, all the objects are on the UI layer.
I also have some additional layers somewhere else.

Now, if I change the GraphicRaycaster's (on UICanvas) blocking mask to UI only, would it improve performance if there are other objects on the Default and other layers? Or would it still ray all these objects on other layers?

How does this really work? I'm asking cause I don't see any performance impact while switching these Blocking Masks, but after disabling the entire component - I do (but the input is not working ;S).


texts: How to stop this object from overlapping tile's corners in 2D tilemap

texts:
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:


texts: Accurately simulating the lots of dice rolls without loops?

texts:
OK so if your game rolls lots of dice you can just call a random number generator in a loop.
But for any set of dice being rolled often enough you will get a distribution curve/histogram.
So my question is there a nice simple calculation I can run that will give me a number that fits that distribution?

E.g. 2D6 - Score - % Probability

2 - 2.77%

3 - 5.55%

4 - 8.33%

5 - 11.11%

6 - 13.88%

7 - 16.66%

8 - 13.88%

9 - 11.11%

10 - 8.33%

11 - 5.55%

12 - 2.77%

So knowing the above you could roll a single d100 and work out an accurate 2D6 value.
But once we start with 10D6, 50D6, 100D6, 1000D6 this could save a lot of processing time.
So there must be a tutorial / method / algorithm that can do this fast?
It is probably handy for stock markets, casinos, strategy games, dwarf fortress etc.
What if you could simulate the outcomes of complete strategic battle that would take hours to play with a few calls to this function and some basic maths?


texts: What is the better form of movement for a vehicle that the player is inside of?

texts:
I am using unreal engine 4 to make this. Basically I have a submarine that the player can move around in and can control the submarines movement within an ocean. However I don't know the best way to implement movement of that submarine. I thought of several ideas. The first one being just moving the whole submarine model and all the objects inside of it within the terrain. However I am worried about moveable objects within the submarine glitching out because of this.

Another idea I had was setting a basic cube that is about the same size as the whole submarine model as a sort of "dummy" submarine that moves around the terrain and its movement is controlled by the controls inside of the actual submarine. However with this idea I don't know how having two areas loaded would work (the contents and models within the actual submarine and the terrain around the dummy one). Is it possible to have two loaded areas in an level at once? How can I implement it?


texts:
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?


texts: How do I stop movement from being mirrored on the X and Y axis with Unity & Kinect?

texts:
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?


texts: When should rendering be performed during a frame?

texts: When working with OpenGL or DirectX, should draw calls be done all at once, at the end of the update loop, or is it better to have draw calls occur during the update loop rather than just at the end?


texts: What type of rotation is this and how do I apply it?

texts:
I'm developing a 3D game in Java using LWJGL and JOML. In order to simplify player and NPC coding, I'm representing their orientation as two scalar quantities: "direction" and "angle" (maybe not the best names). "Direction" is the compass direction that the object is facing, and "angle" is the angle of the object relative to a horizontal plane. So for example if a player has a direction of 180 and an angle of 45, it will be looking south at a point halfway between the horizon and the zenith.

First question: what is this kind of rotation called officially?

I've already written code to handle calculations on points/positions represented in this manner, but I don't know how to include the rotation in a transformation matrix for OpenGL. I have the following code to produce a transformation matrix for an object:

Matrix4f world_matrix = new Matrix4f().identity().translate((float) position.x, (float) position.z, (float) -position.y).rotateY((float) Math.toRadians(-direction));

(same code, more readable)

Matrix4f world_matrix = new Matrix4f()
    .identity()
    .translate((float) position.x, (float) position.z, (float) -position.y)
    .rotateY((float) Math.toRadians(-direction));

where position is the location of the object and direction is the aforedescribed "direction" of the object.

Second question: how do I include angle in world_matrix?


texts:
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;


texts: Should I make a FPS game on Fixed Function Pipeline or Programmable Pipeline OpenGL?

texts:
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!


texts: I was wondering if someone could recommended a book that covers both android game developement and OpenGL ES 2.0. I have found some books with OpenGL 1.0, but I have heard that the syntax for OpenGL es 2.0 is totally different.


texts: Unity3D - How to "force" rotation over the X axis

texts:
When I click to left or right, up or down, I'd like my airplane to rotate over the x-axis, to loop, and at some point over the z-axis in order to end up with the y-axis pointing up (world up).

Let me show you what it looks like right now, and draw what I'd like the end result to be like.

Up and down:
https://photos.app.goo.gl/HFqRychpR9W8oFq59

Right and left:
https://photos.app.goo.gl/BcPyQvu2TFpG763aA

This is what I'd like to happen:

Here is how the axis are setup

Here is the code that is currently rotating the airplane

    void Update()
{

    if (Input.GetMouseButton(0))
    {
        worldposition = cam.ScreenToWorldPoint(new Vector3(Input.mousePosition.x, Input.mousePosition.y, 57));
        worldposition.z = 25;
        relativePos = worldposition - transform.position;
    }

    Quaternion rotation = Quaternion.LookRotation(relativePos, Vector3.up);
    transform.localRotation = Quaternion.Lerp(transform.rotation, rotation, RotationSpeed * Time.deltaTime);

    transform.Translate(Vector3.forward * Speed * Time.deltaTime, Space.Self);
    transform.position = new Vector3(transform.position.x, transform.position.y, 25);

}

I have played around with Rotation and Quaternions for a few days already and I am unable to accomplish what I need.

Any suggestions would be greatly appreciated.
Thank you.


texts: How can I get multiple players play my multiplayer game at launch?

texts:
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?


texts: Stretching limited graphic assets in a loot based game

texts:
I’m creating a game with a fairly simple gameplay. The battle will be similar to rock, paper, scissors but with stat components where your choice combined with your stats determines the winner.  It has  limited graphics however it’s weapon based so you weapon will be shown. Therefore I think it’s be more fun to focus a lot on loot and upgrading the visual of the weapons and other properties of your character that you’re using in battle.

The problem is I have a fairly limited budget to start so I’m trying to determine the best way to stretch my graphic assets and number of weapon yet still make the game interesting.

The options I’ve considered so far:

1) At the end of every game you get a new random weapon/weapon skin. This is the most fun but also would require the most skins as you’ll run through them really quick.

2) When you win you win a random weapon skin, you then have to combine them in some way like 3 tier 1 skins equals 1 tier 2 skin, and 3 tier 2 skins equals 1 tier 3 skin. This is a nice middle balance.

3) You only win stat increases, you must pay for new skins if you want to upgrade your cosmetics. This is the least fun way as your “loot” isn’t very appealing, but I would only need a few assets in the store to start.

I’m hoping by asking this I can find quality and creative ways to approach this issue that I wouldn’t have otherwise thought of. I know there is no “best” so hopefully this question isn’t off topic but Intruly need help here.


texts: How to manipulate browser pixels on different mobile devices

texts:
I'm creating a board game using HTML5, CSS3 and JavaScript. It's working fine on Desktop browsers properly. But when i load it on Windows phone it's not behaving properly. The resolutions and the game board are not matching. I'm targeting Windows and Android platform.

Game Board is 1050x650 px which is implemented using HTML and css3.
now what i want to know is most browsers don't support certain CSS3 features like rotations and key-frames animations so will it be better if i use photoshop to make the board for different resolutions or is it possible to do the same as i did using HTML5 and CSS3.

And in the above image, let's say distance between B and a red dot is 200px and i use JS to manipulate the movement of B from one point(red dot) to another point(red dot), now will the distance 200px be the same in all the devices? If not how to write a proper code to manipulate the movement in all mobile devices?


texts:
I've read a lot of forums about making 3D games in Java but I was unable to build a full picture of how it performs in video games.

I know that it works smoothly for small and average size games, but what would happen if one tried to write Crysis 3 scale game on Java? What would become the bottleneck of rendering performance? Would there be any difference at all compared with the same game written in C++? How much performance trouble would additional JNI layer give?

I would be glad to receive a detailed answer (or at least a link to some article) describing parts that JVM would never be able to optimize enough to give performance comparable with C++.

Thanks in advance.


texts: Does the order of vertex buffer data when rendering indexed primitives matter?

texts:
I'm building a 3d object's triangles. If I can write them to the buffer in the order they are calculated it will simplify the CPU code. The vertices for the triangles will not be contiguous.

Is there any performance penalty for writing them out of order?


texts: Loading FBX Files into a DirectX 9 Application

texts:
I'm having an extremely difficult time trying to convert an FBX file into a format that can be used with DirectX. I've read a lot of articles on forums all over the internet and have followed instructions carefully but have not yet been successful in loading a skinned mesh from an FBX file.

As I understand it, I am required to set the 'Bone Offset' field of a DirectX skinned mesh frame to the inverse bind pose of the bone which I can get using FBX SDK like so:

            // iterate deformers( TODO: ACCOUNT FOR MULTIPLE DEFORMERS )
            for(int i = 0; i < ncDeformers && i < 1; ++i)
            {
                // skin
                FbxSkin *pSkin = (FbxSkin*)pMesh->GetDeformer(i, FbxDeformer::eSkin);
                if(pSkin == NULL)
                    continue;

            // bone count
            int ncBones = pSkin->GetClusterCount();

            // print
            printf("\n\t::Skin Found::");
            printf("\n\t\tBone Count: %i", ncBones);

            // iterate bones
            for (int boneIndex = 0; boneIndex < ncBones; ++boneIndex)
            {
                // cluster
                FbxCluster* cluster = pSkin->GetCluster(boneIndex);

                // bone ref
                FbxNode* pBone = cluster->GetLink();
                FbxNode* pParentBone = pBone->GetParent();

                // Get the bind pose
                FbxAMatrix bindPose,
                    inverseBindPose,
                    transform;
                cluster->GetTransformMatrix(transform);
                cluster->GetTransformLinkMatrix(bindPose);

                // inverted global transform * transform
                inverseBindPose = bindPose.Inverse();

                // set bone offset
                pSkinnedMeshContext->SetBoneOffset(boneIndex, inverseBindPose);
    ...
}

Then I get animation like this:

// for each key
for (int keyIndex = 0; keyIndex < ncKeys; keyIndex++)
{
    // get time object
    FbxTime curtime = std::min(stop.Get(), start.Get() + (interval * keyIndex));

    // node transform at time T
    FbxAMatrix mKeyValue = pAnimEvaluator->GetNodeGlobalTransform(pNode, curtime);
}

Then in my renderer I have this:

Matrix[] maPalette = new Matrix[8];
for(int iBone = 0; iBone < boneCombination->BoneCount; ++iBone)
{
    Matrix mBoneTransformAtTimeT = maPalette[iBone] = meshContainer.BoneOffsets[iBone] * meshContainer.Palette[iBone].CombinedTransform;
}

effect.SetBoneTransforms(maPalette);

The model, however, is disfigured...
skinned mesh:

standard mesh:

What is the proper way to evaluate the transforms for a skinned mesh when converting from FBX to DirectX 9?


texts: What's the fastest way to copy a texture to another texture in OpenGL?

texts:
Here's the options I've found:

glBlitFramebuffer: Create framebuffers for the textures, bind textures as GL_READ_FRAMEBUFER and GL_DRAW_FRAMEBUFFER, call glBlitFramebuffer().
glCopyTexImage2D: My research so far says this method is probably slow.
Shaders: Make a framebuffer and render target, render the source texture to the dest texture.


texts: Why does BorderLayout crop out JSlider on JFrame

texts:
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();
    }
}


texts: Basic multiplayer matchmaking implementation

texts:
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.


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

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

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


texts: Unity3D: Rigidbody2D not colliding with BoxCollider2D

texts: 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?


texts: Lighting in Unreal is not fluid, lighting changes drastically at object "borders"?

texts:
I used the starter content's wall objects, an atmospheric fog, a directional light and this is the result:

As you can see, it's obvious where the new object starts.

Why?


texts: Instance creation order error in GameMaker

texts:
Look at the order of creation of the instances of a of the phases of my game.

Notice that first obj_BolaAzul (blue circle/square) is created, then obj_BolaVermelha (red circle/square).

As you can see, this is not what happens in the game. The obj_BolaAzul even being created first, it is above of obj_BolaVermelha.

This is happening in all other phases and began to occur a few days ago. Could someone tell me in some global configuration that I have modified.


texts: Is there any less expensive way to achieve this lighting effect?

texts:
I'm creating a game that is similar to Tibia on its projection:

But I want it, under the hoods, to be 3D, and extremely dynamic - meshes generated on the fly, statues exploding and turning into smoke monsters, things like that. For that, I've created a renderer that isn't geometry based, but atom based - it takes a compact buffer of positions and colors and renders it to screen. It works extremely well and is quite fast. There is only one problem, lighting. To achieve realistic lighting, I must, for each atom on the screen, emit a ray that traces a volume, sampling among the way. If it hits something before the light, that space isn't lit. This is the end result:

I love that effect, but, on my machine with a low-end GPU, it can stand millions of atoms, but only 2 lights max. That is not enough, I'd need 16 lights at least. Each light requires dozens of samplings for each atom on scene, it is prohibitively expensive. Without global lighting, the ambient becomes flat and boring.

Is there any creative way to achieve the same effect, albeit less expensive?


texts: Errors attempting to use Assimp in DirectX 12

texts:
I am trying to load a 3D model within a DirectX 12 project by means of Assimp, but even when I write only the importer function, I get errors I can not fix. How do I fix this?

Here is my code:
void Model::LoadModel(const std::string& FileName)
{
    Assimp::Importer importer;

    const aiScene* scene = importer.ReadFile("coso.fbx",
        aiProcess_CalcTangentSpace |
        aiProcess_Triangulate |
        aiProcess_GenSmoothNormals |
        aiProcess_SplitLargeMeshes |
        aiProcess_ConvertToLeftHanded |
        aiProcess_SortByPType |
        aiProcess_PreTransformVertices);

    if (scene == NULL)
    {

    }
}

Here are the errors I get:

Error    LNK2001 unresolved external symbol "public: struct aiScene const * __cdecl Assimp::Importer::ReadFile(char const *,unsigned int)" (?ReadFile@Importer@Assimp@@QEAAPEBUaiScene@@PEBDI@Z) Model.obj   1
Error    LNK2001 unresolved external symbol "public: __cdecl Assimp::Importer::~Importer(void)" (??1Importer@Assimp@@QEAA@XZ) Model.obj  1
Error    LNK2001 unresolved external symbol "public: __cdecl Assimp::Importer::Importer(void)" (??0Importer@Assimp@@QEAA@XZ) Model.obj   1


texts: Can you run a websocket client in EU4 server mode?

texts:
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?


texts: Collision detection in a 3D heightmap-based world

texts:
I'm creating a simple engine to increase my knowledge, and have a Minecraft like world, but the height is only one block.

How would you suggest I detect for collision? AABB would be good, but I have no clue. My map is stored in a 2 dimensional byte array, and I have the current location of the "player"/camera in X, Y and Z as well as the yaw (0-360 degrees).

I'm using LWJGL if that makes a difference, any ideas?


texts: How to create an instance of Windows Firewall interface object in Unity

texts:
I am trying to make the game add itself into the Firewall rule. I already referenced NetFwTypeLib.dll into the project. It led me to this line of code here:

INetFwPolicy2 fwPolicy2 = Activator.CreateInstance(typeof(INetFwPolicy2)) as INetFwPolicy2;

This gave me an exception of:

MissingMethodException: Default constructor not found for type NetFwTypeLib.INetFwPolicy2

I already tried

Activator.CreateInstance(Type.GetTypeFromProgID("HNetCfg.FwPolicy2"));

which led me to another exception of:

NotImplementedException: Unmanaged activation is not supported

I don't know what to try anymore. Thank you in advance.


texts: Creating Fog Of View in 2D game with lighting method

texts:
I'm creating 2D side scrolling game with Unity, and i want to add feature where the player come into a cave, then all going dark, the player turn on the flash light, so the player can see around ( With limited range )

I have done creating that by setting all object color to Black, and if the light is touching the object, the object color turned to White, but the problem is, if just a little of light touching the object, the entire object color turned to white ( No Gradation or something like shading )

so my question is

Is there any suggestion or another method to fix that ?


texts: What coordinate system to use to handle 2D UI?

texts:
Following on from the aspect ratios question, I'm interested to hear what other people are using when working on 2D UI systems (most likely their own home-grown solutions). Specifically, how do you handle coordinate systems. To my mind there are three options:

Hard-coded co-ordinates (e.g.: 0 -> 720, 0 -> 576)
Normalised co-ordinates (0.0 -> 1.0, 0.0 -> 1.0), mapped into real coordinates before rendering
Virtual co-ordinates (e.g.: 0 -> 1600, 0 -> 1000), mapped into real coordinates before rendering

Hard-coded is obviously only useful if you're on a fixed platform and know what your screen space coordinates are in advance, or if you're prepared to author screen layouts for every possible set of screen dimensions.

Normalised co-ordinates are nice, but suffer from ambiguity when the aspect ratio of the screen isn't fixed (e.g. 0.75 maps to a different physical co-ordinate when running in widescreen than it does in 4:3). Also, for the authors, it's really counterintuitive to declare a UI element to be (0.2 x 0.2), only to find it's not actually square when rendered.

Virtual co-ordinates are unambiguous, but suffer from the same problems as normalised co-ordinates at the remapping stage: a tiny decimal discrepancy can result in off-by-one errors meaning that UI elements which should tile now have a seam between them.

Similarly, when you do have a fixed resolution screen, both normalised and virtual coordinates mean that it's very difficult to guarantee a 1:1 mapping between your artist's finely crafted pixels in the UI image, and pixels on screen, meaning you run the risk of nasty scaling artefacts (assuming you're rendering as textured quads on screen).

We've gone with the virtual co-ordinate approach, specifically to avoid ambiguity about aspect ratios. So when rendering to a 16:10 screen, the UI space is (0,0) -> (1600,1000), but when rendering to 4:3, the usable UI space is actually (133,0) -> (1467,0).

Are there any better solutions that I'm just not aware of? Are there any good strategies for minimising the problems these 3 approachs have?


texts: Detecting when a car is out of the track

texts:
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.


texts:
When I add a Button component, it looks like this:

Normally, it should look like this:

How can I fix this issue?


texts: Meshes crashed memory from CharacterCustomization example

texts: I am trying the CharacterCustomization example from Unity3D which contains two scenes: Dressing room and VirtualWorld, run the VirtualWorld on iPhone, it could run but at last it will crashed, Instruments and profiler, I found the meshes are always increased and run out of memory. Anybody could help? thanks.Environment: Unity 3.4.0, Xcode 4.0.2, iOS SDK 4.3


texts: How do I calculate distance between a point and an axis-aligned rectangle?

texts:
I have a 2D rectangle with x, y position, height and width, and a randomly positioned point nearby.

Is there a way to check if this point might collide with the rectangle if it is closer than a certain distance? Imagine an invisible radius outside of that point colliding with said rectangle. I have problems with this simply because it is not a square!


texts: Randomizing material across meshes - UE4

texts:
I have multiple instances of the same mesh which is using the same material.

While looking for randomizing textures, I came across texture bombing and so the material in 1 wall looks fairly random. Its a blend of 2 materials. But the problem is different walls look the same. Is there some way so the walls look different with same material. For eg: The green moss is random across the walls and not look same?

Thanks


texts: In XNA, how do I dynamically load parts of a large 2D world map?

texts:
I want to develop a huge world map; at least 8000×6000 pixels in size. I have broken it into a 10×10 grid of 800×600-pixel PNG images. To avoid loading everything into memory, the images should be loaded and unloaded depending on the player's position in the grid.

For example, here is the player at position (3,3):

As he moves to the right to (4,3), the three images at the far left are deallocated while the three images at the right are allocated:

There should probably be a threshold inside each cell of the grid triggering the loading and unloading. The loading should probably happen in a separate thread.

How do I design such a system?


texts: Unity - Static Camera Perspective, Walls Obscure Player

texts:
Pretty simple and common problem here.
The world I'm designing is fully explorable, no invisible walls or tricks. It's presented as a single seamless area, a School complex with 9 buildings, some of which have 2 or 3 floors and contain many rooms.

The perspective I've chosen is simple, inspired by topdown RPGs:

A problem arises with walls. They obscure the player.

I've tried some shaders which draw a silhouette of the player ontop but I don't like this approach, other objects and decoration remains obscured behind the wall.
Some kind of dissolve effect allowing you to see through the walls would be preferable, but writing my own shaders is not my forté...

Another problem is with large buildings outside. The camera is at a fixed distance, about 14 metre's away. If the player walks behind a large building (over ~10 metres tall) then the camera cuts off the top of it as it is now within the building.

The only way I can think of fixing this is to adjust the distance between player and camera, but some of the buildings are so tall the zoom-out looks very unusual and impractical.

I suppose this is why you don't see this simplistic camera setup in large explorable games...

While I've been developing games for some years now, I've only come to 3D and Unity fairly recently, so there might be a jaw-droppingly simple solution which I'm not seeing.

Anyway, I'd like to hear some interesting or novel approaches towards fixing these problems, besides the simple ones I've suggested.

I hope that's not asking too much.


texts: How can I make the space craft takeoff/landing by code with logic?

texts:
The code so far :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimFlyertransportationController : MonoBehaviour
{
    public Transform transformToMove;
    public GameObject JetFlame;
    public float speed;
    public bool takeOffLand = false;

    private Animator[] animators;

    private void Start()
    {
        TurnAllAnimtorsOff(transform, false);
    }

    private void Update()
    {
        if(takeOffLand)
        {
            TakeOff();
        }
        else
        {
            Land();
        }
    }

    private void TakeOff()
    {
        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 7, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);
    }

    private void Land()
    {
        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 0, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);
    }

    private void TurnAllAnimtorsOff(Transform root, bool onOff)
    {
        animators = root.GetComponentsInChildren<Animator>(true);

        foreach (Animator a in animators)
        {
            if (onOff)
            {
                a.enabled = true;
            }
            else
            {
                a.enabled = false;
            }
        }
    }
}

The problem :

I need to call the function TurnAllAnimtorsOff but each time only once when taking off and when landing. When taking off it should first turning all animators and flame to true turn them on then taking off and when landing first to land when reaching height target when landing finished then call the function again and turn off all the animators and the flame.

I added this flag bool variable takeoffland as helper but now the object is taking off and engine and animators turning on but now it's not landing anymore :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimFlyertransportationController : MonoBehaviour
{
    public Transform transformToMove;
    public GameObject JetFlame;
    public float speed;
    public bool takeOffLand = false;

    private Animator[] animators;
    private bool takeoffland = false;

    private void Start()
    {
        TurnAllAnimtorsOff(transform, false);
    }

    private void Update()
    {
        if(takeOffLand)
        {
            if(takeoffland == false)
            {
                TurnAllAnimtorsOff(transform, true);
                JetFlame.SetActive(true);

                takeoffland = true;
            }
            TakeOff();
        }
        else
        {
            Land();
        }
    }

    private void TakeOff()
    {
        takeoffland = false;

        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 7, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);
    }

    private void Land()
    {
        float step = speed * Time.deltaTime;
        var v3 = new Vector3(transformToMove.localPosition.x, 0, transformToMove.localPosition.z);
        transformToMove.localPosition = Vector3.MoveTowards(transformToMove.localPosition, v3, step);

        if(takeoffland)
        {
            TurnAllAnimtorsOff(transform, true);
            JetFlame.SetActive(true);
        }
    }

    private void TurnAllAnimtorsOff(Transform root, bool onOff)
    {
        animators = root.GetComponentsInChildren<Animator>(true);

        foreach (Animator a in animators)
        {
            if (onOff)
            {
                a.enabled = true;
            }
            else
            {
                a.enabled = false;
            }
        }
    }
}


texts:
I'm making a card game with libgdx scene2d and what I'm trying to achieve is auto arrange the cards in a way the all fit the screen. This is what it looks now when the hand is full:

I have done that using a horizontalGroup and puting a -1/3 cardWidth space between the cards. I want the cards to spread evenly when some are removed.
I think I have to change the space between the cards whenever a card is removed or added but I don't know how much.

This is my code:

    CardActor[] cards = new CardActor[14];
    HorizontalGroup hand = new HorizontalGroup();
    int width = Gdx.graphics.getWidth()/10;
    int height = width * 2;
    hand.setBounds(width/2, -height/4, stage.getWidth()-width, height);
    hand.space(width / -3f);
    hand.align(Align.bottom | Align.center);
    for (int i = 0; i < cards.length; i++) {
        cards[i] = new CardActor(new Card(MathUtils.random(3), MathUtils.random(3, 10)));
        hand.addActor(cards[i]);
    }
    stage.addActor(hand);`

And this is the CardActor:

public class CardActor extends ImageButton {

public CardActor(Card card) {
    super(new TextureRegionDrawable(CardTextures
            .getTexture(card.getType(), card.getRank())));

    int width = Gdx.graphics.getWidth()/10;
    int height = width*2;
    getImageCell().prefSize(width, height);
    setBounds(getX(), getY(), getWidth(), getHeight());
    addListener(new ChangeListener() {
        @Override
        public void changed(ChangeEvent event, Actor actor) {
            onSelected();
        }
    });
}


texts: How to get a job as a game programmer/developer in AAA studios?

texts:
I have looked up and down on the internet and haven't really found the solution, or maybe I am just too confused to know the answer.

I love games and wanted to get into making them from a long time. I first started working with Unity and then realized that I could not see how this could help me in getting into AAA studios as all there job requirements had stuff that I didn't learn in the process. Then it felt like making a game engine would help me learn better what those studios want. But then that stuff was too overwhelmingly tough for me to actually get something competitive done. I did learn some things, but it was not a one man job.
I then again decided to go into making games on a pre-existing engine, this time I took up Unreal Engine 4. But this time I have a better idea of what I want to do. I am interested in making game play logic, AI system, and on a side have fair bit of interest in modelling (not texturing) and animation. I may not be good at all this right now, but I have figured out what I have to do exactly, and on the side.
Now again I did end up one some companies job page(Naughty Dog, Santa Monica and Sucker Punch) and I found myself in the sea of confusion and hopelessness, half of the time I couldn't figure out what the requirements.

So my question is, is learning how to get complex AI running in UE4, setting up some nice game play mechanics in UE4, and setting up a nice UI in UE4 and creating some models and animating them in Maya will be enough to get me a job at some of the AAA studios I mentioned?

I know I haven't done all the stuff I mentioned in depth, but I can't proceed without having a proper aim and path, the path can change in between but should lead me somewhere at least.

I will be thankful for any good advice.

Edit. I am not good at art, just in case.


texts:
I move a simple CCSprite around the screen of an iOS device using this code:

[self schedule:@selector(update:) interval:0.0167];

- (void) update:(ccTime) delta {
    CGPoint currPos = self.position;
    currPos.x += xVelocity;
    currPos.y += yVelocity;

    self.position = currPos;
}

This works however the animation is not smooth. How can I improve the smoothness of my animation?

My scene is exceedingly simple (just has one full-screen CCSprite with a background image and a relatively small CCSprite that moves slowly).

I've logged the ccTime delta and it's not consistent (it's almost always greater than my specified interval of 0.0167... sometimes up to a factor of 4x).

I've considered tailoring the motion in the update method to the delta time (larger delta => larger movement etc). However given the simplicity of my scene it's seems there's a better way (and something basic that I'm probably missing).


texts:
I'm making a top-down 2D space ship game in which you rotate and thrust. I'd like to impose a maximum velocity for different engine types, meaning that a certain engine can only get you going up to a certain speed.

But I'd also like the ship to be able to travel faster than that maximum velocity, say if it were sent flying by a collision with a fast-moving asteroid.

I can't naively have the engines only apply impulse if the ship is moving at less than its maximum speed -- otherwise if an asteroid sent you flying to the right, you couldn't deliberately slow down because that would involve applying an impulse to the left.

But I'm not restricted to cardinal directions. If the ship is moving too fast to the right, I don't want it to accelerate to the right, but I would like it to be able to curve upward, which might involve applying some kind of impulse at say a 15 degree angle.

My other thought was to cap the maximum velocity of the ship at the maximum velocity of the engine, but then an asteroid collision could send you flying no faster than you engine's maximum speed, and that's undesirable as well.

How might I go about designing a system that allows one to reach velocities no higher than a set maximum from their own impulse, but still be able to steer their ship at higher velocities and still actually attain those higher velocities from external means?

Edit

Let's say my maximum velocity is 50 m/s. I'm traveling at 50 m/s at a 15 degree angle, which means my x velocity is 48.3 and my y velocity is 12.9. The ship is facing at a 30 degree angle (even though it's traveling along a 15 degree vector).

When I press the thrust button, I want the ship to trend toward that 30 degree angle of travel. Which means that its current angle of travel must be altered in some fashion. Right now I do so by applying impulses. But if I apply an impulse at a 30 degree angle, the ship's velocity will exceed is maximum (a good portion of that impulse is in the same direction as we're already going).

If I don't allow that impulse to be applied, the player can't adjust their course at all while they're moving too fast. And I'm not sure how to determine which components of an impulse would change a ship's velocity's angle without increasing its length.


texts: How to increase the number of available chapters for an HL2: EP2 mod?

texts:
I created a mod for Half-Life 2: Episode 2 that has 39 chapters (or maps, here it is the same). The problem is that the game seems to see only 32: when clicking "new game", and clicking next, I count only 32/39.
Then, I went to the mod/cfg folder, I removed some of the chapter.cfg and whatever the number of the chapter, it is the sum of chapters that can't be above 32.
I tried to search on the Internet, but it seems that the only guy having a "quite" similar issue is here: Fix broken Portal 2 chapter handling in my mod (and he never had an answer).
As he did, I tried to modify the sv_unlockedchapters variable in config_default.cfg by putting it to 99, so every chapter is unlocked.
So here is my question: where is the parameter or the variable that fix the maximum number of maps?
I guess it would be in a .cpp file, and I tried to find it, but I do not have any knowledge in C++ programming, nor on how Valve organize their files.


texts:
I'm familiar with OpenGL 1.x. I typically use SDL with OpenGL 1.4 on Linux, and I've never run into problems, even on my modern system.

I've read on the OpenGL site about deprecation and compatibility contexts, but I'm still unclear as to whether it's safe to continue to use old versions of OpenGL, as opposed to using old features in newer versions.

  When functionality is marked deprecated ... future versions of OpenGL may remove it.

Does deprecation simply imply that those functions can't be used alongside newer features?

More specifically, are there any systems today (other than embedded) where OpenGL 1.x isn't available? The old-skool stuff like, glBegin, glEnd, glDrawPixels, etc.

Note: I'm not a professional games developer, so you'll have to excuse my ignorance. I'm working on a mostly 2D game that I would like to keep multi-platform, supporting at least Linux, Mac, and Windows.


texts: Resultant Vector Algorithm for 2D Collisions

texts:
I am making a Pong based game where a puck hits a paddle and bounces off. Both the puck and the paddles are Circles. I came up with an algorithm to calculate the resultant vector of the puck once it meets a paddle. The game seems to function correctly but I'm not entirely sure my algorithm is correct. Here are my variables for the algorithm:

Given:
velocity = the magnitude of the initial velocity of the puck before the collision
x = the x coordinate of the puck
y = the y coordinate of the puck
moveX = the horizontal speed of the puck
moveY = the vertical speed of the puck

otherX = the x coordinate of the paddle
otherY = the y coordinate of the paddle
piece.horizontalMomentum = the horizontal speed of the paddle before it hits the puck
piece.verticalMomentum = the vertical speed of the paddle before it hits the puck

slope = the direction, in radians, of the puck's velocity
distX = the horizontal distance between the center of the puck and the center of the paddle
distY = the vertical distance between the center of the puck and the center of the paddle

Algorithm solves for:
impactAngle = the angle, in radians, of the angle of impact.
newSpeedX = the speed of the resultant vector in the X direction
newSpeedY = the speed of the resultant vector in the Y direction

Here is the code for my algorithm:

int otherX = piece.x;
int otherY = piece.y;
double velocity = Math.sqrt((moveX * moveX) + (moveY * moveY));

double slope = Math.atan(moveX / moveY);
int distX = x - otherX;
int distY = y - otherY;

double impactAngle = Math.atan(distX / distY);

double newAngle = impactAngle + slope;
int newSpeedX = (int)(velocity * Math.sin(newAngle)) + piece.horizontalMomentum;
int newSpeedY = (int)(velocity * Math.cos(newAngle)) + piece.verticalMomentum;

for those who are not program savvy here is it simplified:

velocity = √(moveX² + moveY²)
slope = arctan(moveX / moveY)
distX = x - otherX
distY = y - otherY

impactAngle = arctan(distX / distY)

newAngle = impactAngle + slope
newSpeedX = velocity * sin(newAngle) + piece.horizontalMomentum
newSpeedY = velocity * cos(newAngle) + piece.verticalMomentum

My Question:
Is this algorithm correct? Is there an easier/simpler way to do what I'm trying to do?


texts: cube collider losing shape upon rotation

texts:
I'm not sure what's going on here. I have a cube which I have turned into a rectangle; it's a child of a plane which is the "ground" so that they share rotation (this is a pinball table).

To create these cubes, I just used the create => 3d shape => cube/plane option. No packages are used.

The issue is when I rotate the rectangle, the collider visibly becomes wrong.

This is before rotation:

This is after rotating on the y axis:

The collider does seem to rotate, but not at the correct amount. Can anyone shed some light as to what's going on here?

Here's the inspector and hierarchy:

I also tried making the plane a cube, it didn't change anything.


texts: Slow down in the same time over different distances

texts:
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.