texts: Configuring Implicit Multi-GPU Rendering Driver Settings Programmatically

texts:
What is available to game developers to take advantage of implicit multi-GPU rendering technologies as of 2016? For this question I will only be asking about Nvidia's SLI and AMD's Crossfire technologies as they apply to rendering in OpenGL and Direct3D, specifically non-ancient versions of these APIs like OpenGL core 3.3+ and Direct3D 10.0+.

What tools do developers have access to, to programmatically detect and alter the state of implicit multi-GPU rendering for their game?

A key component of this question is what is openly available to independent developers, SLI and Crossfire aren't problems to AAA developers who get GameReady drivers tweaked to enhance the performance of their game and have SLI profiles included within the driver. What is available for smaller developers to take advantage of multiple GPUs?

At the very least, is there anything that developers can do to reduce the negative effects that these technologies can cause? Is there a way to avoid a FPS drop or artifacts that come with SLI/Crossfire bugs, can a developer programmatically disable SLI or Crossfire?

With all of this, how is the cross-platform support? Is there a solution for these issues that will work across Windows, Linux, and OSX? Will it work with OpenGL and Direct3D? Can it run out of the box or packaged with your game?


texts:
Every time I make board game, I am faced with a decision. I have classes for the board and/or game logic, and another for the UI. I don't know how I should pass the board data to the UI. I could make a method on the board class that returns an array which represents the "board state", then just iterate over them on the UI. Or I can make a method that gets the value/s of a single coordinate, e.g. a getValue(int row, int col) method. Here are sample codes (in Java):

public class Board{
    private int[][] grid;
    private int rows;
    private int cols;

    // Constructor and other methods here, getRows(), getCols(), etc....

    public int getValue(int row, int col){
        return grid[row][col];
    }
}

public class UI{
    private Board board;
    // Constructor and other methods here

    public void someMethod(){
        for(int i = 0; i < board.getRows(); i++){
            for(int j = 0; j < board.getCols; j++){
                // Do something with board.getValue(i, j);
            }
        }
    }
}

or I can do this:

public class Board{
    private int[][] grid;
    private int rows;
    private int cols;

    // Constructor and other methods here, getRows(), getCols(), etc....

    public int[][] getBoardState(int row, int col){
        int[][] boardcopy = new int[][]

        for(int i = 0; i < board.getRows(); i++){
            for(int j = 0; j < board.getCols; j++){
                boardcopy[i][j] = grid[i][j];
            }
        }

        return boardcopy;
    }
}

What should I use? Or if this is debatable, could you just explain the pros and cons of each?


texts: What's the point of [HiddenInInspector] (as opposite to [NonSerialized])?

texts:
I understand the difference between [HiddenInInspector] and [NonSerialized], what I'm missing is the use case for [HiddenInInspector]: so far every time I've encountered it, it was used by developers who weren't aware of [NonSerialized], that would actually have meant to use that. The result is that they risked to get unexpected values when the variable in question was deserialized.

So, in which case it turns out to be useful to hide something from the inspector but to serialize it? If there is such case, are there any known precautions to take in order to prevent unexpected behaviour?


texts: onCollisionEnter2D not behaving as expected

texts:
I have two game objects. They both have a Rigid Body 2D and a Box Collider 2D components.

One of them also has script component. Below is the full script

using UnityEngine;
using System.Collections;
public class Col : MonoBehaviour
{
void Start ()
{
}
void Update ()
{
}
void onCollisionEnter2D(Collision2D col)
{
Debug.Log("collision detected");
}
}

When I start the project, go to the Scene view and drag one GameObject over another i don't get the Log message i am expecting to see.

What am i doing wrong here? Seems so simple.

Last pic is the size of the box colliders so you can see that they are correct size.

I've seem other very similar question and they are all in regards to unity5.0 (i am using 5.0 as well)


texts:
I've been working on a planet sized and shaped terrain lib for a while (In webgl and Unity) and have a couple of working implementations [Quadtree cubesphere and circular clipmaps].

But both of them suffer from the same problem. In the GPU vertex shader I move the vertices to their correct location on the planet. But 16 bit floats can't handle values that go into the millions. So when you get close to any vertex in the terrain it jiggles from the GPU rounding errors.

With the quadtree solution this is how I put vertices where they belong in the shader:

vec3 newPosition = vec3(normalize(StartPosition.xyz + (WidthDir * position.x + HeightDir * position.y) * Width) * Radius);

In the circular clipmaps I create a point at 0,0,1 and use two quaternions to rotate it to where it belongs (one for where the point is in the clipamp and one for where the clipmap should appear on the planet), then multiply it by the planet radius.

But both implementations require the multiplication of the planet's radius [the clipmap also has one quaternion with precision far higher than a 16 bit float, at ground level it will be a precision of 1/6000000 of PI].

So does anyone know how to handle this problem on the GPU so that at least the points closest to the camera have position values close to zero and no large number multiplication? Or is the only solution to set the positions on the CPU and just do some math work to make sure the vertices on the side of the planet closet to the camera always have values close to zero?


texts:
(Sorry if I misunderstood the context of what I want, I'm currently noob in game development).

I want to retrieve a 3D model from let's say Saints Row 3, and import it to Unreal Engine 4, is it possible ? If not is there a way to create it from scratch ?

What is the right way to achieve what I want ?


texts: How do I convert a .dds texture to .png bitmap in C#?

texts:
This question is from someone who has not written a line of code for games, but several Game Save editors and other game tools.

I'm working on a Save Editor and would like to display icons of some of the game assets in C# WPF .NET 4.0,  or at least convert them to PNG in memory, so I can display them without having to make copies of them. The assets are stored as .dds texture files in BC3_UNorm.

I've trawled Google results that either use SharpDX or XNA, but all the ones I've found either do not work (as the sample code is for an old version of the library), or I just plain don't understand (in the case of XNA).

How can I load a BC3_UNorm Texture file, either in SharpDX, or XNA for conversion? Sample code would be very welcome.

Here's a sample input file.

This is the only code I could get running, but it's missing some of the RGBA channels and the output looks nothing like the original:

public static System.Windows.Media.Imaging.BitmapSource ConvertTK(string filename)
{
    try
    {
        // Create the graphics device
        using (var graphicsDevice = SharpDX.Toolkit.Graphics.GraphicsDevice.New(SharpDX.Toolkit.Graphics.GraphicsAdapter.Default, SharpDX.Direct3D11.DeviceCreationFlags.SingleThreaded))
        {
            // Load the texture
            using (var texture = SharpDX.Toolkit.Graphics.Texture2D.Load(graphicsDevice, filename))
            {
                // Copy the pixel colors into a byte array
                var bytesPerPixel = 3;
                var pixelChannel = texture.GetData<byte>();
                var pixelData = new byte[pixelChannel.Length * bytesPerPixel];

                // Where are the RGBA channels? It only has 1 byte per pixel!
                for (var i = 0; i < pixelChannel.Length; i++)
                {
                    pixelData[i * bytesPerPixel + 0] = pixelChannel[i];
                    pixelData[i * bytesPerPixel + 1] = pixelChannel[i];
                    pixelData[i * bytesPerPixel + 2] = pixelChannel[i];
                }

                // Result Image is garbage, looks nothing like original .DDS BC3_UNorm file.

                // Create a bitmap source
                var stride = texture.Width * bytesPerPixel;
                return BitmapSource.Create(texture.Width, texture.Height, 96, 96, PixelFormats.Rgb24, null, pixelData, stride);
            }
        }
    }
    catch (Exception ex)
    {

    }

    return null;
}


texts: Calling a function from Super is getting an error

texts:
I am following GameDev.tv's unreal C++ course, but I am getting an error that is causing my compiler to fail.  I'm coding a player controller, and I think I followed all the steps right but when I call the GameHasEnded() function from Super in the playercontroller.cpp, It gets an error saying: anything followed by '::' must be followed by a class or namespace.
Here is my .h file which has no known compiler errors.
    #pragma once

#include "CoreMinimal.h"
#include "GameFramework/PlayerController.h"
#include "ShooterPlayerController.generated.h"

/**
 *
 */
UCLASS()
class SIMPLESHOOTER_API AShooterPlayerController : public APlayerController
{
    GENERATED_BODY()
public:
    virtual void GameHasEnded(class AActor *EndGameFocus = nullptr, bool bIsWinner = false) override;
};

Here is my .cpp file with the problem.
// Fill out your copyright notice in the Description page of Project Settings.

#include "ShooterPlayerController.h"

void GameHasEnded(class AActor *EndGameFocus, bool bIsWinner)
{
    //this is the problem super
    Super::GameHasEnded(EndGameFocus, bIsWinner);
}

I have a lot of other scripts, but I don't think they're related to the problem.  I'm using Unreal 4.26, and Visual Studio 2019. I have no idea why this is getting an error, the code is exactly the same as the instructor’s code.


texts: Unity: How to subscribe for events for easy unit testing?

texts:
I've run into the same problem multiple times that is begging for a solution. I try to write a lot of decoupled code to make my MonoBehaviour scripts as reusable as possible. This means that I end up using events sometimes. However, when I try to unit test my code I always run into problems with events.

I usually subscribe and unsubscribe to events in OnEnable and OnDisable (sometimes Awake and OnDestroy). However, when writing my unit tests, then I can't test any behaviour dependent on such events since these Unity event functions don't get called in a unit test.

I've tried making the unity event functions public for testing purposes. But this seems to seriously break encapsulation. I've also made functions like public ListenToEvents() that does all the event subscribing, and gets called from OnEnable() and can then also be called in my unit test.

I've read in many places (and see the reasons why) you should never make something public just for unit testing purposes, but I'm struggling how to get event-related behaviour to be tested.

I know about the Humble Object Pattern, which I think could be a good solution here. However, I really like having a single script I can share with myself or someone else for reuse, and this tends to create additional classes/files.

A common example I'm having trouble testing is something like the following MonoBehaviour code (untested code)

bool ignoreInput = false;

void OnEnable() {
    KeyboardEvents.OnIgnoreAllInput += IgnoreInput;
}

void OnDisable() {
    KeyboardEvents.OnIgnoreAllInput -= IgnoreInput;
}

void IgnoreInput() {
    ignoreInput = true;
}

public void UpdateMovement() {
    if (ignoreInput) return;

    // trying to unit test this
    if (Input.GetKeyDown(Keycode.A) {
        MoveForward();
    }
    else {
        DontMove();
    }
}

the issue with the above code, is that I can unit test MoveForward and DontMove, but I can't unit test whether they are correctly controlled by ignoreInput, since in my unit test there's no way (as written) to get OnEnable and OnDisable to be called. I'm also aware of Unity PlayMode tests, that do call such methods, but these are very clunky and slow to run and as far as I can tell can't be called from an IDE.

Ideally my unit test would be something like this:

ScriptUnderTest testScript = new GameObject().AddComponent<ScriptUnderTest>();
KeyboardEvents.IgnoreAllInput();
testScript.UpdateMovement();
Assert.That( <Some result of DontMove happened> )

This test always fails because OnEnable is not being called, and so invoking the event does nothing to the script.

I'd love know how to better set up the MonoBehaviour to make this test work.

Side Question: Do you subscribe to events in OnEnable? Is there a best practice for where in monobehaviours to do this?


texts: How to start encouraging team collaboration?

texts:
I am working on converting a single player game to multiplayer, but I am concerned that if I simply do a 1-1 conversion, even in modes with "multiple players" there won't be any incentive for team work. And since I have more experience with single player mechanics than multiplayer ones, I could use some advice on this. Here is what I have implemented so far:

points that reward team based achievements higher than single player achievements eg. single kill vs team kill
a "spotting" mechanic which allows players to show their team the enemy's position on the minimap
health & ammo items which can be shared to resupply the team
team based game modes such as capture the flag, TDM etc

My main concern with the above, is that there is a heavy reliance on individual players to want to play in a team based way. If they don't want to, they can still lone wolf it in most cases which can have a negative effect on the rest of the team who is trying to play collaboratively. It only takes one person in a team to spoil the fun!

For example, the COD series has had a number of perks, achievements and streaks designed to encourage team collaboration; but I have rarely seen these used in multiplayer since a lone wolf strategy seems to be more common. Another example, the Battlefield series has had an entire class devoted to supporting team members with health packs, repairs, ammo resupplies etc and in multiplayer it is common to see this being used to fully effect. So why do such features/mechanics work in one game of the same genre but not in another? I assume the type of player is relevant here, but there must be more to it than that.

What are some tried and true ways to encourage team-based play or collaboration? This does not necessarily mean players talking to each other, but rather working together to achieve the same goal or different parts of the same goal.


texts: Best solution for multiplayer realtime Android game

texts:
I plan to make multiplayer realtime game for Android (2-8 players), and I consider, which solution for multiplayer organization is the best:

Make server on PC, and client on mobile, all communition go through server ( ClientA -> PC SERVER -> All Clients )
Use bluetooth, I don't used yet, and I don't know is it hard to make multiplayer on bluetooth
Make server on one of devices, and other devices connect ( through network, but I don't know is it hard to resolve problem with devices over NAT ? )
Other solution ?


texts:
I've created an obstacle prefab. The Prefab has following hierarchy.

The player must die if he collides with Enemy. But It detects collision with parent object. I am also uploading the screen shot of property of enemy(Child Object) and Parent Object.

What should I change to let player collide with Child Object (Enemy).


texts: How to use images as Sprites in Visual Studio 2010 C++?

texts: So i'm trying to create my first videogame, a simple code of "Space Invaders" for a project at school and I'm always getting stuck at images. I'm using C++ to code and I've tried both SFML and Magick++ as libraries but i just can't set them up properly it seems. Can someone help me through setting up either one of them or even another method?


texts: I'm wondering how a diagonal element that moves along a diagonal path that hops at each tick of the computer clock is able to travel a greater distance along the screen than an element moving at each tick along left-right or up-down paths (since it's a square lattice and the diagonal element of a triangle is the same length of the two legs of a 45-45-90 triangle, or just take a square grouping of nine pixels, the diagonal is 3 pixels, and the left-right and up-down direction are 3 pixels also, a violation of the hypotenuse, but you can still measure the diagonal distance of a square pixel with a ruler), so things move faster along the diagonal, and you'd have to also take into account variations of lower angled paths that move at a lower angle diagonal (they still move faster than left-right elements).  I'm wondering if that's a source of jitter in a character object that is composed of a large blob of pixels, has somebody already figured out a ratio in reducing the speed of the diagonal moving pixels while still maintaining the shape of the blob of the character moving.


texts: UDK - problem packaging/publishing the game

texts:
I have set up all the config files to my game classes and am able to launch the game to test everything.

Although when I package the game, it still runs the UT deathmatch game?

What other lines in the config files should be changed to make it default to my game and default map once published/packaged?


texts: How do you upgrade your Unity license from Plus to Pro?

texts:
If I buy a Plus license for Unity for only one month, can I upgrade that license from Plus to Pro in the next month? Or I am in am annual commitment to renew only the Plus license?

If I need to upgrade from Plus license to Pro license a month after publication, what do I do?


texts: Ping Pong bat is not detecting the collision with the wall

texts:
I have been learning Unity for last couple of days. I want to make one simple ping pong game. The idea is simple. The game has a Sphere as a ball, a plane as ground, 2 rectangles as bats and 4 rectangles as walls. Look at the image

It is a 2 players game. One player will use 'W' and 'S' key and another player will use 'Up Arrow' and 'Down Arrow' on the keyboard to move the bat up and down.

But I have a problem here. If a player moves the bat at the limit (up or down), the bat does not detect the collision with the wall. It just goes through the wall. Look at the image.

The bats and the walls have Box Collider, but still the problem persists. So what should I do so that the bat detects the collision with the wall.


texts:
So far I've used the same texture coordinate for both the normal and diffuse textures on a mesh, yet when reading the Assimp documentation (http://assimp.sourceforge.net/lib_html/structai_mesh.html#details) on a Mesh, it implies that there can be more than one texture coordinate sets per mesh.

My question is, in general what scenario would these be present and what is their purpose?


texts: Vertically mirroring the screen in LibGDX

texts:
I'm developing a game in which the screen layout is different for right and lefty players, so i'll put a button in it to mirror the screen vertically.

For displaying textures and fonts, i use a single scene2D stage with actors and labels. The stage's viewport type is FitViewport.

How can i swap between the right and left layouts?
Is there something already done to do it on the viewport-side?

Is it only a matter of switching coordinates from bottom-left to bottom-right?
I can do that on the viewport camera, but what about all the textures? How can i change an actor's coordinate system?

Thank you all


texts: Fast Forward Drawing using ACEdrawingView

texts:
i am using this :
    https://github.com/acerbetti/ACEDrawingView
i want to  implemented one Functionality in which i want Fast drawing by clicking on a Button. i am drawing points on screen. i have got success For drawing small amount of points But when i try to draw with more points & draw them with Zero Delay then my app crashes .How can i draw for more points or say more data .!!

-(void)playVideoForDict1:(NSMutableArray*)playvideo widMul:(float)widMul1 heimul:(float)heiMul1 whichValue:(int)thisValue
{

widMul = widMul1;
heiMul = heiMul1;

[NSObject cancelPreviousPerformRequestsWithTarget:self];

for(int i = 0; i<[playvideo count]; i++)
{

    NSDictionary *dict1 = [[NSDictionary alloc] init];
    dict1  = [playvideo objectAtIndex:i];

for(int i=0; i<[playvideo count]; i++)
{

    self.currentTool = nil;

    NSDictionary *dict1 = [[NSDictionary alloc] init];
    dict1  = [playvideo objectAtIndex:i];

    if ([dict1 count]==4)
    {

        self.drawTool = ACEDrawingToolTypePen;
        self.currentTool = [self toolWithCurrentSettings];
        [self.pathArray addObject:self.currentTool];
        NSDictionary *colorDic = [dict1 objectForKey:@"colore"];
        if ([[dict1 objectForKey:@"lineWidth"] floatValue]==1) {
            self.lineWidth = 5;
        }else if ([[dict1 objectForKey:@"lineWidth"] floatValue]==2) {
            self.lineWidth = 10;
        }else if ([[dict1 objectForKey:@"lineWidth"] floatValue]==3) {
            self.lineWidth = 15;
        }else if ([[dict1 objectForKey:@"lineWidth"] floatValue]==4) {
            self.lineWidth = 30;
        }

        if ([[CCDirector sharedDirector] winSize].width==768)
        {
            self.lineWidth *=2;
        }
        self.currentTool.lineWidth = self.lineWidth;

        self.currentTool.lineColor = [UIColor colorWithRed:[[colorDic objectForKey:@"r"] floatValue] green:[[colorDic objectForKey:@"g"] floatValue] blue:[[colorDic objectForKey:@"b"] floatValue] alpha:1];

        self.currentTool.lineAlpha = 1;

        [self.currentTool setInitialPoint:currentPoint];

        currentPointArray = [dict1 objectForKey:@"points"];

        for (int i = 2; i<[currentPointArray count]; i++)
        {
            currentPoint = CGPointMake([[[currentPointArray objectAtIndex:i] objectForKey:@"x"] floatValue]*widMul, [[[currentPointArray objectAtIndex:i] objectForKey:@"y"] floatValue]*heiMul);

            previousPoint2 = CGPointMake([[[currentPointArray objectAtIndex:i-2] objectForKey:@"x"] floatValue]*widMul, [[[currentPointArray objectAtIndex:i-2] objectForKey:@"y"] floatValue]*heiMul);
            previousPoint1 = CGPointMake([[[currentPointArray objectAtIndex:i-1] objectForKey:@"x"] floatValue]*widMul, [[[currentPointArray objectAtIndex:i-1] objectForKey:@"y"] floatValue]*heiMul);
            if ([self.currentTool isKindOfClass:[ACEDrawingPenTool class]]) {
                CGRect bounds = [(ACEDrawingPenTool*)self.currentTool addPathPreviousPreviousPoint:previousPoint2 withPreviousPoint:previousPoint1 withCurrentPoint:currentPoint];
                CGRect drawBox = bounds;
                drawBox.origin.x -= self.lineWidth * 1.0;
                drawBox.origin.y -= self.lineWidth * 1.0;
                drawBox.size.width += self.lineWidth * 2.0;
                drawBox.size.height += self.lineWidth * 2.0;
                [self setNeedsDisplayInRect:drawBox];
            }
            else
            {
                [self.currentTool moveFromPoint:previousPoint1 toPoint:currentPoint];
                [self setNeedsDisplay];
            }

        }

         [self updateCacheImage:false];
    }

    else
    {
        NSNumber *check = [dict1 objectForKey:@"undo"];
        if ([check intValue]==1)
        {
            [self.pathArray removeLastObject];
        }
        else
        {
            [self.pathArray removeAllObjects];
        }
    }
    [self updateCacheImage:true];

}

}

i am stuck with this . please Help on this .. How can i achieve this .


texts: How to calculate best move in Match-3 game?

texts:
I am having a hard time identifying how to approach this problem.
If you have a match 3 game and the objects can only be swapped horizontally and vertically, and only swapped if it will result in a match of 3 or more jewels, which will be removed, with each removed jewel adding +1 to the score.
How would I find the best possible move? I'm confused at where to start and been searching for a while now and getting nowhere.

Board  6x6 or 8x8
Matches  = 3 or more of same kind
write function to find best swap for maximum score.

Any help would be greatly appreciated !
EDIT: So I could iterate through the entire board with a nested for loop for the rows and columns, but im not sure what approach to take from here.
For example, say I start with top left which is "red" and I want to test if swapping this will result in a match. How would I go about searching and identifying all possibilities that would result in swapping this left equaling a match and score of 5.
**If I am being really unclear I apologies and will remove my question and possible reword.


texts: How do I force Unity to reload editor scripts

texts:
I am working of some editor scripts for Unity but have found that it is difficult to force Unity to reload my editor scripts.

My scripts are modelled on the static constructor approach and perform some manipulation of the Tag Manager.

Currently the static constructor is called when either:

Unity is launched, or
Changes to a script (any of them) are written to disk

While verifying that the tag manipulation performed by the script is correct I am manually setting the tags via the GUI and then triggering script by saving a trivial change to the file.

This is clearly a clumsy workaround, is there a better way to force Unity to reload editor scripts?


texts: Accurate way to calculate swipe direction based on delta vector

texts:
I am trying to calculate the direction of a swipe on a touch device screen. Lets say the screen size is 1024 wide and 768 high. The bottom left x and y coordinate is 0,0 and the top right coordinate is 1024,768.

For any given swipe, I will receive a delta vector which indicates the movement on the x and y axis. For instance, if I start a touch at 100,100 and the end the touch at 500,150 I will receive a delta vector of 400,50 and I know from this that the swipe was to the right (and a tiny bit up).

From any given delta vector, is there a formula I can use to determine which direction the vector most resembles, allowing for diagonal swiping too (i.e. left, right, up, down, up-left, up-right, down-left, down-right). I do have some code which calculates the closest with an allowed margin for error - but it occurred to me there must be a mathematical way to solve this without having to check each direction and the margin.

Hope that makes sense, Thank you.

P.s.  Already tried to post this in the math overflow site, but got shot down as apparently it's not a math problem.  Which actually it is.  Hope this is a better choice!

EDIT:

Bornander: The solution you gave (which is very clever) provides the detection as shown in this image...

Where what I'm realistically after is a slightly turned version like this...


texts: using odd number of sprites in multi-row spriteSheet?

texts:
Using XNA it's pretty easier to loop through a sprite sheet, I tell it how many rows and how many columns it has and I have a method that loops through the whole set.

I usually use this method in my sprite class, but I have a sprite sheet that has a odd number of sprites, and does not use the entire last line.  Any ideas on how to do this?

for example: I have 3 rows of 6 columns, but on the last row I only have 3 sprites.

Thanks!


texts:
I was implementing Game Center into my app and all was going well except for the leaderboard done button not dismissing the leaderboard even with gameCenterControllerDidFinish added in. I call up the leaderboard with the touch of a button in the .m file as so:

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
 UITouch *touch = [touches anyObject];
 CGPoint location = [touch locationInNode:self];
 SKNode *node = [self nodeAtPoint:location];

 if ([node.name isEqualToString:@"rankButton"]) {

    [self runAction:[SKAction playSoundFileNamed:@"fishtran.m4a" waitForCompletion: NO]];
     GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc]
  init];
        if (gameCenterController != nil)
   {

        gameCenterController.viewState = GKGameCenterViewControllerStateAchievements;
        UIViewController *vc = self.view.window.rootViewController;
        [vc presentViewController: gameCenterController animated: YES completion:nil];
    }
} else if ([node.name isEqualToString:@"Leaderboard"]) {
    GKGameCenterViewController *gameCenterController = [[GKGameCenterViewController alloc]
  init];
    if (gameCenterController != nil)
    {

        gameCenterController.viewState = GKGameCenterViewControllerStateLeaderboards;
        UIViewController *vc = self.view.window.rootViewController;
        [vc presentViewController: gameCenterController animated: YES completion:nil];
    }
}

...
and then I added thegameCenterControllerDidFinish immediately after as so:

- (void)gameCenterControllerDidFinish:(GKGameCenterViewController*)gameCenterController {

    UIViewController *vc = self.view.window.rootViewController;
    [vc dismissViewControllerAnimated:YES completion:nil];
}

and the done button still doesn't work and i haven't been able to find any solutions. And yes, I do have GKGameCenterControllerDelegate in my .h file. Any help would be greatly appreciated, Thanks!


texts: Handling cameras in a large scale game engine

texts:
What is the correct, or most elegant, way to manage cameras in large game engines? Or should I ask, how does everybody else do it?

The methods I can think of are:

Binding cameras straight to the engine; if someone needs to render something, they bind their own camera to the graphics engine which is in use until another camera is bound.

A camera stack; a small task can push its own camera onto the stack, and pop it off at the end to return to the "main" camera.

Attaching a camera to a shader; Every shader has exactly one camera bound to it, and when the shader is used, that camera is set by the engine when the shader is in use. This allows me to implement a bunch of optimizations on the engine side.

Are there other ways to do it?


texts: Which is the fastest: shaders vs animations / animated images / pixel manipulation?

texts:
I'm quite newbie to shader programming.

I use Godot engine and after I see what can be done with shaders (eg. http://glslsandbox.com/e#53172.0) I realized that I MUST learn it no matter how hard it can be to understand the harder parts of it.

Till now I've used animated sprites or just make an animation in the animation editor.

I want to know if I gain perfomance by using shaders for example when I want to make a flag dragged by wind or I want to make something like in the example I linked.

I would think shaders are the fastest...but isn't it faster when there is a finished animation and you just have to make the game engine to use it?


texts: Photon Transforms syncing other transforms

texts:
I have a problem wherein this happens:
It's problematic because I'm unfamiliar how to set the same player value in the same transform over the network. Is there a way where if I get the list of transforms, it's in the same order in other clients?
My current setup is that each client creates his own My Player Prefab with a Player Info script that stores in the Photon's Player. Spawn Manager will be listening until both player prefabs have been created. From there, they'll do this code:
public void PlayerObjectReady(){
    playerObjectReady++;

    int totalPlayerCount = PhotonNetwork.PlayerList.Length;

    // check if we've readied all player objects in all clients
    if(playerObjectReady == totalPlayerCount){
        photonView.RPC("SpawnPlayer",RpcTarget.AllBufferedViaServer);
    }
}

[PunRPC]
void SpawnPlayer(){
    // update local list for all clients
    infos = FindObjectsOfType<PlayerInfo>(); // this line causes problems

    // update player references so that each character is owned by their player
    for (int i = 0; i < infos.Length; i++){
        infos[i].Player = PhotonNetwork.PlayerList[i];
        if(PhotonNetwork.IsMasterClient)
            infos[i].transform.position = spawnPoints[i].position;
    }
    TurnManager.Instance.AddPlayers(infos);

    // tell everyone i'm ready
    photonView.RPC("ImReady",RpcTarget.AllBufferedViaServer,PhotonNetwork.NickName);
}

The main problem here is that the player prefabs are not always in the correct order that I wanted them to be. Plus, their positions often clash together whenever Photon Transform view is enabled. And yes, the players here are right beside each other when they're actually spread across a small map.

Let me know a possible solution because I intend to use Photon Transform view. For now, disabling Photon Transform view is my current band-aid solution which only works when spawning and not moving the players.


texts:
I'd like to know how others have handled the issue of storing the entity's position. (Or maybe it's not an issue and I just make it too complicated.)

I'm undecided on whether to store the position of each entity in the world map file or in the entity's script file. From what I figured, both approaches have their own good and bad points:

If you store the entity's position in the map:

Good: Easier to edit the map; you can see where the entity will be. Maybe this isn't a problem for integrated map editors, but I'm using an external, general-purpose map editor (GLEED2D).
Bad: Inside the game it's easier to handle data if the position is inside the entity object, not the map object. So when you load the game, you have to gather data from a lot of places to build your entity object.

On the other hand, if you store the position inside the entity script, the advantages and disadvantages are exactly the opposite of the above.


texts: Game Maker - Create Instance When Health Is 0

texts:
I have five objects: obj_Boss, obj_bossHealth, obj_GameOver, obj_BtnOK, and obj_rec2.
This is what I want. When obj_Boss has no more health, obj_GameOver and obj_BtnOK will appear.
This is my first method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)
No More Health: create instance of obj_GameOver; create instance of obj_BtnOK

This is my second method:
In obj_bossHealth, I have these events:

Create Event: set var global.bossHealth to 100
Draw Event: draw_healthbar
Step Event: if global.bossHealth is equal to 0 then create instance of obj_GameOver and create instance of obj_BtnOK

In obj_Boss, I have these events:

Collision with obj_rec2: set var global.bossHealth relative to -1.5; destroy the instance (other)

The result of both methods:
obj_GameOver and obj_BtnOK won't appear. How can I fix this? Please explain your answer. Thanks.
I add some images: method1 method2


texts:
I'm working on a side scrolling game that has a number of timed puzzle elements. As a simple example: I have a number of moving platforms that have been setup to transition in a pattern. Ideally I'd like to ensure that as the player first approaches them, they are in an ideal state -- whereby the player can witness the full transition and more experienced players (i.e: speedrunners) can complete the puzzle immediately without having to wait for the current transition to complete.

The issue here, in a nutshell, is that because these platforms begin transitioning at the start of the level, it's impossible to correctly calculate when the player is likely to stumble upon them.

I've done a fair bit of Googling but haven't managed to turn up any decent resources with regards to solving a problem like this. The obvious solution is to only begin updating the objects when the player (or more likely: the camera) first encounters them. But this becomes difficult when you consider more complicated situations.

It seems like potentially the easiest way of handling this is to have an invisible trigger volume that will tell any puzzle elements located inside of it that the player has 'arrived' upon first colliding with the player. But this would mean I'd have to logically group puzzle elements, which could become fairly messy in a hurry. Take, for instance, a puzzle that appears to the right of the screen. It may take the player a number of seconds to reach it. It would look strange if the elements involved were to remain stationary. But by the time the player arrives, it's likely things will be 'out of sync'.

I wanted to post here in the hopes that others know of, or have implemented, a decent solution to this problem?


texts: Is my technique for client-side character movement in an MMORPG reasonable?

texts:
I started an MMORPG game, and I can already make a character move around the map and see other characters. But I have doubts about my architecture.

I have a loop which, every x milliseconds, request from the database the actual position of all characters around the main character. After that, I remove all the objects from the screen and redraw them based on the data retrived from database. Is this reasonable, or is there a better solution?


texts: Getting the polygon footprint from a map

texts:
I'm trying to implement the Explicit Corridors method to generate a navmesh for a large city. The algorithm takes a list of convex polygons representing the obstacles as input.

The paper only briefly describes the process of obtaining this "footprint". It looks like all the obstacles are rendered in a texture with an orthographic projection, and then each obstacle is decomposed in convex polygons. They use the CGAL library to do this, but I want do it on my own.

Here's an example of the footprint. Ignore the lines between buildings, but notice how each building (in red) is segmented in convex polygons.

So what I'm looking for is an algorithm that takes an image as input, and gives me a list of segments representing the contour of each shape.

I checked stuff like Harris corner detection, but I'm not sure if this is the best way to do it. I also looked at Delaunay triangulation, but this will create a lot of unused segments (the ones you see inside the buildings in the picture above).


texts: How to detect collision in Unity3D without rigid bodies?

texts:
The target platform of my game is mobile devices therefore I try to develop it performance oriented. It will be a strategy game so I don't really need physics in it, consequently I did not add RigidBody to my object to avoid unnecessary computations.
However according to the Box Collider reference page, the collison event cannot be triggered, unless one of the objects is a RigidBody. Is there a simple way to check collision between objects other than using RigidBodies?
Or can it be that I'm overreacting this performance thing and the physics engine won't slow my game down?


texts: How to find the closest point on a plane

texts:
So I have this terrain with a perpendicular plane setup, now I want to move the vertices of the plane to their closest resp. vertices on the terrain.
I made a drawing to illustrate my thoughts.
Final result being the terrain will look like it has some thickness.

i also need the projection of the point on the terrain

I found this code on a previous thread :

    float distance = PointToPlaneDistance(smallObj.transform.position, wall.transform.position, wallNormal);

    private float PointToPlaneDistance(Vector3 pointPosition, Vector3 planePosition, Vector3 planeNormal)
    {
        float sb, sn, sd;

        sn = -Vector3.Dot(planeNormal, (pointPosition - planePosition));
        sd = Vector3.Dot(planeNormal, planeNormal);
        sb = sn / sd;

        Vector3 result = pointPosition + sb * planeNormal;
        return Vector3.Distance(pointPosition, result);
    }

The result vector here is the closest point

But what is the plane normal?
Unity has a built in mesh.normals which gives all the surface normals for the terrain. Which one should I use here?


texts: Collision detection for multiplayer game with MatterJS

texts:
We are developing JavaScript multiplayer top down game where characters can move freely and collide with each other. We are rather weak at mathematics and physics, luckily we don't need much, just some basic movement & collision mechanics.

After a lot of struggle and failures with custom collision mechanics we decided to use MatterJS library. That works like a charm when character collides with static object (like a wall). However when two characters meet, they basically bounce off each other.

We use simple circle based body with frictionAir and inverseInertia set to 0. There is a lot of other properties, but we are rather clueless how the bounce off actually happens. Anybody can point us in the right direction please?


texts: How to make Unity3D Camera focusing on one area?

texts:
In my Unity3D project, I have a board created dynamically (using c#) and located on the screen as follow:

0 < x < 12
0 < z < 12
y = -1

How can I make the camera focusing on the board and make it centered for different screen resolutions and for different platforms?

EDIT:

What I have tried so far

public class PositionCamera : MonoBehaviour {

    public float fWidth = 9.0f;  // Desired width

    void Start () {

        float fT = fWidth / Screen.width * Screen.height;
        fT = fT / (2.0f * Mathf.Tan (0.5f * Camera.main.fieldOfView * Mathf.Deg2Rad));
        Vector3 v3T = Camera.main.transform.position;
        v3T.z = -fT;
        v3T.y = 3f;
        transform.position = v3T;
    }
}

I have attached this script to my camera. Actually, it makes the board look much better but not centered on the screen.


texts: Algorithm for continuously generating a tile map for a topdown 2D game?

texts:
In essence, what I'm looking for is a procedural 2D tilemap continuously generated in a fashion like Minecraft - which is to say generated as the player approaches the edges of the already explored parts of the map. Map is going to be for a topdown 2D-shooter and the purpose of the map is mostly just for background and determining types of enemies and loot to spawn, so it really doesn't need to be very complex.

I've already researched some into the topic, but most of the answers have honestly been a bit too complicated or seemingly made for pregenerated maps.  Voronoi Diagrams and Simplex Noise, while impressive, I don't really understand how to implement in a continuous fashion in realtime. Or at all, really.

What I'm imagining with the generator would be to create simple biomes, composed of two values determining its 'artificiality' (i.e. how man-made the biome is) and 'life' (which is how populated it is). An example would be a city, with high values of life and artificiality both. The values for each would be skewed towards that of its neighbour to ensure that you don't have completely random values. It'd probably be a good idea to ensure that a 'biome' doesn't get too large too, by limiting the amount of tiles?

My question is, are there any better or simpler algorithms to use for something like this beyond Voronoi and Simplex? The game is programmed in C#, I feel I should mention.


texts: Software polygon rasterization with transparency using raw image data

texts:
I have an image with shapes in it (squares and triangles with different colors scattered in the image) and I have an algorithm that matches the image and extracts the geometry vertices from image raw data (unsigned char*) and the extracted vertices are correct and I have checked theme there is no doubt about theme.

Now that I have got the vertices of the squares and triangles from the raw image data. How can I fill the pixels that lies inside the vertices with transparency so they become deleted shapes?

PS: the vertices that i have got are just an array of points and each point has x and y property in it and the raw image data is rgba8888 (32 bit).


texts: Whats the difference between a coroutine and a thread? Are there any advantages of using one over the other?


texts: Synchronizing actions with animations across network

texts:
I'm working on a project which allows players to take actions in time-limited turns. All players are connected to a central server, which is authoritative. That means the server sends info that a turn for given player has started and the time remaining to take an action. This leads to problems when client-side animations are involved. Each action has an associated animation, which takes some time to complete. The player should be able to initiate the action within given time, and the next player show start his turn when any animations complete. Obviously, the server has no notion of animations, but still needs to take them into account and start the next turn at proper time point. I'm not sure how to solve this problem. Possible solutions I came up with:

Constant animation time and built-in delay

The server will have a built-in delay after an action has been taken, before starting the next turn. Problems:

seems an artificial construct
animation times need to be exact

Not waiting for animations

The server can simply broadcast action effects without any delay, and go to the next turn. Problems:

will look very strange for the players since the effects will become visible before the animation completes
possible overlapping animations across turns

Sending actions along with animation times

The client can send the animation time for given action, which the server will use as a delay for the next turn. Problems:

obvious cheating possibility (players can use the delay for "extra time")

So, given above, all my ideas are simply bad. Therefore the question remains: is there an existing solution for such class of problems?


texts: Can animation parameters only be changed in scripts?

texts:
I have a very simple animation parameter in the Animator, a boolean that is "true" when a shooting animation is playing (to stop the game logic from allowing more shooting during a gun recoil animation). I assumed I'd be able to access this in animations, i.e. setting it to true when a shooting animation started, and false when it ended. But I just can't see how to access it in my animations. It's not available under "Add Curve". Am I missing something?

I can do this in other ways, but this just seemed like the cleanest.


texts: How to justify text that appears character-by-character

texts:
I'm currently using the latest version of phaser framework and I have a problem to which I haven't been able to figure out how to approach.
I need to have a block of text appear letter by letter and also be justified as a block.
(I'm working on a text-based game project).
Text typed letter by letter is functional, but my issue is with justification: it has issues like some words first appearing on a line and then being removed and placed in the next line.
This is my code so far:
    addTextParagraph(text) {
    //  We check the current GAME STATE.
    //  During exploration (SCOUTING_STATE), text is in typewriter mode.
    if (gameState === SCOUTING_STATE) {
      this.typewriteText(text);
    }
  }

  typewriteText(text) {
    let delayedCallback;
    let length = text.length;
    let i = 0;

    this.time.addEvent({
      callback: () => {
        this.textParagraph.text += text[i]
          ++i
        // Callback after typewriter text is complete.
        // Delay before the choices appear in the screen (in ms)
        if (i >= length) {
          i = 0;
          delayedCallback = this.time.delayedCall(200, this.addChoiceArray, [], this);
        }
      },
      repeat: length - 1,
      delay: 40,
    })
  }

Thanks.


texts: How to implement color changing fragment shader?

texts:
I have a background of a given size and filled with a given color. I want to change it with an animation effect, starting from the center and spread out until it extends the whole background. The new color should fade / blend smooth into the existing color from the background. Some kind of radial gradient that changes the color and then spreads out over the whole background.

I am working with SpriteKit on iOS and I am really sure that the best way to implement this is to do this with fragment shaders which are new to iOS 8 SpriteKit SDK. I have done some work with shaders and understand how they work but I am asking for help more on the mathematics behind this.


texts: Pathfinding with multiple actors moving in sync

texts:
I am trying to implement a path-finding routine involving the following:

Multiple agents
Multiple Goals
Obstacles
Both agents move in sync, i.e. they both move in the same direction unless one is stopped by an Obstacle. See explanation below in the edit section.

See the following image for illustration:

A1 and A2 represent the starting position of two agents. The dark squares marked with "X" represent obstacles. "G1" and "G2" represent the final goal.

I played around with A* path finding algorithm, and it works great with 1 actor with one goal. However, I couldn't get it to work with more than one actor and goal.

Any suggestions and pointers about how to go about it would be very helpful.

Edit: Synchronized movement explained

If for instance, A1 is stopped by the obstacle but A2 can move, it is a valid option. A1 would stay in place but A2 will move.

Example:

Move Right: A1 moves to (2,1) and A2 moves to (2,7)
Move Right: A1 stays in place but A2 moves to (3,7)
Move Up: A1 moves to (2,0) and A2 moves to (3,6)
Move Up: A1 stays at (2,0) and A2 moves to (3,5)


texts: In OpenGL, what is "zero state" rendering?

texts:
Recently at a job interview, I mentioned that I taught myself modern OpenGL and rendering with vertex buffer objects because my university only taught the fixed function pipeline with immediate mode rendering at the time. The interviewer briefly interrupted me to say that VBOs have effectively been replaced by something called "zero state rendering" and then let me continue.

I forgot to ask later on about what that meant, because we quickly moved onto different subjects and the interviewer had run out of time at the end due to a busy schedule.

Later, I searched online for "OpenGL zero state" and "zero state rendering" with no results that seemed relevant, mostly just things about the OpenGL state.

The organization in question is very heavily research based, so is there a chance that it is an extension with currently little support, or that the terminology used varies due to it's cutting edge nature?


texts: most effective storage of logged information

texts:
I am currently implementing basic logging of information on my multiplayer game and I want to have the most effective method.

To log when a player connects and disconnects to a the server it currently saves the info in one of two global txt files, one for the entire servers connections one for disconnections (a new pair for each day).

Taking into consideration the file sizes, that they are to be written to and not read from, organisation and problems with a large amount of players, would it be more effective to store the data:

A. In daily files

B. In monthly files

C. In yearly files

And should the files be:

1.combined in a single txt file

2.seperate in two txt files

3.combined individually for each player

4.seperate but for each player

Or 5.Another alternative I haven't thought of.

Which way should I use and why?

(also I know the difference between one or another could be dependent on the exact use so the best overall performance/organisation)

P.s if you don't understand the way I've said or worded something ask and I'll try to explain it better.


texts: Tile walking algorithm for already known set of walkable tile?

texts: Suppose I already have a list of tile that specify which tile the character can move to, and these tiles are clustered around the character. If I want to produce a path (maybe not shortest, but just a short path) to the desired tile, how would I construct it with the given list of tiles? I was going to do an A* algorithm, however, thinking again, it will complicate my coding process. Therefore, is there a better way to find short path for known list of movable tile?


texts:
I have been trying to get myself refreshed on OpenGL ES. Whilst doing so, I had the following question in mind:

Does OpenGL have any "caching" mechanism?

For example:

Let's say we draw a stationary triangle with only 3 vertices on the screen; if there will be no transformation applied to the primitive, will OpenGL ES still go through the vertex and fragment shader, drawing the primitive anew every single frame?

Or, does it have any "caching" mechanism, which is smart enough to know that since there is no transformation, a "caching" buffer will display the primitive on the screen bypassing calculations within vertex and fragment shaders so that unnecessary calculations could be reduced/avoided in hopes to enhance frame rate and performance?

Thank you.


texts: Difference between putting shaders in "Always Included Shaders" vs "Preloaded Assets"

texts:
I am developing an mobile AR application with Unity AR Foundation. After a successful android build, I was told one of the shaders was not found.

ShaderNotFoundException: GLTF/PbrMetallicRoughness not found. Did you forget to add it to the build?

I realized I forgot to include one of the shaders that is only loaded at runtime.
I searched the internet and was taught to include the shader under Project Settings -> Graphics -> Always Included Shaders. That totally made sense but I was faced with the same problem everybody faced, the building takes ages as it compiles all my shader variants.
I stopped the build and opted for a method that was not mentioned by the internet, I went to Project Settings -> Player -> Optimization and included the shader under Preloaded Assets. The build was much faster and the shader was loaded correctly in my application.
At this point, my build error is solved but I can't help wondering if it is correct to do so. I am not seeing anyone mentioning about this method and there is not official documentation recommending including shaders under Preloaded Assets.
Could anybody help me out by explaining (hopefully) what these 2 methods actually do to my build, and what is considered the best practice to include the shaders?
I am using Unity 2020.3


texts: How to export deform modifier animation into a game engine?

texts:
Hi we animated a simple plane with deform modifier to give a folding cloth like effect. How do we export it from maya so that we are able to import into our game engine.

Can we export them as a single animated file with vertex info different for each frame ?


texts: Blender: How to "meshify" an object I made from Bezier curves

texts:
I made a star shape using Bezier curves, and extruded it (see pic below):

What I want to do is give it a rounder look - not just around the edges by using beveling. I want it to kind of look like this (well, that shape anyway):

How would I go about doing this? Please keep in mind that I am extremely new to Blender.

I thought that I could somehow turn this star into those default shapes that have tonnes of squares which I could pull out, and apply a mirror to it so that the same thing happens on both sides. I really don't know how to do it, and would appreciate your help.


texts: Physics Loop in a NodeJS/Socket.IO Environment

texts:
I'm developing a 2D HTML5 Canvas Game, and I am trying to think of the most efficient way to implement a Physics Loop on the server-end of things, running NodeJS and Socket.IO.

The only method I've thought of is using setTimeout/Interval, is there any better way? Any examples would be appreciated.

EDIT: The Game is a top-down Game, like Zelda and older Pokemon Games. Most of the physics done in the loop will be simple intersects.


texts:
If i select a group of units and send them somewhere i form them like the following;

If i select them and order an attack, i want three things to happen:

High range units should keep the distance while attacking.
Each unit should attack if possible.
Attack formation should not look too unnatural.

Now i can handle the first two by forming the units as a circle by considering the range and unit count etc. But it looks very unnatural.

It's acceptable if some of the units are being idle for some reason, but i want most of the units join attack and they don't look so artificial.

Any ideas on that? Thanks.


texts:
Consider the following demo:

http://www.ashereinhorn.com/post/11140243390/short-capture-from-the-last-xna-version-direct3d

(It has now almost been converted to C++ and DirecX10, and so the code is not important here, it's the substance I'm interested in)

Basically the little agents move around killing each other, their states are displayed in a corner and you can select one so as to see the items it can see, it's field of view and the things it is holding in memory.

I showed it to someone that works in the industry and they said I should focus on tracking a single agent and make what's going on more clear - so maybe animate each state with simple animations or model swapping to make it more obvious when they are searching / in combat / running away. The other thing they said I should change was the fact that the agents simply disappear when killed, and reappear when spawned because again, it's not clear what's happeneing. As a result I'm going to implement a simple particle system so that agents 'shatter' when killed and possibly reassemble when spawned.

My question is, are there any really obvious changes that I should make to this demo with a view to getting my first game programming job? If you work or know about the industry, is there anything that jumps out at you that should be included? Or is bad? or good for that matter?

Are there any things that would particularly impress or grab your attention in a game demo?

Thank you very much for any help you can give!

EDIT - The walls are actually solid in the C++ version


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

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

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

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


texts:
I don't really know how to search for what I'm looking for which is why I think it'll be easier to ask on here.

I'm creating a webpage and I had the idea of having random glowing particles floating around in the background. I've created something extremely basic where they spawn and then respawn when they go off the edge, however it doesn't really look very realistic and I wanted to have a similar effect to the intro screen in FF14:A Realm Reborn where the particles seamlessly float along in complete randomness but they do it in a way that looks so natural as if they're being brushed around by wind.

I don't really know where to begin on reading about this. I'm not really looking for a code solution, I want to create my own, instead what I'd prefer are explanations or links to guides that can get me started. Most of the particle systems I look up are just particle systems and they don't have this added gravity feel and I'm not really sure where to quickly learn about this specifically.


texts:
I have a ball, which should bounce when it collides with a surface. I know the formula for reflections;
$$ v_1 - 2n(v_1 \cdot n) $$

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

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

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


texts: How to make character respawn the position needed in Andengine?

texts:
I want to make my character respawn in the last Checkpoint he has reached. I've already stored the position of the checkpoint but I'm not very sure of how to set that position to the Sprite/Body of the character to make it appear in the position I want to. Do I have to use the Sprite or the Body? Here's how I initialize my character:

    mPlayerSprite = new AnimatedSprite(mapOffset, 0, playerTexture);

    final FixtureDef mPlayerFixtureDef = PhysicsFactory.createFixtureDef(0, 0f, 0f, false, CATEGORYBIT_PLAYER, MASKBITS_PLAYER, (short) 0);
    mPlayerBody = PhysicsFactory.createBoxBody(this.mPhysicsWorld, mPlayerSprite, BodyType.DynamicBody, mPlayerFixtureDef);

    mPlayerSprite.setUserData(playerName);
    mPlayerBody.setUserData(playerName);
    this.mPhysicsWorld.registerPhysicsConnector(new PhysicsConnector(mPlayerSprite, mPlayerBody, true, false));

    mScene.attachChild(mPlayerSprite);
    mEntityList.add(mPlayerSprite);

Thanks in advance!


texts: why are my client and server physics not syncing up? node.js and html5

texts:
My server looks like this -

    var timestep = 1000/30;
    var delta = 0;
    var lastFrameTimeMs = 0;

    function panic() {
        delta = 0;
    }

    var update = function(){
        currentTime = Date.now()

        if (currentTime < lastFrameTimeMs + (timestep)) {
            setTimeout(update);
            return;
        }

        delta += currentTime - lastFrameTimeMs;
        lastFrameTimeMs = currentTime;

        let numUpdateSteps = 0;

        previousTime = currentTime;

        while (delta >= timestep) {
            player.update(timestep/1000)

        }
        delta -= timestep;

        if (++numUpdateSteps >= 240) {

            panic(); // fix things
            break; // bail out
        }
        setTimeout(update, 60)
    }
    setTimeout(update, 60)

and then my client looks like -

var timestep = 1000/30;
var delta = 0;
var lastFrameTimeMs = 0;

function panic() {
    delta = 0; // discard the unsimulated time
    // ... snap the player to the authoritative state
}

function mainLoop(timestamp) {
    // Throttle the frame rate.
    if (timestamp < lastFrameTimeMs + (timestep)) {
        requestAnimationFrame(mainLoop);
        return;
    }
    delta += timestamp - lastFrameTimeMs;
    lastFrameTimeMs = timestamp;

    let numUpdateSteps = 0;

    while (delta >= timestep) {
        if(player != undefined) {
            player.update(timestep/1000);
        }
        delta -= timestep;

        if (++numUpdateSteps >= 240) {
            panic(); // fix things
            break; // bail out
        }
    }

    requestAnimationFrame(mainLoop);
}
requestAnimationFrame(mainLoop);

I've been trying to get this work for days. I'm trying to have a fixed time step on both the client and server so they both simulate physics exactly the same down to the decimal point. But for some reason my client is moving much faster than my server. I used this article as a reference.

https://www.isaacsukin.com/news/2015/01/detailed-explanation-javascript-game-loops-and-timing

Where am I doing something wrong in one of my loops? They both use a .033333333333 timestep like I want them to, but they move at different speeds. What am I doing wrong?


texts:
I'm thinking of incorporating a versus/competitive system into my webgame ( ninjawars.net ), based off of the old "mastermind" game.

Let's call choosing the color dots in mastermind the "defensive" role, and determining what color dots were placed the "offense" role.

Mastermind is already competitive, but when creating the "color dots" there's a limited amount of added difficulty that you can create (e.g. all random color nodes using a random number generator is probably the most difficult you could get [I think that's true, random is the hardest case to crack, all one color is obviously the easiest]) but what I would like to do is be able to allow players to increase the difficulty from their defensive role by adding to the number of color dots that the defender can use.
For example, instead of 4 dots, the defender could have, I don't know, 20 dots, much harder.  Or only get to place 1 dot, so they have a much simpler defense.

So the question is, how do I determine good amounts of more dots to allow the defender?  Some measure of the simplicity of determining 1 dot, all the way up to the difficulty of X (quite a few) of dots?  I'd really like to be able to mathematically determine number of possible combinations, but I... ...guess I was asleep during that part of school...


texts: walking up/down slowed by z coordinate layering

texts:
I am making a 2D topdown sprite game. I got myself a controller script that handles input and makes the character move/attack etc. I eventually added objects you could walk in front of or behind, like trees, houses, and flowers, so naturally I needed a script to handle that. This answer gave me two solutions one using sprite renderer sorting layers and the other by altering the z-coordinate of objects. The former solution worked but was finicky, and the last one worked just fine.
However, now I am noticing a bug. I have two scenes and if you die, you respawn to the first scene. The bug only occurs if I die and respawn or if I go all the way back to scene 1 e.g. scene 1 > scene 2 > scene 1 (I have pathways that lead between scenes with triggers). The bug is that walking up or down is significantly slower than walking right or left and if I uncheck my Z-Layer script on the player, the speed goes back to match the left/right movement.
This bug doesn't happen in any other scenario, if I start the game in either scene it is fine, but whenever I respawn or go all the way back to scene 1, the up/down movement is slowed. It seems to me the extra work of changing the Z-Coordinate is causing the slowness but it is odd that it only occurs on looping back to scene 1, or respawning (which puts you back to scene 1, as well). I am not creating additional players each time he dies, or saving any data between loads yet.
Is there any idea on what could fix this or what is causing this without having to go deep into all my scripts?
EDIT
Here is my Z-Layer script. It is attached to my Player.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class ZLayer : MonoBehaviour {

//sets the Z coordinate of a sprite to its Y. if the camera settings are reversed, youll need to multiply by -1,
    float initial;
    Vector3 temp;

    void Awake () {

        SetPosition();
    }
    //note since Update is called every frame, you must disable the scripts that on static objects
    //e.g. trees, walls etc, (disabled scripts dont get their updates called
    //for moving objects keep it ticked. (note this is why we used start and not awake too.
    void Update()
    {
        SetPosition ();
    }

    void SetPosition () {
        temp = transform.position;
        temp.z = transform.position.y;
        transform.position = temp;

    }
}

For reference, here is the code that moves my player
void Move(float h, float v)
{
    movement.Set (h, v);
    //normalize movement vector and make it proportional to speed per second

    movement = movement.normalized *speed*Time.deltaTime;

    //move the player to the current position

    temp = new Vector2 (transform.position.x, transform.position.y);
    temp2 = temp + movement;
    playerRigid.MovePosition (temp2);

}

Move(h,v) is called in Update() if a boolean walking is true, and h and v are the horizontal and vertical inputs obtained from Input.GetAxisRaw.
A key part I want to reiterate is that it works fine on start, it only slows up/down movement when I respawn or get back to scene 1 from scene 2. Doing one scene transition seems to work fine, but 2>1>2 or 1>2>1 bugs out.


texts: Unity Surface Shader Using "worldNormal" While modifying Normals Turns Shader Black

texts:
So I was writing a simple triplanar mapping shader and while doing so encountered a bug where when using IN.worldNormal in code while writing to o.Normal would result in the albedo turning black as can be seen below:
https://ibb.co/n1DHC8
Here is the complete shader code (bug tested on webGl as well as Windows DX11):

Shader "Custom/NormalMappedTest" {
Properties {
    _Color ("Color", Color) = (1,1,1,1)
    _MainTex ("Albedo (RGB)", 2D) = "white" {}
    _NormalMap("Normal Map", 2D) = "bump" {}
    _Glossiness ("Smoothness", Range(0,1)) = 0.5
    _Metallic ("Metallic", Range(0,1)) = 0.0
}
SubShader {
    Tags { "RenderType"="Opaque" }
    LOD 200

    CGPROGRAM
    // Physically based Standard lighting model, and enable shadows on all light types
    #pragma surface surf Standard fullforwardshadows

    // Use shader model 3.0 target, to get nicer looking lighting
    #pragma target 3.0

    sampler2D _MainTex;
    sampler2D _NormalMap;

    struct Input {
        float2 uv_MainTex;
        float2 uv_NormalMap;
        float3 worldPos;
        float3 worldNormal; INTERNAL_DATA
    };

    half _Glossiness;
    half _Metallic;
    fixed4 _Color;

    // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
    // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
    // #pragma instancing_options assumeuniformscaling
    UNITY_INSTANCING_BUFFER_START(Props)
        // put more per-instance properties here
    UNITY_INSTANCING_BUFFER_END(Props)

    void surf (Input IN, inout SurfaceOutputStandard o) {
        // Albedo comes from a texture tinted by color
        fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;

        //Even just having this here causes the bug
        float3 wnrm = abs(normalize(IN.worldNormal));

        float3 nrm = UnpackNormal(tex2D(_NormalMap, IN.worldPos.xz));

        o.Albedo = IN.worldNormal;// c.rgb;
        o.Normal = nrm;
        // Metallic and smoothness come from slider variables
        o.Metallic = _Metallic;
        o.Smoothness = _Glossiness;
        o.Alpha = c.a;
    }
    ENDCG
}
FallBack "Diffuse"
}

Any help would be appreciated, thanks in advance,
 - Thomas


texts: Techniques for cursor snap-to-vertex in WebGL or OpenGL?

texts:
What's a technique for snapping the mouse pointer to vertices in WebGL or OpenGL? All I need is the vertex position, no other info.

Ideally, I'd like to do this without needing to keep positions and indices arrays in memory outside of the GPU. BTW, I have already a surface picking technique that uses GPU-resident geometry, which works by sampling the depth buffer at the mouse coordinates and combining that with the unprojected mouse coordinates.

One vague idea: use a vertex colors buffer, that fills triangles with fragments that somehow each encode the position of their nearest vertex position. The fragments could have the absolute position of their nearest vertex, or a vector with length, pointing towards their vertex position. Picking a color on the triangles would provide the nearast vertex position. Though I can't imagine a way to set up that interpolation on WebGL or OpenGL ES.

Any tips appreciated!


texts: what is the absolute simplest way to add physics to a simple 3D game

texts:
This physics does not have to be very complex at all.

There are a number of rectangles and one ball, all of which have the appropriate bounding volumes constrained to them, it would be great if the ball could knock them over and they in turn could knock into each other.

What is the most basic way of doing this?


texts:
I'm currently working on a small roguelike in XNA, which sees the player in a randomly generated series of dungeons fending off creeps, as you might expect. As with most roguelikes, the player makes a move, and then each of the creeps currently active on screen will make a move in turns, until all creeps have updated, and it return's to the player's go. On paper, the simple algorithm is straightforward:

Player takes turn
Turn Number increments
For each active creep, update Position
Once all active creeps have updated, allow player to take next turn

However, when it comes to actually writing this in more detail, the concept becomes a bit more tricky for me. So my question comes as this: what is the best way to handle events taking turns to trigger, where the completion of each last event triggers the next, when dealing with a large number of creeps (probably stored as an array of an enemy object), and is there an easier way to create some kind of engine that just takes all objects that need updating and chains them together so their updates follow suit?

I'm not asking for code, just algorithms and theory in the direction of objects triggering updates one after the other, in a turn based manner.

Thanks in advance.

Edited: Here's the code I currently have that is horrible :/

        if (player.getTurnOver() && updateWait == 0)
            {
                if (creep[creepToUpdate].getActive())
                {
                    creep[creepToUpdate].moveObject(player, map1);
                    updateWait = 10;
                }
                if (creepToUpdate < creep.Length -1)
                {
                    creepToUpdate++;
                }
                else
                {
                    creepToUpdate = 0;
                    player.setTurnOver(false);
                }
            }
            if (updateWait > 0)
            {
                updateWait--;
            }


texts: How should a player object to communicate with a map object?

texts:
I'm writing my first game (in Javascript / Node over WebSockets) and am running into a bit of chicken and egg problem, and am afraid how I'm doing it right now won't scale once the game gets more complex.

Here is how the game is architected. It's a tiled strategy game. When a user connects, a new Game object is created:

// width and height of the board / map
function Game(width, height) {
  this.map = new Map(width, height);
  this.player = new Player();
  // ...
}

game = new Game(100,100);

What's reasonable way for 2-way communication between a player object (or any object), and the map?

For example, if a player wants to move left, first I must check that there is no obstacle in his way, then, once this condition is true, his position must be updated, and he loses a stamina point, so both the map and the player objects are updated depending on conditions that most objects both meet (in the simplest case, where there is no interaction with other objects).

One way I can think, is to have a global GAME object, so that the map can access GAME.player and the player can access GAME.map, but this doesn't seem elegant (and will cause me a headache once I have multiple rooms with separate games running on the same node instance).


texts: What is the "Unity" way to approach tech design for a 2D game like this?

texts:
So I come from C++ land where I've always done every little thing myself. Now I'm getting into Unity and C# and I'm ironically overwhelmed with the domain. I'm starting off with this simple little 2D game and I'm wondering... if someone can point me to the correct tools that would lead to a successful implementation of this game. Here is a quick mock up I did in paint:

These are the parts of Unity I've investigated:

Tilemap
Canvas
GridLayout
Prefabs
GameObjects (these seem fundamental to Unity, heh).

After researching these topics, and playing around a bit, here are my initial questions:
How do you approach Canvases in Unity? I could see this being split into 5 separate Canvases, one for each local body of UI. Or 1 Canvas for the game board, and 1 canvas that contains a single overlay with all of the other UI components. But then how do those components typically get positioned? Is it common practice to place by absolute coordinates?
I guess I'm getting hung up on.. how do I place my canvas for the game board in that position relative to all the other UI elements? I'm a C++ application developer so if I'm doing UI at all I'm used to layout systems. I'm not sure how common that is in this ecosystem.
Should I even use TileMap for this? It doesn't seem like I need that kind of power. My grid is finite and fits on screen. My gut reaction is that I should just instantiate a bunch of colored squares at first. But I'm not really sure the best approach to that either. GridLayout on a canvas? Absolute coords? TileMap?
What other tools should I be looking at? By tools I mean Unity concepts I didn't mention above. My initial thought is to just have a backing data structure that holds all the data for the grid, and then I just render... prefabs? based on that data? Maybe I just want someone to tell me I'm on the right track or "no you're doing it totally wrong use this other thing", heh.


texts: Rigged blender model is deformed when imported into Unity

texts:
I am facing a strange problem with a model I rigged in Blender. Everything in Blender seems fine:

All scales and rotations are normalized

There is no unassigned vertex

There is no weight bleeding from other bones

However when I imported the model in Unity, I am faced with some distortion happening  in some of the model's meshes (it is a composite model).

Note that this doesn't seem to be happening for all bones or mesh components, but only for a couple of them.
Does anyone have any clue about why this is happening?
Thank you!


texts: What are some good recommendations?  I have a vertex buffer and indices and I want to be able to detect collision between it and a bounding box or another object.


texts: How much data can a phone's USB transfer per second?

texts:
I'm conceiving a game that relies heavely on transfer speed from pc to phone. From USB it seems to be faster than wi-fi. But i can't get precise numbers on the net, everywhere tells me a diferente story.
Does anybody know how much data can i transfer from pc to phone via USB per second?


texts: How do you know when to draw the next frame if its bounding box is larger/smaller than the current? For example, in KOF, some characters have elastic arms and things of the like..How are these handled in a game?


texts:
I'm drawing a circle using DrawNode.

Is there a way to cache that drawing into Sprite or put it to SpriteFrameCache for later use? Because drawing the circle again each time might slow the game down.


texts: Does a minor in math increase my hirability?

texts:
I've been pondering this question for some months now, and have been unable to get an answer from anyone in the industry (likely because I know no one in the industry).

I am currently completing a B.S. in Computer Science, and I want to know if minoring in math will look good on my resume to gaming companies large and small.

I am not set on becoming a game developer, but I certainly want to have that option available to me.

UPDATE: It's been a couple years since I asked this question, and have since graduated WITHOUT the minor. I was able to get a job at an amazing company, but not in game development. I am now personally of the opinion that minors are not really a major selling point for aspiring Software Engineers. The most important thing is building software and showing it off to potential employers.


texts: How can I get direction or link of file in computer

texts:
I want to import an .obj file in my Engine or open some files : To do that I write a link or direction of that file in my computer. Like this

file.open("../Engine/data/model.obj");

But I dont want to write a link every time. In most application if you want to import or open a file you click on import or open and it opens a window where you search that file in your computer and click open.
Here is a picture to see what I am about.

How it is done?. How can i write a c++ program to get link of a file like here?.
Is there any windows libraries or API's to creat something like this.


texts: How do you make a bullet ricochet off a vertical wall?

texts:
First things first. I am using C# with XNA. My game is top-down and the player can shoot bullets. I've managed to get the bullets to ricochet correctly off horizontal walls. Yet, despite using similar methods (e.g. https://stackoverflow.com/questions/3203952/mirroring-an-angle) and reading other answered questions about this subject I have not been able to get the bullets to ricochet off a vertical wall correctly. Any method I've tried has failed and sometimes made ricocheting off a horizontal wall buggy.

Here is the collision code that calls the ricochet method:

//Loop through returned tile rectangles from quad tree to test for wall collision. If a collision occurs perform collision logic.
for (int r = 0; r < returnObjects.Count; r++)
    if (Bullets[i].BoundingRectangle.Intersects(returnObjects[r]))
        Bullets[i].doCollision(returnObjects[r]);

Now here is the code for the doCollision method.

    public void doCollision(Rectangle surface)
    {
        if (Ricochet) doRicochet(surface);
        else Trash = true;
    }

Finally, here is the code for the doRicochet method.

    public void doRicochet(Rectangle surface)
    {
        if (Position.X > surface.Left && Position.X < surface.Right)
        {
            //Mirror the bullet's angle.
            Rotation = -1 * Rotation;
            //Moves the bullet in the direction of its rotation by given amount.
            moveFaceDirection(Sprite.Width * BulletScale.X);
        }
        else if (Position.Y > surface.Top && Position.Y < surface.Bottom)
        {
        }
    }

Since I am only dealing with vertical and horizontal walls at the moment, the if statements simply determine if the object is colliding from the right or left, or from the top or bottom. If the object's X position is within the boundaries of the tile's X boundaries (left and right sides), it must be colliding from the top, and vice verse. As you can see, the else if statement is empty and is where the correct code needs to go.


texts:
For our school project we'd like to develop a game using the MVC pattern. We're all moderate new java programmers and absolutely new in game development.

With our current view (containing only menu) using swing we have no issues. But we'd like to make the menu navigation within the game loop. And there's the issue: The game loop prevents the controller to continue. The solution sounds easy, but the implementation lacks some of my/our knowledge, additional thread. I think using a separate thread for view makes handling all stuff threadsafe difficult.

Our game loop is based on nifty, which is using slick2d and this is based on lwjgl (and so on). Reverting to swing does not solve our issue, because once we're in the real game loop, the situation would be the same (so far I understand).

I hope it is understandable without posting huge amount of code. Two questions comes to mind:
How should threading be done, when my current try is having a (looping) view instance in its own thread?
(Reading a bit here on gamedev seems to call our architecture in question) Is MVC the right choice if we're using slick as framework?


texts: Is there a way to view all colliders in a unity project at runtime (after the game have been deployed)?

texts:
I'm have created a small Unity project but physics has weird behavior (bug). Unfortunately it only happens on some specific hardware (after build), not on development machine.

I don't know what is the reason it's probably due to different framerate. Viewing all object and their colliders would probably help me a lot.

Is there a possibility in Unity to view all colliders in the game at run time (some kind of debug mode). Something similar as Game tab view in Unity with Gizmos option enabled, but for all objects ?


texts: How can I make the y extent height also to be random when instantiate new objects?

texts:
With the script I instantiate random objects above the terrain. But the random was only on x and z. Now I want the height of the objects to be random as well.

The terrain position is: X = -250, Y = 0, Z = -250.

So I changed the line:

var y = Extents.y;

To:

var y = Random.Range(-Extents.y, Extents.y);

But now half of the objects above the terrain and half below the terrain, and I want them all to be above the terrain; thus the random height should be above the terrain.

My full code for reference:

using System;
using UnityEngine;
using Random = UnityEngine.Random;

[ExecuteInEditMode]
public class SphereBuilder : MonoBehaviour
{
    // for tracking properties change
    private Vector3 _extents;
    private int _sphereCount;
    private float _sphereSize;

    /// <summary>
    ///     How far to place spheres randomly.
    /// </summary>
    public Vector3 Extents;

    /// <summary>
    ///     How many spheres wanted.
    /// </summary>
    public int SphereCount;

    public float SphereSize;

    private GameObject parent;

    private void Start()
    {
        parent = GameObject.Find("Target Builder");
    }

    private void OnValidate()
    {
        // prevent wrong values to be entered
        Extents = new Vector3(Mathf.Max(0.0f, Extents.x), Mathf.Max(0.0f, Extents.y), Mathf.Max(0.0f, Extents.z));
        SphereCount = Mathf.Max(0, SphereCount);
        SphereSize = Mathf.Max(0.0f, SphereSize);
    }

    private void Reset()
    {
        Extents = new Vector3(250.0f, 20.0f, 250.0f);
        SphereCount = 100;
        SphereSize = 20.0f;
    }

    private void Update()
    {
        UpdateSpheres();
    }

    private void UpdateSpheres()
    {
        if (Extents == _extents && SphereCount == _sphereCount && Mathf.Approximately(SphereSize, _sphereSize))
            return;

        // cleanup
        var spheres = GameObject.FindGameObjectsWithTag("Target");
        foreach (var t in spheres)
        {
            if (Application.isEditor)
            {
                DestroyImmediate(t);
            }
            else
            {
                Destroy(t);
            }
        }

        var withTag = GameObject.FindWithTag("Terrain");
        if (withTag == null)
            throw new InvalidOperationException("Terrain not found");

        for (var i = 0; i < SphereCount; i++)
        {
            var o = GameObject.CreatePrimitive(PrimitiveType.Sphere);
            o.tag = "Target";
            o.transform.localScale = new Vector3(SphereSize, SphereSize, SphereSize);
            o.transform.parent = parent.transform;

            // get random position
            var x = Random.Range(-Extents.x, Extents.x);
            //var y = Extents.y; // sphere altitude relative to terrain below
            var y = Random.Range(-Extents.y, Extents.y);
            var z = Random.Range(-Extents.z, Extents.z);

            // now send a ray down terrain to adjust Y according terrain below
            var height = 10000.0f; // should be higher than highest terrain altitude
            var origin = new Vector3(x, height, z);
            var ray = new Ray(origin, Vector3.down);
            RaycastHit hit;
            var maxDistance = 20000.0f;
            var nameToLayer = LayerMask.NameToLayer("Terrain");
            var layerMask = 1 << nameToLayer;
            if (Physics.Raycast(ray, out hit, maxDistance, layerMask))
            {
                var distance = hit.distance;
                y = height - distance + y; // adjust
            }
            else
            {
                Debug.LogWarning("Terrain not hit, using default height !");
            }

            // place !
            o.transform.position = new Vector3(x, y, z);
        }

        _extents = Extents;
        _sphereCount = SphereCount;
        _sphereSize = SphereSize;
    }
}


texts: Calculate when round object is inside an ellipse

texts:
I want to calculate in java when a circle is inside an ellipse. I drew an example below:

For this particular problem, the top left corner of the field has the position 0.0f, 0.0f. The bottom right corner has the position 1.0f, 1.0f. The position of the bat is: 0.48f, 0.94f. The goal is located at: 0.5f, 1.0f, height is 0.1f and the radius 0.4f.

How can I calculate if the bat is inside the ellipse?  What is the general algorithm?


texts: Where are the files UnityEngine.dll and UnityEditor.dll located on a Windows filesystem?

texts:
Visual Studio can't find the UnityX.dll files after I copied my assets folder from one computer to another. Where can I find these .DLLs?

UnityEditor.dll
UnityEditor.iOS.Extensions.XCode.dll
UnityEngine.dll
UnityEngine.UI.dll


texts: Problems making a smooth character rotation

texts: My character has an angle rotation, when the player touches the screen it automatically face to the place that the player touched, using atan2(y,x) and Math.radiansToDegrees methods, but I want it to do that smoothly, is to say, save the required angle in a variable, and the current one in another, and depending of the 2 values, make it to rotate to left(if the required angle is to the right side of the current) or to the right. I've been almost an hour thinking about this, but I  couldn't solve it.


texts:
I'm trying to render a rotating cube on Opengl ES 2.0, using some math classes I wrote (based on a lot of online and offline info) for quaternions, matrixes and the like. As far as I know all the math classes are right, but I'm still having some issues rotating objects.

The scene is a simple cube, with no translation or scale, I've tried both without projection setup and with projection, and in any case it acts strangely. Without the projection, it looks like the mesh deforms until at some point it breaks, but it's hard to tell what's really going on. With perspective projection, this is a video of what it does rotating about the y-axis.

The rotation is simply an angle being incremented by 0.05f each frame (never decremented), but the effect isn't what I think it should be at all.

Does someone know where should I start looking for mistakes? Thanks.

Note: I haven't posted any code because I don't know where the problem might be (and posting the whole thing is way too much), if anyone has any clues, I will post any code that might be useful.


texts: How to have separate UI section in Monogame?

texts:
So I have a game, and you can move and attack and move the camera around, etc...but I want to have a section of the screen dedicated to Character info like health, etc.

How do I make a fixed section for that and have the game window next to it?


texts: How do I distribute an executable for a c++/opengl game that uses dynamic libraries?

texts: I have a makefile that compiles everything fine but I'm wondering how I can package the dynamic libraries with the executable for distribution.


texts: Widget text is a different color in game than in engine

texts:
I have a widget blueprint to show a main menu. Everything was fine until I recently added a new button in the menu to enable cheat codes. The problem started when I noticed when I changed the color of the button text, it would go back to white after I hit the compile button in the BP. I closed the BP and reopened it and that fixed that issue. However now, no matter what I have the color of the button text set to, it shows the correct color in the editor but as soon as I run the game the button text is white. I have tried clearing the Binaries folder and restarted the engine, cleared the Binaries and Intermediate folders and restarted the engine and I have cleared both Binaries and Intermediate folders and restarted my computer and the problem persists. The problem exists when I run the game from the editor, debug and shipping builds.

Here are the buttons from in the editor

And here are the buttons when I run the game. It doesnt matter if I run it in PIE, Standalone Game, release build or debug build the text is white.

Any ideas on how I can fix this issue?


texts:
My game has 4 supplies, Gold Wheat Iron Fuel, a player is allowed to select a supply to trade and what supply to receive from merchant NPCs.

Currently, when the user trades an item I have the following logic
I am using c# but this is not the exact code used.

if(sellGold){
    if(buyGold){
        tradeRatio = .5;
    }
    if(buyWheat){
        tradeRatio = 3;
    }
}
else if(sellIron){
    if(buyGold){
        tradeRatio = 1;
    }
    if(buyFuel){
        tradeRatio = 2;
    }
}
...etc

Where the amount a player receives is calculated by multiplying the trade ratio by the amount sold.

This works, it is just rather tedious and would be a pain to add more supplies later. What would a better approach be? I'm thinking of assigning each item a value and that value is different based on the trade type, but that still involves a whole bunch of nested conditionals.


texts: How can I to get an animation to be triggered by proximity of a mesh actor (an object)?

texts:
So I'm making my first build in Unreal 4 using Blueprint. The "game" calls for the player character to grab a particular object (a static mesh actor) and bring it close to a door that will slide open if detects the item near.
I have the door slide animation and a trigger volume around the door but I can't get it to work with the mesh actor I want. So far I've managed to get it to open with by pressing a keyboard key while being inside the trigger volume. I believe the volume trigger can detect any actor that is within its border, right?
What nodes could I use to make this work?
UPDATE: Thanks to @Stephen I tried using the cast node solution but I still can't get it to work
If it helps, I've added an updated screenshot of my blueprint.
Cheers!


texts: What is the design rationale behind melee retaliations in turn-based games?

texts:
I've seen quite a lot of turn-based games in which melee attacks on another unit cause the attacked units to also damage the attacking unit, while ranged attacks do not suffer from this "retaliation" mechanic.

Examples include the Heroes of Might and Magic series, the Civilization series, the new King's Bounty series, and more.

Is there a specific design reason for this? What's the rationale behind giving the attacked unit an extra attack, which doesn't cost it its turn? And why are ranged attacks excluded from retaliation?


texts: How to edit a Rigged 3D Model without Ruining the Rig?

texts:
I have some rigged 3D models that I want to use. They came as .fbx. and sometimes I want to make some minor edits such as merging/moving/removing some vertices or something of that nature.
The Problem: That (using Unity & Blender) I cannot seem to be able to make changes to a 3D model without ruining the model's Rig.
Blender's importing seems to be the problem, if you care to take a look - but it may be unfixable.

(The first picture is what happens because Blender f*#ks up the the
leaf nodes, the 2nd is me trying to reattach the mesh to a Rig)

I have been completely stuck for a full day; however, it would seem that there are several potential fixes/work-arounds for this problem. And I am wondering which of these you would take? These could be:

Figuring out why importing a .fbx into Blender breaks the model. I'm not confident that this is going to happen, so let's discuss other possibilities.
Using Unity / Unity's API, and an unedited copy of the model that is working, apply the changes that I've made to the model, and then (instead of using Blender's broken Rig) somehow apply the Rig of this working model to my edited model, such that the same vertices are attached to the same bones, and new ones are attached to the nearest bone, ect.
Just completely give up on the old Rig and re-rig it in Blender.
Through Unity, somehow applying the vertex changes I've made to the model to the model that does have a working Rig.
Something else that I haven't thought of.

This is frustrating and I want to move on to the next thing already, so if Blender's importing can be fixed I am interested in looking into one of the above work-arounds. What would you advise that I look into?


texts: Am I allowed to name a game after some song?

texts:
Just to ask a quick question, which I don't know where to ask: If I were to make a game, would I be allowed to call it "Buffalo Soldier [some more words]"? Since it's a song by Bob Marley I am not sure if this would get me into all kinds of legal trouble because of copyrights, which I obviously want to avoid.

By the way, the game doesn't have anything to do with Bob Marley or the music industry. I just thought a game about a buffalo soldier would be nice!


texts: What are the differences between XNA 3.1 and 4.0?

texts: I have been away from XNA for a couple months and want to get back into it.  I had a game I was currently working on, but it was done in XNA 3.1. What are the differences between the two, and is it worth updating?