texts: Half of my tris are textured in streaks and blurs

texts:
I have written code to import meshes from OBJs and textures from BMPs. My texture coordinates seem to be getting messed up somehow, or some other issue is occuring, because I am getting these effects with meshes and textures:

I do not know what to call these issues and I do not know what might cause them (I am new to OpenGL) so it is hard for me to figure out how to fix them. Does this look familiar to anyone? If so, what's up and how might I fix it?
Relevant code for importing mesh data:
obj.vertBufferSize = sizeof(GLfloat) * vertCount * 3;
obj.uvBufferSize = sizeof(GLfloat) * vertCount * 2;
obj.vertBuffer = vertBuffer;
obj.uvBuffer = uvBuffer;

glGenBuffers(1, &obj.vertBufferID);
glBindBuffer(GL_ARRAY_BUFFER, obj.vertBufferID);
glBufferData(GL_ARRAY_BUFFER, obj.vertBufferSize, &(obj.vertBuffer[0]), GL_STATIC_DRAW);

glGenBuffers(1, &obj.uvBufferID);
glBindBuffer(GL_ARRAY_BUFFER, obj.uvBufferID);
glBufferData(GL_ARRAY_BUFFER, obj.uvBufferSize, &(obj.uvBuffer[0]), GL_STATIC_DRAW);

Relevant code for importing texture data:
glGenTextures(1, &(bmp.ID));
glBindTexture(GL_TEXTURE_2D, bmp.ID);

glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, bmp.width, bmp.height, 0, GL_BGR, GL_UNSIGNED_BYTE, bmp.array);

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glGenerateMipmap(GL_TEXTURE_2D);

Before the main loop (for sending mesh data to shaders):
glBindBuffer(GL_ARRAY_BUFFER, mesh.vertBufferID);
glVertexAttribPointer
(
    0,
    3,
    GL_FLOAT,
    GL_FALSE,
    0,
    (void*)0
);

glBindBuffer(GL_ARRAY_BUFFER, mesh.uvBufferID);
glVertexAttribPointer
(
    1,
    2,
    GL_FLOAT,
    GL_FALSE,
    0,
    (void*)0
);

Samples from inside the main loop:
glEnableVertexAttribArray(0);
glEnableVertexAttribArray(1);

glBindTexture(GL_TEXTURE_2D, texture.ID);

glDrawArrays(GL_TRIANGLES, 0, mesh.vertCount);

glDisableVertexAttribArray(0);
glDisableVertexAttribArray(1);


texts: Is there a term for lore about a game world's population (cultures, economic state, etc.)?

texts:
The lore of a game, the ethnicity of its population, cultures, economic state or anything which illustrates the population of a game.

Are all these things part of the lore? Or are they called the story of the game?


texts: Separate player rating systems for attackers and defenders

texts:
Imagine a kind of tower defence game where each player specialises either in defence or attack (a player is either one or the other in all games). In each game the attacker and the defender get separate scores. I want a leaderboard for the best defenders and a separate leaderboard for the best attackers. What are appropriate player rating systems in such a scenario? The ideal system is also efficient in that it produces robust rankings even if only a fraction of all possible attacker/defender combinations are actually played.

All the scoring systems I am aware of (e.g. Elo ratings or Microsoft TrueSkill) assume that both players are treated on an equal footing. I'd be extremely grateful for any pointers to relevant scoring systems.


texts:
I am making a simple space simulator, where the player can control a ship using 2 controls, one for pitch and one for bank. The ship is properly rotated but I cannot figure out how to make the ship move forward based on that angle. Here's what the code looks like right now:

func renderer(renderer: SCNSceneRenderer, updateAtTime time: NSTimeInterval) {

    let t=CGFloat(time - lastTime)

    ship!.transform = CATransform3DRotate(CATransform3DRotate(CATransform3DRotate(ship!.transform, ud*t, -1, 0, 0), 0.00, 0, 1, 0), lr*t, 0, 0, 1);

    ship!.position = ?

}

I tried every combination of vector, euler angles, matrices, quaternions that I could think of/read about with no success. I am probably missing something stupid but cannot find what it is.

The code is in Swift using Scenekit, but language doesn't matter that much to me and I can translate any algorithm. It's also worth noting it does not work like Unity and Quarternions/Vectors don't have properties like .forward() etc.

Thank you for your help!


texts: Can a material be created from a gameobject in Unity?

texts: I am trying to manually create snowflakes in unity, after I created a snowflake in the unity scene, is it possible to create a material out of it?


texts: How do I display the next speaker image in my dialogue?

texts:
I am working on a dialogue system and while the text part works, the UI for the Dialogue Boxes does not.

When I click on the Continue button, I want the script to go down the Elements [] and use the Image that I have selected there, similar to what the sentences[] feature does.

This is my script:

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

public class TextDialogueScript : MonoBehaviour
{
    public TextMeshProUGUI textDisplay;
    public TextMeshProUGUI ContinueDialogue;
    public Image UIDisplay;
    public string[] sentences;
    public Image[] CharacterNames;
    public Sprite[] CharacterDialogueBox;
    public Image[] CharNames;
    //public List<Image> DialogueBoxes = new List<Image>();
    // public List<Image> CharacterName = new List<Image>();
    private int index;
    private int DBindex;
    public float typingSpeed;
    public GameObject DialogueTrigger;
    public GameObject DialogueEventController;
    public GameObject NormalEeventController;

    // Start is called before the first frame update
    void Start()
    {
        NormalEeventController.SetActive(true);
        DialogueEventController.SetActive(false);
        UIDisplay.enabled = false;
        ContinueDialogue.enabled = false;
    }

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

        if(textDisplay.text == sentences[index])
        {
            ContinueDialogue.enabled = true;
        }

    }

    public void OnTriggerEnter(Collider other)
    {
        if(other.CompareTag("Player"))
        {
            NormalEeventController.SetActive(false);
            DialogueEventController.SetActive(true);
            StartCoroutine(Type());
            ContinueDialogue.enabled = true;
            UIDisplay.enabled = true;
            UIDisplay.sprite = CharacterDialogueBox[DBindex];
        }

    }

    public void OnTriggerStay(Collider other)
    {
        if (ContinueDialogue == true)
        {

        }
    }

    public void OnTriggerExit(Collider other)
    {
        NormalEeventController.SetActive(true);
        DialogueEventController.SetActive(false);
        ContinueDialogue.enabled = false;
        UIDisplay.enabled = false;
    }

    IEnumerator Type()
    {
        foreach(char letter in sentences[index].ToCharArray())
        {
            textDisplay.text += letter;
            yield return new WaitForSeconds(typingSpeed);
        }
    }

    public void NextSentence()
    {

        ContinueDialogue.enabled = false;

        if(index < sentences.Length - 1)
        {
            index++;
            textDisplay.text = "";
            StartCoroutine(Type());
        }
        else
        {
            textDisplay.text = "";
        }

        if (DBindex < CharacterDialogueBox.Length - 1)
        {
            DBindex++;
        }

    }

}

I was using a List that grabbed sprites, but the problem is, it would only use Sprites from the Assets and not the Hierarchy. This is a problem because I have messed with the colours using Unity and played around with the Alpha to get the exact effect I want that cannot be replicated with my image program.

(I do not know what the term is for adding [] on the end of items to add elements that can be expanded. I have been stuck on this dialogue system for a very long time and I am very tired yet excited because I am so close to getting this to work, that it's painful)


texts:
I was  just wondering after noticing that moblox was.built with irrlicht if there is an android port of it?  Or did the dev make his own port from scratch?

From my research I noticed a port project on github but it seems far from ready.-


texts: I am very new to game design and programming in Unrealscript for UDK. I have created a weapon mesh and imported it alongside it's animation set and created a start and end socket on it. I was wondering if anyone could help me create a weapon class for it and allow it to be used in the game?


texts: Why is this code producing jittery movement?

texts:
I have a new project, all settings default with a simple cube on a plane. Cube is not kinematic but is a rigid body under the effects of gravity. I'm trying to normalize the direction before I translate it to prevent diagonal movement from being too fast. The movement is perfectly smooth when I just translate by the speed, but when I try to normalize it and multiply that vector, the movement becomes jittery and feels delayed, almost. I have no idea what the cause could be. Here's the code in question. It takes place in the Update() override:

    float directionHorizontal = Input.GetAxis("Horizontal");
    float directionVertical = Input.GetAxis("Vertical");

    Vector3 translationDirection = new Vector3(directionHorizontal, 0, directionVertical);
    translationDirection.Normalize();

    translationDirection *= Speed * Time.deltaTime;
    transform.Translate(translationDirection);

EDIT: After some further tinkering and testing, I'm finding that the problem is more specifically that the movement seems to jump from frame to frame rather than move smoothly from one spot to another. It seems like it's moving the right speed, but this kind of really fast start/stop gives it that jerky feel.

Is this normal behavior? Shouldn't the delta time multiplication smooth out the movement and give it a more interpolated feel? This happens even if i avoid the normalization method and just multiply the axis by speed and time.


texts: Starting out with OpenGL when most tutorials are out of date

texts:
I'm sure there are already a bunch of questions like this asked, but the constant updating of the OpenGL library throws them all away, and in a month or two, the answers here will be worthless again.

I am ready to start programming in OpenGL using C++. I've got a working compiler (DevCpp; do NOT ask me to switch to VC++, and don't ask me why). Now I'm just looking for a solid tutorial on how to program with OpenGL. My assistant found the tutorial provided by NeHe Productions, but as I've come to find out, it's WAY OUT OF DATE! (although I did pull together a basic window to support an OpenGL canvas)

Then I went online, and found the OpenGL SuperBible, which apparently uses freeglut? But what I'd like to know is whether or not SuperBible 5th edition is up to date any longer. The suggestion to freeglut I found said the latest version was 2.6.0 but now it's 2.8.0!

Is the OpenGL SuperBible still a good, and fairly up-to-date place to start?
Is there a better place to go to learn OpenGL?
Am I allowed to simply store freeglut in the DevCpp include directory (maybe in GL), or is there some important procedure?
Are there any comments or suggestions that I didn't think to ask since I'm only just beginning?

@dreta cleared some things up for me, so now I have a better idea of what to ask:

I think I'd like to start out with OpenGL using a wrapper library instead of directly accessing OpenGL.I just think that, for a beginner, it would be easier for me to program and get good results, while I don't yet have to understand all the grimy details (as @stephelton mentioned).

The problem is, I can't find any library that doesn't have undefined references to no longer supported functions. Freeglut sounds operational, but it still uses GLU.Does anyone know what I can do?Also, I tried compiling the first SuperBible's source, but I got errors since GLAPI is not being defined as a type, the error originating in the GLU library.

I'd like to use the SuperBible, but I don't know how to fix this.


texts: Unity - Jump counter for double jump script not working? C#

texts:
It was working fine last night but it doesn't work today, the zJumpCount stays at zero after I jump now. If the zJumpcount stays at zero my double jump code doesn't work. I even ctrl+z'd back to the beginning of the session with no luck.

public class zPlayerMovement : MonoBehaviour {

  public float zMoveSpeed;
  public float zJumpThrust;
  public bool IsGrounded;
  public float zJumpCount;
  private Rigidbody zRB;

  void Start () {
    zRB = GetComponent<Rigidbody>();
  }

  void Update () {

    if (IsGrounded == true)
      zJumpCount = 0f;

    if (Input.GetKey(KeyCode.A))
      zRB.transform.Translate(Vector3.left * zMoveSpeed);

    if (Input.GetKey(KeyCode.D))
      zRB.transform.Translate(Vector3.right * zMoveSpeed);

    if(Input.GetButtonDown("Jump") && IsGrounded == true)
    {
      zRB.AddForce(Vector3.up * zJumpThrust, ForceMode.VelocityChange);
      zJumpCount++;
    }

    if (IsGrounded == false && zJumpCount > 0 && zJumpCount < 2)
    {
      if (Input.GetButtonDown("Jump"))
      {
        zRB.AddForce(Vector3.up * zJumpThrust, ForceMode.VelocityChange);
        zJumpCount++;
      }
      if (IsGrounded == false && zJumpCount >= 2)
      {
        if (Input.GetButtonDown("Jump"))
          return;
      }
    }
  }

  void OnCollisionStay (Collision collisionInfo)
  {
    IsGrounded = true;
  }

  void OnCollisionExit (Collision collisionInfo)
  {
    IsGrounded = false;
  }
}


texts: Check if GameComponent is ready in Unity?

texts:
I am trying to create a MessageBox in Unity, but I'm having some troubles in C#.. This is my code (I'll explain my problem later):

MsgBox.cs

public class MsgBox : MonoBehaviour
{
    private UIButton _btn_ok;  // NGUI Button
    private UILabel _caption;  // NGUI Label
    private GameObject _box;   // The message box container

    void Start()
    {
        _box = this.gameObject;
        _btn_ok = _box.transform.Find("btn_ok").GetComponent<UIButton>();
        _caption = _box.transform.Find("Title").GetComponent<UILabel>();

        // ** the line below works fine, but I don't want to change the caption here **

        // this.Caption = "This Works";
    }

    public string Caption
    {
        get
        {
            return _caption.text;
        }

        set
        {
            _caption.text = value;
        }
    }
}

My Saved Prefab

As you can see, my prefab have the MsgBox.cs attached to the Box component (wich is the _box variable).

But this code doesn't work:

Fail Code

function createBox()
{
    GameObject wnd = (GameObject)Instantiate(Resources.Load("Box"));
    MsgBox mb = wnd.GetComponent<MsgBox>();
    bool foo = true;

    if (mb == null)
    {
        Debug.Log("MsgBox is null");
        foo = false;
    }

    if (!(mb is MsgBox))
    {
        Debug.Log("mb is not MsgBox");
        foo = false;
    }

    if (foo)
    {
        Debug.Log("passed!");
        mb.Caption = "Hello!";
    }
}

Console Output

  passed!NullReferenceException: Object reference not set to an instance of an object MsgBox.set_Caption (System.String value) (at Assets/scripts/MsgBox.cs)

If I change this:

public string Caption
{
    get
    {
        return _caption.text;
    }

    set
    {
        _caption.text = value;
    }
}

to this:

public string Caption
{
    get
    {
        return _caption.text;
    }

    set
    {
        if (_caption == null)
            Debug.Log("Caption is null");
        else
            _caption.text = value;
    }
}

and call createBox, the console give me this:

  Caption is null

Why? Why I can't change the caption from outside the MsgBox? Maybe the createBox() is being called first than Start()?

PS. Using Unity 5 64 bit. My platform is WebGL.
PS². English is not my native language, sorry.


texts: Rotation doesn't turn towards characters on right

texts:
So I'm working on a tower defense type of game and I have a rotation set up that is supposed to follow a chosen enemy. What I'm seeing is when the enemy comes from the left the turret turns quickly to face the enemy quickly. But when the enemy is on the right it goes much slower and doesn't actually "face" the character until much longer.

In this image I have the game set to show the capsule when the enemy is "targeted" so I know which one the turret is supposed to be facing.Right now its set for closest to base so the enemy at the bottom of the circle is the one the turret should be aimed at. It had from the time the enemy entered the blue area from the right till now when its almost out to point at the enemy. But it still hasn't completely turned to point at the enemy yet. However when the closest enemy is on the left it has no problem turning to face the enemy quickly.

Here is the code I am using to turn towards the enemy. Any ideas on what could possibly causing this behavior?


texts: Super mario bros "rounded" tile collision detection

texts:
I'm working on a Mario bros clone with SDL and C++ (purely for educational porpuses / and for fun)
I got collision detection working by using AABB collision detection and resolving one axis at a time:

Check collision with X-axis first
Move entity if not collision is detected
Check collision with the Y-axis.
Move entity if not collision is detected

This is working great!
However, one thing that I really like about the original Mario bros is that tiles have some kind of "rounded" feel to them. I think this helps make the map feel more organic, see how Mario moves left when jumping on a corner in the original SNES game:

I thought of using a circle collider for mario instead of an AABB.
This would make Mario "fall" off the tiles if you step too close to the edges. But perhaps someone knows a better approach. I've been thinking about collision detection for longer than I'd like to admit.
I'd love to know if someone has a clean aproach to accomplish what the GIF shows.


texts: Pygame - implementing a scrolling camera

texts:
I am currently making a 2d game in Pygame and have run into a roadblock trying to make a scrolling camera (follows the character).  I have seen some other answers to similar questions, but they have helped very little.  Also, I am purposely doing this without the use of Pygame's Sprite class, so that makes things a little more complex.  How should I approach this?

display_width = 800
display_height = 640
size = (display_width, display_height)
half_width = int(display_width / 2)
half_height = int(display_height / 2)

black = (0,0,0)
white = (255,255,255)

clock = pygame.time.Clock()
pygame.display.set_caption("My game")
screen = pygame.display.set_mode(size)

background = Surface((32,32))
background.convert()
background.fill(Color('#783131'))

x = 0
y = 0

platformlst = []
players = []

level = [
    "PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "P                    PPPPPPPPPPP           P",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "P    PPPPPPPP                              P",
    "P                                          P",
    "P                          PPPPPPP         P",
    "P                 PPPPPP                   P",
    "P                                          P",
    "P         PPPPPPP                          P",
    "P                                          P",
    "P                     PPPPPP               P",
    "P                                          P",
    "P   PPPPPPPPPPP                            P",
    "P                                          P",
    "P                 PPPPPPPPPPP              P",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "P                                          P",
    "PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP",]

total_level_width = len(level[0])*32
total_level_height = len(level)*32
map_size = (total_level_width, total_level_height)
virtualwindow = pygame.Surface.get_rect(screen)

class Camera:
    def __init__(self, players):
        self.left_viewbox = display_width/2 - display_width/8
        self.right_viewbox = display_width/2 + display_width/10

    def follow(self, shift_x):
        virtualwindow.x += shift_x
        print virtualwindow.x
        for i in players:
            i.rect.x += shift_x

    def viewbox(self):
        if player.x <= self.left_viewbox:
            view_difference = self.left_viewbox - player.x
            player.x = self.left_viewbox
            self.follow(view_difference)

        if player.x >= self.right_viewbox:
            view_difference = self.right_viewbox - player.x
            player.x = self.right_viewbox
            self.follow(view_difference)

Basically, the player objects are added to a list, which is called out in the follow() function, which is called by the viewbox() function.  Then the follow() function should be adding the view_difference as shift_x to the virtualwindow.x.  Shouldn't this therefore scroll the map along its x axis relative with the characters movement?

Here is the full code:
https://github.com/tear727/Netse/blob/master/game.py


texts:
My first post here, so at first i would like to say HI to everyone!

Had a course of computer graphics at my uni and got interested with opengl. Unfortunatelly we used it with java + jogl + some funky frameworks from our lecturers which provided us with all texturing etc. Now i want to switch to c++, because as i noticed all the tutorials are written in it.

My question is about additional libraries. Google told me that "OpenGL SuperBible V Comprehensive Tutorial and Reference" by Richard S. Wright will be helpful for the learning process and in the book they use GLEW + GLtools. Are those proper tools or should i start with something else? Maybe some other books? [yes i used search for online courses and books here, but maybe you have some tested and up to date positions]


texts:
Problem

I am calculating the model, view and projection matrices independently to be used in my shader as follows:

gl_Position = projection * view * model * vec4(in_Position, 1.0);

When I try to calculate my camera's view matrix the Z axis is flipped and my camera seems like it is looking backwards.

My program is written in C# using the OpenTK library.

Translation (Working)

I've created a test scene as follows:

From my understanding of the OpenGL coordinate system they are positioned correctly.

The model matrix is created using:

Matrix4 translation = Matrix4.CreateTranslation(modelPosition);
Matrix4 model = translation;

The view matrix is created using:

Matrix4 translation = Matrix4.CreateTranslation(-cameraPosition);
Matrix4 view = translation;

Rotation (Not-Working)

I now want to create the camera's rotation matrix.  To do this I use the camera's right, up and forward vectors:

// Hard coded example orientation:
// Normally calculated from up and forward
// Similar to look-at camera.
Vector3 r = Vector.UnitX;
Vector3 u = Vector3.UnitY;
Vector3 f = -Vector3.UnitZ;

Matrix4 rot = new Matrix4(
    r.X, r.Y, r.Z, 0,
    u.X, u.Y, u.Z, 0,
    f.X, f.Y, f.Z, 0,
    0.0f, 0.0f, 0.0f, 1.0f);

This results in the following matrix being created:

I know that multiplying by the identity matrix would produce no rotation.  This is clearly not the identity matrix and therefore will apply some rotation.

I thought that because this is aligned with the OpenGL coordinate system is should produce no rotation.  Is this the wrong way to calculate the rotation matrix?

I then create my view matrix as:

// OpenTK is row-major so the order of operations is reversed:
Matrix4 view = translation * rot;

Rotation almost works now but the -Z/+Z axis has been flipped, with the green cube now appearing closer to the camera.  It seems like the camera is looking backwards, especially if I move it around.

My goal is to store the position and orientation of all objects (including the camera) as:

Vector3 position;
Vector3 up;
Vector3 forward;

Apologies for writing such a long question and thank you in advance.  I've tried following tutorials/guides from many sites but I keep ending up with something wrong.

Edit: Projection Matrix Set-up

Matrix4 projection = Matrix4.CreatePerspectiveFieldOfView(
    (float)(0.5 * Math.PI),
    (float)display.Width / display.Height,
    0.1f,
    1000.0f);


texts: How to: create a 3rd person view, multiple layer 3d world

texts:
Imagine a game world like in Dungeon Keeper or Sim City with an (possibly rotatable) 3rd person view, where the game world can be accessed in all dimensions (in discrete steps). For example digging into the ground and accessing a whole new layer, but with the possibility of visible connections between the layers, like an underground dome that exposes a cross-section of several z-layers.

I imagine such a world rather hard to visualize so that it stays as easy and intuitive for the player to navigate as a game world limited to 2 dimensions or from first person. Problems I could see include obstructed areas, differentiating between z-levels, placing stuff in the wrong place, navigating back and forth between places of player interest, clicking the wrong stuff because of perspective issues.

I would be willing to go to great lengths to make navigation in such a world as non-hassling as possible, and I would rather abandon the concept instead of making a frustrating interface.

Do you know any solutions to this problem, maybe even examples where it has been solved in an actual game, or at least in a concept?

(Also, I propose the "perspective" tag, can't add it yet)


texts: Confused about order of operation when using a Matrix in XNA, C#

texts:
Here are two different pieces of code

This is what I started with

Vector2 hold = Vector2.Transform(pos1, mat1);
Matrix inv = Matrix.Invert(mat2);
Vector2 pos2 = Vector2.Transform(hold, inv);

And this is what i'm told is the simplified version

Matrix matrix1to2 = mat1 * Matrix.Invert(mat2);
Vector2 pos2 = Vector2.Transform(pos1, matrix1to2);

What I don't understand is, why isn't the first line in the simpilifed version

Matrix matrix1to2 = Matrix.Invert(mat2)*mat1;

Since in matrix order it looks like the matrix on the right would take effect first and in the original we have mat1 being multiplied in first

Another example,

The following image shows the order of operations desired

http://www.riemers.net/images/Tutorials/XNA/Csharp/Series2D/mat1.png

The tutorial says that to create this transformation you use;

Matrix carriageMat = Matrix.CreateTranslation(0, -carriage.Height, 0) * Matrix.CreateScale(playerScaling)
* Matrix.CreateTranslation(xPos, yPos, 0) * Matrix.Identity;

How could this work if the the order was left to right?


texts: Objects rendering only on editor, but not on build (they get invisible)

texts:
Everything works fine in the editor, but when I build the game, none of the objects in the scene are rendered, and only the skybox and UI text is visible. But although they aren't appearing, they are working as normally (i.e. these objects' triggers work normally when the determined event occurs, like for example, colliding to a specified object, or in other words, they are invisible).

I searched for this issue but didn't found any answer.  Could it be my cheap computer's fault (Intel Celeron without an external graphics card)?

In editor game mode:

In buit game:

I ran both the editor and the built game in the same quality, and also tried to run it in Fastest quality, but no, it made no difference in the built game.

Also, there is no object tagged with "Editor only", only one have a custom tag and all the others are "Untagged". And the camera's culling mask is set to "Everything".

The result is the same either for web or Windows.

Edit:

OK, I built for Android and the objects render normally. So, I'm not completely sure, but probably it's my PC that can't render the objects, because both building for web plugin and desktop have this disappointing result, but for Android it works perfectly (even the shadows, which wasn't being cast in the editor), so...


texts: DirectX Performance Issue: Rendering to texture

texts:
Brief introduction:
I'm programming a game and, till now, I've runned it on my desktop. This morning I decided to try it on my laptop (a i3-4005u with a gt920m) to see cpu/gpu usage and, with my surprise, it couldn't even reach 60 fps... then I discovered that it didn't use the nvidia gpu but the intel's integrated one. I looked a bit on Google and found the problem: https://stackoverflow.com/questions/10535950/forcing-nvidia-gpu-programmatically-in-optimus-laptops.

The usage of the GPU (the Nvidia one now) was still to high for such the game I'm making (kind of 2D platform). Trying it on my desktop (gtx 780) I discovered that it uses even 50% of its power (MSI Afterburner).

A screenshot:

To generate the light map I use a render-to-texture and here is the problem: rendering the lights uses all the power (profiled with visual studio). The only difference between rendering the lights and the background is the active RenderTargetView and the only different between the default back buffer and the light map RTV is the format so I changed it:

textureDesc.Format = DXGI_FORMAT_R8G8B8A8_UNORM; //it was DXGI_FORMAT_R32G32B32A32_FLOAT

After that the gpu usage dropped to 3-4% (and the game looks the same).
Now I'm wondering why things changed. Can you help me?

Still now rendering the lights is the most expensive things and I can't understand why (the shader is simpler than the sprites' one. I can post the code if you want, but is a basic "load data from texture and output")

The first draw call is for lights, then there is the background's one.
I really can't understand what's going on.

P.S
I also found that using a borderless window instead of the fullscreen mode by default adds a 10% of usage on the gpu, while fullscreen mode uses all the cpu power (100% of usage). Can you help me again understanding why?


texts: How to remove large indentation in TextMeshPro?

texts:
When I changed the center text with the size tag, the line height remained the same.

After I used the tag to resize:

How do I remove indentation?


texts:
I have set up GLFW and GLAD in Visual Studio 2017 as follows:
I created in C: directory folder GLFW-GLAD, and put in there, "glfw" (Windows pre-compiled binaries, 32-bit Windows binaries) as well "glad". Also in V.S. I created Empty Project "Project-0" and Source file "Main.cpp".
1. In project GLFW-GLAD's "Properties", Configuration: [All Configurations], Platform: [Active(Win32)], Configuration Properties:
1.1. C/C++ > General > "Additional Include Directories" window  > "C:\GLFW-GLAD\glfw\include" and "C:\GLFW-GLAD\glad\include".
1.2. Linker > General > "Additional Library Directories" window > "C:\GLFW-GLAD\glfw\lib-vc2015"
1.3. Linker > Input > "Additional Dependencies" window > "opengl32.lib; glfw3.lib; glfw3dll.lib".
1.4. Linker > System > Subsystem > Console (/SUBSYSTEM:CONSOLE)
2. In project folder "Project-0" I have pasted files: "glad.c" and "glfw3.dll".
I copied program from https://www.glfw.org/docs/latest/quick.html and pasted in Main.cpp code area. I attempted run it but failed. Output is
"fatal error C1083: Cannot open include file: 'linmath.h': No such file or directory"
Please help.


texts:
I am starting to work with tessellation and have some problems right in the beginning. I try to render a quad made of two triangles with tessellation, but nothing appears on the screen. But as soon as I remove the tessellation shaders and change GL_PATCHES to GL_TRIANGLESagain, it starts working again, without tessellation obviously.

So here is my code to setup the tessellation shaders:

glPatchParameteri(GL_PATCH_VERTICES, 3);
shaderID = glCreateProgram();
{
    vertex = GraphicsUtilities::loadShader("D:\\vert.glsl", GL_VERTEX_SHADER);
    glAttachShader(shaderID, vertex);

    fragment = GraphicsUtilities::loadShader("D:\\frag.glsl", GL_FRAGMENT_SHADER);
    glAttachShader(shaderID, fragment);

    tcs = GraphicsUtilities::loadShader("D:\\tcs.glsl", GL_TESS_CONTROL_SHADER);
    glAttachShader(shaderID, tcs);

    tes = GraphicsUtilities::loadShader("D:\\tes.glsl", GL_TESS_EVALUATION_SHADER);
    glAttachShader(shaderID, tes);
}
glLinkProgram(shaderID);

This is the vertex shader:

   #version 400

layout(location=0) in vec4 vertPosition;
layout(location=1) in vec2 vertUV;
layout(location=2) in vec3 vertNormal;

void main(void){
    gl_Position = vertPosition;
}

The TCS:

#version 400
layout (vertices = 3) out;

void main()
{
    gl_out[gl_InvocationID].gl_Position = gl_in[gl_InvocationID].gl_Position;

    gl_TessLevelOuter[0] = 3.0;
    gl_TessLevelOuter[1] = 3.0;
    gl_TessLevelOuter[2] = 3.0;
    gl_TessLevelInner[0] = 3.0;
}

And the TES:

#version 400
layout(triangles, equal_spacing, cw) in;

void main()
{
    gl_Position = (gl_TessCoord.x * gl_in[0].gl_Position +
                   gl_TessCoord.y * gl_in[1].gl_Position +
                   gl_TessCoord.z * gl_in[2].gl_Position);
}

And this is how I draw the quad:

glPolygonMode( GL_FRONT_AND_BACK, GL_LINE );
glUseProgram(shaderID);
glBindVertexArray(quad->getVboID());

glDrawElements(GL_PATCHES, 6, GL_UNSIGNED_INT, (GLvoid*)0);

glBindVertexArray(0);

glUseProgram(0);
glPolygonMode( GL_FRONT_AND_BACK, GL_FILL );

I tried using in and out variables instead of gl_in/out, but that doesn't work either. I also tried it without the TCS.
I was also using Apitrace to look up any errors, but nothing. The function loadShader() looks for compile errors.
So what could cause this problem? I really have no idea how to debug this thing any further.


texts:
I've just readed a chapter of Unity iOS Essential by Robert Wiebe.

It shows a solution for handling z-figthing problem occuring while rendering a street on a plane with the same y offset.

Basically it modified Normal-Diffuse shader provided by Unity, specifing the (texture?) offset in -1, -1.

Here's basically what the shader looks like:

Shader "Custom/ModifiedNormalDiffuse" {
    Properties {
        _Color ("Main Color", Color) = (1,1,1,1)
        _MainTex ("Base (RGB)", 2D) = "white" {}
    }
    SubShader {
        Offset -1,-1   //THIS IS THE ADDED LINE
        Tags { "RenderType"="Opaque" }
        LOD 200

        CGPROGRAM
        #pragma surface surf Lambert

        sampler2D _MainTex;
        fixed4 _Color;

        struct Input {
            float2 uv_MainTex;
        };

        void surf (Input IN, inout SurfaceOutput o) {
            half4 c = tex2D (_MainTex, IN.uv_MainTex) *_Color;
            o.Albedo = c.rgb;
            o.Alpha = c.a;
        }
        ENDCG
    }
    FallBack "Diffuse"
}

Ok. That's simple and it works.
The author says about it:

  ...we could use a copy of the shader that draw the road at an Offset
  of -1, -1 so that whenever the two textures are drawn, the road is
  always drawn last.

I don't know CG nor GLSL, but I've a little bit of experience with HLSL. Anyway I can't figure out what exactly is going on.

Could anyone explain me what exactly Offset directly does, and how is solves z-fighting problems?


texts:
TL;DR: I have made 8 new layouts for each activity layout, but they are not showing up. For example, I have a layout-land directory with a layout, but that layout doesn't show up when I turn my phone to landscape?

I have made 8 new layouts for each layout in order to work for every screen size. This took me about 4 hours, but I finally got it done. When I tested it on my phone, and changed to landscape mode, the landscape layout didn't show!

Why is this? Is it a problem with my directory names? Here is the project view:

Why isn't the appropriate layout showing? Have I done something wrong and wasted my last 4+ hours by making layouts for each? If you need any more information, feel free to ask for it.


texts: If I understand correctly, render textures are a feature of Unity Pro, and that is the best way to create mirrors, TV screens, and so forth. If I am wrong, please tell me. What I would like to know is if there is another, probably less-convenient, way to create a mirror with the free version of Unity. If I need to write a custom script, I would appreciate a basic outline of how to write it. Even better, if you know of a free script package that does this, please tell me.


texts: Pathfinding on multiple grids connected through teleports

texts:
I try to create a "AI" that can move independently on a map structure where the individual maps are only connected by one directional teleport squares (links).
There are some map areas you can only traverse if you fulfill some requirements.
(for example you could be too heavy to swim.)
Movement is limited to 4 directions.

So far I use A* to navigate on a single map.
For the shortest path across multiple maps I came up with a pre-generated graph.
I use the links as nodes and search with Dijkstra because I wasn't able to come up with a working heuristic for that (no spatial arrangement of the links).
I generate the graph by calculating the cost for every link target square to all other links on that map. (tons of A* searches per map, takes 8-10 minutes to complete).

Then, for an actual search, I temporarily inject the start and end-point as links into the multi-map-graph (and do the cost calcing using A* without persistently saving it) so I can find the fastest way to the goal.
I get a list of goals, one goal per map out of that and just need to do an A* search for each goal on the corresponding map.

The tricky part in my approach is that the costly pre-calculated data isn't able to reflect the dynamic conditions for example swimming. (sometimes there is a completely different route necessary.)

Now on to my question(s).
Is there a known solution to this combination of problems that I'm just unable to find?
Has anyone already faced something similar?

There are some conditions that I want to meet. I'm already almost at the memory(ram) limit (that I'm willing to sacrifice) and I want to keep the disk IO as small as possible (multiple ai would be kill).
I thought about just pre-calculating path for every possible condition and at the moment that could actually work but I'm 99% sure that this wouldn't work in the future (because the size grows exponentially).


texts: How to learn game graphic design for non artist?

texts:
Possible Duplicate:
  Graphics for non-Graphics Designers

I'm more into the technical aspects of a game like programming, mechanics and algorithms.

I'm no artist but I like to make games independently and I'm finding it hard to make graphics for my games. Is there anything that I could do to recuperate with this?


texts:
I'm trying to change the alpha values of a grayscale texture based on some conditions. Essentially if the color value is within some min and max threshold, set the alpha to 0.8, and if it is not within the thresholds, set it to 0 (unable to see) alpha.

Here's my code so far:

    Texture2D UpdateThresholdTexture(Texture2D tex)
    {
        Texture2D texture = new Texture2D(tex.width, tex.height);

        for (int y = 0; y < texture.height; y++)
        {
            for (int x = 0; x < texture.width; x++)
            {
                Color color = tex.GetPixel(x, y);

                bool min = color.grayscale >= minThresh;
                bool max = color.grayscale <= maxThresh;

                if (min && max)
                {
                    color.a = 0.8f;
                    texture.SetPixel(x, y, color);
                }
                else
                {
                    color.a = 0f;
                    texture.SetPixel(x, y, color);
                }
            }
        }
        texture.Apply();
        return texture;
    }

At the moment it's just returning the original texture. Could someone point me in the right direction?


texts: Is there an open source sports manager project?

texts:
For a long time I've tried to search for an open source manager game, but without any luck. I'm looking for a suitable project for a reference to my own pet project. Features like well designed data model, tournament and fixture generation and understandable match simulation algorithm would be a great bonuses.

I'm especially interested in game projects like Hattrick and SI Games' Football Manager, although it is irrelevant what the particular sport is. The project should be preferably web-based as Hattrick is.

I've crawled through GitHub and SourceForge, but I found only a few sports simulation projects. Projects, which I have found, were either dead or not fulfilling my wishes.

Do you know any open source manager game / fantasy sports game project, which would be available as open source, OR at least any material, which would be useful when building a such project?


texts:
I am trying to rotate a sprite so it is always facing a 3D camera.

Object

GLfloat vertexData[] = {
    //  X     Y     Z       U     V
    0.0f, 0.8f, 0.0f,   0.5f, 1.0f,
    -0.8f,-0.8f, 0.0f,   0.0f, 0.0f,
     0.8f,-0.8f, 0.0f,   1.0f, 0.0f,
};

Per frame transform

glm::mat4 newTransform = glm::lookAt(glm::vec3(0), gCamera.position(), gCamera.up());
shaders->setUniform("camera", gCamera.matrix());
shaders->setUniform("model", newTransform);

In the vertex shader:

gl_Position = camera * model * vec4(vert, 1);

The object will track the camera if I move the camera up or down, but if I move the camera left/right (spin the camera around the object's y axis), it will rotate in the other direction so I end up seeing its front twice and its back twice as I rotate around it 360.

If I use -gCamera.up() instead, it would track the camera side to side, but spin the opposite direction when I move the camera up/down.

What am I doing wrong?


texts: Is linear filtering possible on depth textures in OpenGL?

texts:
I'm working on shadow maps in OpenGL (using C#).
First, I've created a framebuffer and attached a depth texture as follows:
// Generate the framebuffer.
var framebuffer = 0u;

glGenFramebuffers(1, &framebuffer);
glBindFramebuffer(GL_FRAMEBUFFER, framebuffer);

// Generate the depth texture.
var shadowMap = 0u;

glGenTextures(1, &shadowMap);
glBindTexture(GL_TEXTURE_2D, shadowMap);
glTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT24, 1024, 1024, 0, GL_DEPTH_COMPONENT, GL_FLOAT, null);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_TEXTURE_2D, shadowMap, 0);

// Set the read and draw buffers.
glDrawBuffer(GL_NONE);
glReadBuffer(GL_NONE);

Later (after rendering to the shadow map and preparing the main scene), I sample from the shadow map in a GLSL fragment shader as follows:
float shadow = texture(shadowMap, shadowCoords.xy).r;

Where vec3 shadowCoords is the coordinates of the fragment from the perspective of the global directional light source (the one used to create the shadow map). The result is shown below. As expected, shadow edges are jagged due to using GL_NEAREST filtering.

To improve smoothness, I tried replaced the shadow map's filtering with GL_LINEAR, but the results haven't changed. I understand there are other avenues I could take (like Percentage-Closer Filtering), but I'd like to answer this question first, if only for my sanity. I've also noticed that other texture parameters (like GL_CLAMP_TO_EDGE rather than GL_REPEAT for wrapping) don't function for the shadow map, which hints that this may be a limitation of depth textures in general.
To reiterate: Is linear filtering possible using depth textures in OpenGL?


texts: Framebuffer formats with enhanced Alpha precision

texts:
I render some lines with alpha values into an FBO. Because I play a lot with alpha, I need the alpha channel to have more detail than RGBA8. For example, RGBA32F works like a charm.

As I have only a Quadro GPU to test. Is there a general advice on which FBO format works best (in terms of speed) on most cards?

Would there be a benefit in using RGBA16F, RGBA16 etc.?
What formats
can I expect a GPU to support?
Is RGBA32F a regular feature for a
GPU    not older than 5 years?


texts: Having trouble setting a game object as a child of another. What is wrong here?

texts:
So I'm trying to raycast on mouse click if it hits any thing make that object a child of the sender (in this case the parent). Below is my code...

public class PhysGun : MonoBehaviour
{
    private GameObject Player;

    void Start ()
    {
       Player = GameObject.Find("Player");
    }

    // Update is called once per frame
    void Update ()
    {
        Vector3 fwd = transform.TransformDirection(Vector3.forward);

        if (Input.GetMouseButton(0) && Physics.Raycast(transform.position, fwd, 10))
        {
            //this.transform.parent = Player.transform;
            transform.SetParent(Player.transform);
            Debug.Log("There is something in front of the object!");
        }

   }
}

The script is attached to a child of the player and I will eventually attatch it to a motion control (Vive).

What am I doing wrong exactly? I've tried multiple ways to do this and none of them work (or present any errors). Also to clarify the issue it's not parenting the game object hit by the ray cast to the Player like I want it to.


texts:
Should one do additive blending (aka lightmapping) in linear space?

I tried doing it in linear space, and it became, well, linear and bland, losing that cool HDR-style bloomy effect. Is there some standard way to do additive blending in linear RGB, or additive blending is now an obsolete gamma space hack and people should forget about it?


texts: 2D Collision in JavaFX - Bad accuracy with .intersects()

texts:
I have several Shape objects - Circle, Rectangle and Polygon.

I use the built-in .intersects(Bounds1, Bounds2) method to detect collision but it's quite inaccurate.

Circle c1 = new Circle(20);
Bounds c1Bounds = c1.getBoundsInParent();
Rectangle r1 = new Rectangle(20,20);
Bounds r1Bounds = r1.getBoundsInParent();
... etc for other Shape objects

My collision code:

if (c1Bounds.intersects(r1Bounds) {
    //collision happened.
}

Why is the collision accuracy so bad and how can I improve it? The collision detection is REALLY bad for polygon objects. It is literally at least 50 pixels off.


texts:
I am creating a 3D level editor which should be used to generate the very basic layout (level geometry) and a few basic game-logic entities of maps used in my game. So far, I decided to use voxels (i have a fbx untextured model file and do NOT draw this myself via vertices etc. as I already found tutorials on that which are not suitable for me) as the way to create the level geometry and most of this works fine. The next step would be to implement code that allows me to texturize these cubes by specifically applying textures to faces.

Using something like the following Draw method I can apply a Texture2D to the whole voxel (so I am not able to chose the face to which I want to apply the texture) and this works fine for now (though I have sometime issues orienting it, which should not be part of this question)

public void Draw() {
    foreach(ModelMesh mesh in this.Model.Meshes) {
        foreach(ModelMeshPart part in mesh.MeshParts) {
            BasicEffect effect = (BasicEffect)part.Effect;

            effect.World = this.World;
            effect.View = Engine.View;
            effect.Projection = Engine.Projection;

            if(this.Texture != null) {
                // UNLIT textures
                effect.Texture = this.Texture;
                effect.TextureEnabled = true;
            } else
                // LIT placeholder voxel
                effect.EnableDefaultLighting();
        }
        mesh.Draw();
    }
}

I will have about 10 textures which I want to be able to apply programmatically on each face of the voxels - which approach would you suggest me to achieve the desired result?


texts: Are there any good UI widget toolkits for Pygame?

texts: Are there any good, modern widget toolkits for Pygame? I've looked at PGU, but it's apparently unmaintained.


texts: Collectible Card Game Card Text To Code Association

texts:
I am making a collectible card game using a command pattern for using card abilities and creating a class for each card text ability. The game is setup to work with an authoritative server structure. I have each cards stat values in a MySQL database. My question is what would be the best way to associate a cards text with the class that executes it?

For example, I have a Card class that pulls card stats from the database for the specific card. I would like to have an entry in the database for each card that determines what ability class the card has. Since, I'm limited to the basic data types in the database I'm trying to find the best way to associate a string or int to a class that executes the cards ability in my code.

My first solution is having each database entry for a card hold a string that holds the code for the class, and compiling that string on the fly. A second solution is having a giant switch statement class that associates each card name with the class of its ability. I feel like there should be a simpler way to get this accomplished though. Anyone have any insights? Thanks


texts: concerns about android apk compatibility

texts: Hi everyone =) i'm planning on making a game on Unity, the idea is that my friends could play the game, as mostly of them do not own a computer, it should be developed for android. Two of my biggest concerns are about the compatibility (we all have different versions of android) and about the final APK size. That being said, I don't have plans for it to be on play store (I know google does a thing that split one big apk into multiple APK that solve the compatibility/APK size issue). So the questions are: if i built it to be compatible with an older versions of android (android 6.0 as an example) will it be compatible with newer versions of it?


texts: Unity 5 - Textures look strange in Deferred Rendering

texts:
I've created an exterior terrain scene in Unity 5 which features lots of trees and grass but some textures look awful and I'm wondering why. Please see the attached image:

This texture problem is especially obvious at night (I'm using Time of Day unity asset for Day/Night cycle) but also during day light it doesn't look good. The tree bark looks like plastic and also the ground textures are too bright and lack contrast. Stone texture on the other hand look perfectly fine.

Can somebody point me into the right direction of what I'm doing wrong here with my lighting and rendering?


texts: Ray Tracing in One Weekend, how to add depth of field to view matrix?

texts:
I'm working through the infamous Ray Tracing in One Weekend book as I implement it on a OpenGL compute shader, the only thing I have left to do is add depth of field. I have this function that generates rays from a view and projection matrix, so its slightly different from the book where he does his own camera setup, here is my function:
Ray Camera_getRay(inout uvec4 useed) {
    float aperture = 0.1;
    float lens_radius = aperture / 2;
    vec3 rd = lens_radius * sampleUnitDisk(useed);

    vec3 rayNDC = vec3(
        ((2.0f * fragCoord.x) / iResolution.x - 1.0f),
        (1.0f - (2.0f * fragCoord.y) / iResolution.y),
        1.0f
    );

    vec4 rayClip = vec4( rayNDC.x, rayNDC.y * -1, -1.0f, 1.0f );

    vec4 rayCamera = inverse(projection) * rayClip;
    rayCamera.z = -1.0f, rayCamera.w = 0.0f;

    vec3 direction = normalize((inverse(view) * rayCamera).xyz);

    return Ray(position, direction);
}

I am trying to add the randomized offset as described in the Defocus Blur chapter.
I have gotten this far:
float aperture = 0.1;
float lens_radius = aperture / 2;
vec3 rd = lens_radius * sampleUnitDisk(useed);

But I am not sure what to do with rd next, do I simply add it to the ray's position? do I also need to add it to the ray direction? Do I alter the view matrix? Any help is appreciated.


texts: Java/Libgdx Pixel game with individual pixel changing

texts:
I am currently trying to make a game with pixelated graphics. The game is supposed to run with as few textures as possible. Instead of this it is supposed to generate the levels randomly, and fill in the pixels accordingly.

I would like to change pixels individually, since this way, I only can change the pixels that have to be changed, which seems to me to be the most efficient way.

What would be the fastest way in which I could achieve individual pixel updating/changing?

I have tried Pixmaps but they seem  to be very slow and in order to draw them as far as I could find you have to create a new texture from the pixmap for every frame.

Drawing each 'pixel' as a square texture also seems to be a very inefficient way.

Does java/Libgdx have a 'fast' way of doing this?

I also saw a lot of people in other Posts recommending to use bufferedimage from the Java2D library. However, I am not sure if this can be combined with Libgdx functions and textures, which I will need for some entities. As far as I could see it requires you to use a Java2D graphics window.

Can you still use some textures in java2D?


texts: On key press, spawn a collider where my player is facing?

texts:
I'm trying to create an attack mechanic to my player hero in my 2D Tower Defense game. When I press the Q button I want my hero to do an animation and spawn a temporary collider shaped as a cone at where the hero is looking at. If this collider collides with a GameObject called "Stone" it will decrease its hpValue with a script I made. If there is multiple Stones in the cone I want it to only effect one Stone, chosen either by random or/and closest to the hero.

How would I go about doing this and how can I detect the direction of where my hero is facing? This is my movement script:

public float speed;   //Movementspeed

Rigidbody2D rbody;

void Start () {

    rbody = GetComponentInChildren<Rigidbody2D> ();
    rbody.freezeRotation = true;
}

void FixedUpdate () {

    Vector2 movement_vector = new Vector2(Input.GetAxisRaw("Horizontal"), Input.GetAxisRaw("Vertical"));

    rbody.MovePosition (rbody.position + movement_vector * speed * Time.deltaTime);

}

A picture visualising what I mean:


texts: What is the point of this hard-coded vector when calculating luminance in glow/bloom effects?

texts:
I have looked at two different vertex shaders that calculate luminance and both use a "magic" vector that I'm not sure the meaning of the the actual values. For instance:

const mediump vec3 Perception = vec3(0.299, 0.587, 0.114);

void main(void)
{
    mediump vec3 color = texture2D(Sampler, TextureCoord).xyz;
    mediump float luminance = dot(Perception, color);
    gl_FragColor = (luminance > Threshold) ? vec4(color, 1) : vec4(0);
}

This was taken from the iPhone 3D programming book.

This perception vector is the magic vector I'm trying to figure out. I added the rgb/xyz values and the add to 1.

I saw another example that used vec3( 0.2125, 0.7154, 0.0721), which also adds to 1.

Can someone explain how one comes up with these values and what they really mean?


texts: Generate random numbers without repetitions

texts:
How to generate Random numbers without repeating any numbers in the given target like(1-5000) there should be no reparation and I should be able to get 5000 randomized numbers. I should be able to run the randomized as many times as the user wants,How to do with C#

For Sample
Target is (1-10)
No of times to run =2

First run:
5,4,6,8,3,1,2,0,7,10

second run
6,3,5,8,4,2,0,1,10,7

Like this I should be able to get the results as many times as I run..


texts: Player clips into the ground when I press the restart button

texts:
The title says it all. I have a subway surfers like game prototype, where I just added a restart button that can reload the scene. However whenever I press restart the charaters gets into a slightly lower position. After a few deaths the player is clipped into the ground and cannot jump at all.
I looked up so many similar questions, all about checking colliders and rigidbodies but I personally couldn't find anything. It also has to do something with my gravity and stuff. Because I have a gravity modifier that if I set to 1, this issue never happens. The problem is, that then the player jumps around like he is on the moon.
I also tried an experiment where I started my player from the air, not from the ground. And with every single restart the player fell faster and faster eventually falling trough the ground once again. So something can be with gravity.
This is what I have in the character controller. I wasn't satisfied with my physics and I wanted it to make a bit more interesting.
I tried readding colliders, putting the same scripts on brand new objects, checking on and off rigidbody options.
void Start()
    {
        playerRb = GetComponent<Rigidbody>();
        Physics.gravity *= gravityModifier;
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 xPos = new Vector3(xRange, 0, 0);
        if (Input.GetKeyDown(KeyCode.Space) && isOnGround)
        {
            playerRb.AddForce(Vector3.up * jumpForce, ForceMode.Impulse);
            isOnGround = false;
        }


texts: Collision detection problem in XNA4/Monogame

texts:
I have been trying to get 3D collision detection working for a while and I think (hope) you people can help me.

For my project I have created a 'sprite3d' kinda class which is called ModelEntity and there there is a function that is called intersects.

intersects gets another ModelEntity as a parameter.

 public bool intersects(ModelEntity entity)
    {
        BoundingSphere bs1 = CreateBoundingSphereForModel();
        BoundingSphere bs2 = entity.CreateBoundingSphereForModel();

        bs1.Center += position;
        bs2.Center +=entity.position;

        if (bs1.Intersects(bs2))
            return true;

        return false;
    }

public BoundingSphere CreateBoundingSphereForModel()
    {
        Matrix[] boneTransforms = new Matrix[this.model.Bones.Count];
        this.model.CopyAbsoluteBoneTransformsTo(boneTransforms);

        BoundingSphere boundingSphere = new BoundingSphere();
        BoundingSphere meshSphere;

        for (int i = 0; i < model.Meshes.Count; i++)
        {
            meshSphere = model.Meshes[i].BoundingSphere.Transform(boneTransforms[i]);
            boundingSphere = BoundingSphere.CreateMerged(boundingSphere, meshSphere);
        }
        return boundingSphere.Transform(getWorld());
    }

public Matrix getWorld()
    {
        return  Matrix.CreateTranslation(position) * Matrix.CreateRotationY(rotation.Y) * Matrix.CreateRotationZ(rotation.Z) * Matrix.CreateRotationX(rotation.X) ;
    }

Those are the main parts of the collision in the ModelEntity class and the place where I check collision is in the PlayState class

if (model.intersects(player) || player.intersects(model1))
        {
            cam.returnToLastPosition();
        }

cam.returnToLastPosition() is just returning the camera to the last place it has been so you can't pass through the model.

In the update loop, I set the player's position to the camera position (I have created a first person camera class which takes care of mouse and keyboard movement).

If you want to see the draw function:

public void draw(FirstPersonCamera cam)
        {
            Matrix[] transforms = new Matrix[model.Bones.Count];
            model.CopyAbsoluteBoneTransformsTo(transforms);
            foreach (ModelMesh mesh in model.Meshes)
            {
                foreach (BasicEffect effect in mesh.Effects)
                {
                    effect.EnableDefaultLighting();
                    effect.World =  transforms[mesh.ParentBone.Index] * getWorld();
                    effect.View = cam.getView();
                    effect.Projection = cam.projection;

                }
                mesh.Draw();
            }
        }

NOTE// in the intersects function I have tried to remove the part of

bs1.Center += position;
bs2.Center +=entity.position;

but it does not work anyways.


texts:
I'm using pyglet for game development, and sometimes encounter "bus errors". They are not consistently repeatable, and whenever I try to do simple debugging (eg move/remove variables, etc), the errors will eventually disappear entirely. I feel like I am encountering the notorious "heisenbug" class of errors.

Intuitively, I feel like the problem is likely due to pyglet/opengl/video card interaction, but of course this is only a hunch. So my question is: how do I debug this kind of problem?


texts: Using pixel art on small high resolution screens

texts:
I'm making a game and I would like to utilize pixel art as my style. But I faced a problem, modern displays on my target platform (iOS) have extremely high resolution.
So if my artist makes me some sprites in 1 to 1 pixel resolution, each character sprite will look like 2x3 millimeters, and that's not what I want.

How do I fix this problem? Do i just use 4 pixel blocks as 1 pixel in my art, or there is some other way?

Another question, is how do I utilize high-crisp display of those devices with pixel art?

How do I go with using images on older devices? Do I have to make double assets or downscale/upscale some images?


texts: Basic pseudocode to create a rope physics

texts:
I am trying to simulate the physics of a 2D hanging rope, consistent of a series of n-links. It could be a series of four pendulums. I just want some movement of the rope and the ability to contact with the ground. I was inspired by this question and this one.

I would like to programme it from zero in Python or a similar modelling program, but I don't find simple maths to recreate this effects. Which are the basic equations to escalate a series of n-links to resemble like a rope, please?


texts: How do you activate multisampling in OpenGL ES on the iPhone?

texts: I'm experimenting w/ improving the "resolution" of an OpenGL ES based app.  Apple mentions here (developer.apple.com) that OpenGL ES in iOS 4 supports multisampling... and this can improve the graphics somewhat.  How do you enable multisampling?


texts:
I'm trying to visualize a simple Hanoi solver that uses an algorithm, and I'm swapping elements on array to visualize it.
Here's my code:
        let A = [];
        let B = [];
        let C = [];
        let moveCount = 0;
        let once = true;
        hanoi(3, A, C, B);
// 3, how many disk
// A C B are rods
        alert(A + '.\n' + B + '.\n' + C + '.')

        function hanoi(n, start, target, other)
        {
            if (once)
            {
                once = false;
                for (var i = 1; i <= n; i--)
                {
                    start.push(i);
                }
            }

            if (n <= 1)
            {
                let temp = start[n-1];
                start[n-1] = target[target.length];
                start = start.filter(Boolean)
                target[target.length] = temp;
                target = target.filter(Boolean);
                //console.log('Moving disk '+n+' from rod '+start+' to '+target+' rod');
                moveCount++;
            }
            else
            {
                hanoi(n-1, start, other, target);

                let temp = start[n-1];
                start[n-1] = target[target.length];
                start = start.filter(Boolean)
                target[target.length] = temp;
                target = target.filter(Boolean);
                //console.log('Moving disk '+n+' from rod '+start+' to rod '+target);
                moveCount++;

                hanoi(n-1, other, target, start);
            }
        }

The C value should be expected [3, 2, 1] but only shows 2. I also checked A and B and 1 is nowhere to be found
How do I make this properly so the output would be [3, 2, 1]
Imagine 3 is the largest disk and so on...


texts: My GML object doesn't want to inherit variables

texts:
here's the error that I can't seem to get rid of.

FATAL ERROR in
action number 1
of  Step Event0
for object side2_obj3:
Variable side2_obj3.sidePick2(100004, -2147483648) not set before reading it.
at gml_Object_side2_obj3_StepNormalEvent_1 (line 1) - if (sidePick2 == 1)

this object is inheriting from an object that holds the variables sidePick1 and sidePick2. I stripped the level down to just the object to see if this was being caused by a code collision and the issue seems to be persisting.
EDIT
I gave tried calling the following function
Event_inherited ()

And it didn't work


texts:
I was wondering how one would go about duplicating the same sprite in SFML, instead of having to create new sprites every time I would want have another sprite of the same image. Just some basic thought process or pseudo-code is what I'm looking for.

Thanks.


texts:
I had originally asked this on the Cryengine forums but I received no replies. I know stackexchange to be a much better community.

I am just starting out with Cryengine 5 and created my first blank C++ project. However the documentation is just a little lacking currently and I want to know the ins and outs of what has been generated for me. If there are other forum posts or specific pages in the documentation that I should be looking at but must have overlooked I'd appreciate the links.

I can very easily find documentation on the structure of the engine code. Well at least I think that is what this page refers to. But I'm more concerned with the structure for a new game project.

As far as I am aware the default template contains a single level but I don't know much more than this. Here are a list of questions that I have regarding what has been generated when I created a new project:

What is rcjob_all.xml?
What does MakeAssets.bat actually do?
Game.bat, Editor.bat and Code_CPP.bat launch the Game, Editor, and Visual Studio respectively? What else are these scripts doing?
What is the difference between the GameDll and Solutions folder under code? Where should I put my custom code? For example custom flowgraph nodes.
How is the Assets folder structured? What are entities, libs, scripts, textures/cubemaps/example and how are these related to what I see within the editor?
What is game.cfg?
The Assets folder contains Textures.pak. What is the difference between this and the terraintexture.pak within Assets/levels/example?
What am I safe to remove so that I have the bare minimum project possible? I want to remove as much cruft as possible (inc. code)

What I am aiming for here is the most basic project possible without removing common functionality i.e. player movement, game startup and rules, etc... so that I may build upon this a new level and not have unused/unnecessary files floating around.


texts: Handling scripted and "native" components in a component-based entity system

texts:
I'm currently trying to implement a component-based entity system, where an entity is basically just an ID and some helper methods tying a bunch of components together to form a game object. Some goals of that include:

Components only contain state (e.g. position, health, ammo count) => logic goes into "systems", which process these components and their state (e.g. PhysicsSystem, RenderSystem, etc.)
I want to implement components and systems both in pure C# and through scripting (Lua). Basically I want to be able to define completely new components and systems directly in Lua without having to recompile my C# source.

Now I'm looking for ideas on how to handle this efficiently und consistently, so I don't need to use different syntax to access C# components or Lua components, for example.

My current approach would be to implement C# components using regular, public properties, probably decorated with some attributes telling the editor about default values and stuff. Then I'd have a C# class "ScriptComponent", which just wraps a Lua table internally with this table being created by a script and holding all the state of that particular component type. I don't really want to access that state much from the C# side, as I wouldn't know at compile time, what ScriptComponents with what properties would be available to me. Still, the editor will need to access that, but a simple interface like the following should suffice:

public ScriptComponent : IComponent
{
    public T GetProperty<T>(string propertyName) {..}
    public void SetProperty<T>(string propertyName, T value) {..}
}

This would simply access the Lua table and set and retrieve those properties from Lua and it could easily be included in the pure C# components as well (but use the regular C# properties then, through reflection or something). This would only be used in the editor, not by regular game code, so performance isn't as important here. It would make it necessary to generate or handwrite some component descriptions documenting what properties a certain component type actually offers, but that wouldn't be a huge issue and could be sufficiently automated.

However, how to access components from the Lua side? If I make a call to something like getComponentsFromEntity(ENTITY_ID) I'll probably just get a bunch of native C# components, including "ScriptComponent", as userdata. Accessing the values from the wrapped Lua table would result in me calling the GetProperty<T>(..) method instead of accessing the properties directly, like with the other C# components.

Maybe write a special getComponentsFromEntity() method only to be called from Lua, which returns all the native C# components as userdata, except for "ScriptComponent", where it'll return the wrapped table instead. But there'll be other component-related methods and I don't really want to duplicate all these methods both for being called from C# code or from Lua script.

The ultimate goal would be to handle all types of components the same, with no special case syntax differentiating between native components and Lua components - especially from the Lua side. E.g. I'd like to be able to write a Lua script like that:

entity = getEntity(1);
nativeComponent = getComponent(entity, "SomeNativeComponent")
scriptComponent = getComponent(entity, "SomeScriptComponent")

nativeComponent.NativeProperty = 5
scriptComponent.ScriptedProperty = 3

The script shouldn't care what kind of component it actually got and I'd like to use the same methods I'd use from the C# side to retrieve, add or remove components.

Maybe there are some sample implementations of integrating scripting with entity systems like that?


texts:
I'm making a game in Pygame and I want to be able to target enemy unit.
I made it so when I click on them a variable "targeted" becomes true, and stays true until I click somewhere else on the screen. I also want targeted units to have a small green circle around them, so I made it in GEDIT. I have made a function that draws everything on the screen (the background, the player, objects, etc) and in the part where it draws the units it checks if the variable "targeted" is true and if  it is it should move that little green circle over the enemy units.

here is the code that does that:

screen.blit(enemy_unit.pic, enemy_unit.rect) #draw the unit

if enemy_unit.targeted == True: #if the unit has been targeted then draw a circle over it
    target_rect.move_ip(enemy_unit.pos)  #move the circle to the unit
    target_rect.fit(enemy_unit.rect)     #there are some bigger units and some smaller ones, so we have to "scale" the circle
    screen.blit(target_pic, target_rect) #actually draw the circle

This doesn't work, when I target the unit the circle just appears for a 1/5 of second next (not on, but just next) to the unit and then disappears. I am sure that I am keeping a good track of "enemy_unit.pos" because I tested it (I added a piece of code that would print one units position and mouse's position every time i clicked the mouse and when i was near him the numbers were same).

If you could give me a hint about what I'm doing wrong. I think its in move_ip function, but I tried just move and it didn't work either (the circle didn't even show at all)!


texts:
So, I often see assets being packaged in some sort of custom container format.

World of Warcraft uses a bunch of files called "data.xxx" where xxx is a number (but they used something like MPQ files in the past. Not sure about the extension).

Warhammer Online used MYP files.

GW2 just had a giant .dat file (I think) with literally everything in it. Like, the whole game is one executable and then a giant file and that's it.

But is there a benefit apart from encryption? The only thing I can think of is that I can give assets something like an identifier which the engine then looks up in some sort of index that contains size and offset and then it reads from a giant file.

A few examples: I load texture "skybox-dessert-world" and it loads the texture. I don't have to worry about the format or the path. I just convert to the format I want in my packager.

Maybe something that makes more sense: I reference textures and height maps in my terrain file format. Using identifiers, I can reduce the length of the file name. Especially if I'd have to use the same texture file multiple times.

Or maybe something like this: I have multiple version of a model for discrete level of detail and just loading "model-npc-elf-male" would load the appropriate models.

But is that worth it? Or am I making a big deal out of nothing and loading files straight from disk is just as good? I've heard it's a good thing in the context of encryption and compression but that's about it.


texts:
It is general wisdom that you redraw the entire viewport on each frame.

I would like to use partial updates; what are the various ways can do that, and what are their pros, cons and relative performance?

(Using textures, FBOs, the accumulator buffer, any kind of scissors that can affect swapbuffers etc?)

A scenario: a scene with a fair few thousand visible trees; although the textures are mipmapped and they are drawn via VBOs roughly front-to-back with so on, its still a lot of polys.  Would streaming a single screen-sized texture be better than throwing them at the screen every frame?  You'd have to redraw and recapture them only on camera movement or as often as your wind model updates or whatever, which need not be every frame.


texts: Removing the billing permision from a apk build in unity

texts: So recently we made a version of our game that is paid and not free. This of course means that we removed both ads and IAP capabilities. Now I'm sure that I have removed every single peice of code that references ads or IAP from scripts that get built into the apk but Unity still keeps adding the billing permision to the manifest. Apart from exporting a google android project and then modifying the manifest and then buidilng to apk what other options do I have to solve this ?


texts: Is there a way to do this in pixel shader 2.0/3.0?  I've got on or off transparency so when the mipmapping level is different the transparency can take up too much of the texture and make it invisible.  Or is there a way to manually create the mip maps in XNA 4.0?


texts: make a sphere rolling on a roulette mesh stop at predetermined place

texts:
I have a roulette and a ball(sphere) placed on it. When the game begins the roulette spins. The spinning of the roulette and gravitational forces on the ball makes it roll along the 3d roulette mesh.

Now , in this roulette game of mine I have slots from 00 to 36. I want to make sure that after the roulette stops spinning the ball comes and stops rolling at my predetermined slot.

For example : if i set the target slot as 25 in the game, every time the roulette spins, the ball moves realistically along with it BUT comes slowly to a stop at slot no: 25.

I have tried 'slerp' the ball to its target position, but the realism is lost. The ball moves through the mesh. Which i don't want. I want the ball to roll like in real life.


texts:
Can you bring in external music such as mp3s?  If so, how?  I didn't see anything about this in the wiki Bethesda released.

Also how does this work with regards to the Steam Workshop?  Don't imagine they would appreciate uploading copyrighted content.  I don't particularly care about making a public mod, I just want to screw around privately and create dungeons/towns using music from some of my favorite games.

Thanks.


texts: Generating multiple instances of one opengl object with random coordinates

texts:
Sorry if the question is dumb but my brain just cannot solve it for some reason..

So I've made one opengl object public static Square ball = new Square(75,75);

And I am trying to make it so that every so often a new ball appears on the screen

public void Loop(GL10 gl) {
    gl.glClear(GL10.GL_COLOR_BUFFER_BIT | GL10.GL_DEPTH_BUFFER_BIT);
    gl.glLoadIdentity();
    long timeSinceStart = SystemClock.uptimeMillis();
    long deltaTime = timeSinceStart - oldTimeSinceStart;
    oldTimeSinceStart = timeSinceStart;
    if(deltaTime >= 15) {
        RandBall(gl);
    }}

code for RandBall()

   `public void RandBall(GL10 gl) {
     gl.glPushMatrix();
         gl.glTranslatef(rand.nextInt((1280 - 0) + 1) + 0,
                         rand.nextInt((720 - 0) + 1) + 0, 0);
         getBall().draw(gl);
     gl.glPopMatrix();
}`

but when I run the code it draws only one object and constantly changes its coordinates. How do I make it so that it draws multiple objects with different random coordinates? The solution is probably going to be an easy one but I just can't see it :/


texts: From 3d rotation, snap to nearest 90 directions

texts:
I have a 4x4 transformation matrix, made only from successive rotations and translations, and I'd like to "snap" my object to the "nearest" of the 24 orthogonal (multiples of 90 degree) rotations.

I'm not sure how to think of the problem. Round each element of the upper 3x3 matrix to -1, 0, and +1 (cutting at .707)? I am pretty sure that would be too good to be true. Another possibility would be to convert to axis-and-rotation or quaternion, but would that make it simpler somehow? I'm not fluent in those manipulations.

Any guidance most welcome!


texts: Can't get AABB Collision to work properly

texts:
This is the code I'm using to resolve collisions on the players left side. It works when I'm on the ground, but if I'm falling, it does not work.

public static boolean onWall(Rectangle rect1, Rectangle rect2){

    if(rect1.x > rect2.x && rect1.x <= rect2.x + rect2.width && ((rect1.y > rect2.y && rect1.y < rect2.y + rect2.height) || rect1.y + rect1.height > rect2.y && rect1.y + rect1.height < rect2.y + rect2.height)){
        rect1.x = rect2.x + rect2.width;
        return true;
    }

    return false;

}


texts: Finding the side of a shape a ray intersects

texts:
For some simple 3D shapes (cubes, prisms) how can I determine which side a ray intersects, knowing the direction of the ray, and the normals of the shapes' sides.

I thought of using plane intersection for each side, but I'm sure there's a more efficient way.

Also, could this be done for a cylinder?


texts: Fundamental physics component(s) in component-based game engine

texts:
What are the "smallest" physics components in your component-based game engine?

Would it make sense to create something like Positionable, Rotatable, Movable, Collidable and combine them the way you want or is it better to use one unified component like PhysicsInteractable?


texts: HLSL Shader Optimilation with MAD(m,a,d)

texts: I understand that the expression x = m*a+d is most efficiently written as x = mad(m,a,d) because at the assembly level only one instruction is needed rather than a multiply and add separately. My question regards optimally writing this expression: x += m*a. Should this be written as x = mad(m,a,x) or x += m*a? The difference is too subtle to profile but I'm wondering if anyone can see the difference at the assembly level. (I don't know how to view the assembly code.)


texts: A* pathfinding for dynamic obstacles and player made blockages?

texts:
Hi I'm creating a TD in Unity 5 and need some help with my Pathfinding.

I'm going to use Arons A* pathfinding for my AI which enables me to use dynamic objects and update the path during run-time. However in my game I want the player to be able to block the minions with special turrets which will force the minions to attack the "block tower" instead to get past to their destination.

How could I accomplish something like this?

Image for more clarity:


texts: Generate complex (non-convex) polyhedron UV mapping

texts:
I need to find an approach to the problem of generating texture maps for non-convex polyhedrons without using a design tool like Maya. Specifically, I am mapping simulation results data onto a 3D surface, and I need to write code which generates the maps. My target platform is WPF, but I'm aware that this computation problem is wider than that.

One generic approach (in WPF) uses a gradient color brush as an overall texture to just map colors, but if the facets in the polyhedron are very narrow or the mapped (u,v) coordinates are very far apart on the same facet, the image gets noisy. Another approach employs Phong or Gouraud Shading, but those features are missing in some 3D libraries which favor texturing over specifying colors at each vertex. So, I'm looking for a way to get a good texture map generated.

What (specific) articles or books would contain descriptions of such an algorithm? If it helps in identifying a correct algorithm, all of the surfaces entirely enclose a 3-D space, there is no facet normal data, and I'll be able to identify a "parting line" which segregates one part of the surface from the other, as one might in order to create a mold for the shape.


texts: How do you choose the right price of items in your games?

texts: I have a game in which the player earns money for wining races and, then, he can spend that money to unlock new levels or to improve his vehicle. Now, I am choosing the money you earn and the prices of things without a clear criteria, I just test them and see if it feels right... Do you think there is a better way? How do you do it?


texts: Cascade(Waterfalls) particles animation - openframeworks, alternatives

texts:
Has anyone tried to create a waterfall particles animation using openframeworks? Is it possible? Is it good?

If not, can you recommend any other frameworks for easier creation of cascade animation?

Thanks a LOT!


texts: Object pooling of different tpyes of agents (Mobile Game) in Unity

texts:
The mobile game I am developing consists of one to four players and different agents that are being spawned and act in their own way. All those Agents (Car, Animal and Powerup) derive from the same base class 'Agent' which in turn has a field called 'rank' which represents something like 'low', 'medium' and 'high'.
So an agent with rank 'high' will look and behave different than one being tagged 'low'.

The thing is - the 'rank' of the agent is determined at random. The max count of agents active simultaneously is known but this number is not in regard to their 'rank'. When objectpooling, this would lead to the follwing case:

There's a max agent count of, say, 6. This would require 6 instances of each agent with rank 'low' to 'high' to be created, altough some of those instances would never even be used.

So my idea was to create only 6 gameobjects holding the components that each agent requires and use reflection to set the components fields according to the type. The problem is that some compoents which are unique to rank and type would need to be added and removed at runtime.

What solution would be better in terms of runtime and memory performance?


texts: Create a rectangle struct to be rotated and have a .Intersects() function

texts:
In my XNA program, I am trying to swing a sword. The sword starts at an angle of 180 degrees, then rotates (clockwise) to an angle of 90 degrees.

The Rectangle struct that XNA provides,

Rectangle mAttackBox = new Rectangle(int x, int y, int width, int height);

However, this struct has two problems:

Holds position and size in Integers, not Floats
Cannot be rotated

I was hoping someone could help me in either telling me that i'm wrong and the Rectangle can be used for both these methods, or can lead me down the right path for rotating a rectangle.

I know how to create a Struct. I believe that I can make methods like classes. I can determine the 4 vertices of a 2D rectangle by calculating out the x,y of the other 3 given the length, width.
I'm sure theres a Matrix class I can use to multiply each point against a Rotation matrix.

But once i have my 4 vertices, I got two other problems:

How do I test other rectangles against it? How does .Intersects() work for the rectangle struct?
Is this even the fastest way to do it? I'd be constantly doing matrix multiplication, wouldnt that slow things down?


texts: XNA games freeze when loading too much content

texts:
We are experiencing freezes in our XNA games. The last played sound loops and the computer completely freezes. It does not even respond to ctrl-alt-del. It mostly happens when running fullscreen, but has been known to occur in windowed mode as well.

We reduced the total size of game content by using the DxtCompressed texture format for most of the sprites. We now have almost no freezes anymore, however it still locks up once in a while.

The boundary for too much content seems arbitrary and dependent on memory use of other programs. How can we avoid freezes or detect whether we are loading too much content at once?


texts: Why Are Some Foreign Characters Not Displaying Properly

texts: I am localizing a game for the first time and I'm noticing some characters are not displaying properly. Most are fine but there is a small handful that are not correct. For example on a loading screen I display the word Loading. In German I'm displaying Lädt. The ä character is not displayed as ä, instead isn't displayed as shown in the image. I'm running in a standalone game. I packaged a development build to see if the problem was there too but it seem localizing is not working when I package it but I can tackle that problem later unless there is a known issues with this. To change languages I am calling Set Current Culture in blueprints.


texts: How do fps games do ironsights for weapons

texts: How do games like Call of Duty, Battlefield and Wolfenstein: the New Order do their ironsights? Do they just align the model or is it an image?


texts: UnityTeams: Files to publish but no Upload button

texts:
I am using Unity 2019.2.14f1 to build a game.

As I am working with a team, we have decided to use Unity Teams for the collaboration.

The project escalated and we ended up having to architecture a different project structure, directories and files.

Due to that, I created standard folders, deleted others, moved files.

Changes were made, the project was saved and now I see the blue icon in the majority of folders and lots of items in the Project Folder.

If I look at the Collab button on the top right corner of the screen and hover the mouse it appears the message:

  You have files to publish

However, if I press the button, even though it shows the blue icon, that shows that I have files to upload, it appears:

  You are up to date!

This is the first time I saw this problem.

I have done some changes to one of the scenes to see if the problem disappeared, however it persists.

I have been waiting for quite some time now, and decided to ask you for some guidance.

Everything is fine with the network connection.

In this particular situation, the log system that will appear when I upload the files is going to be huge. Is this be the reason behind the problem? What shall I do to solve this?


texts: Unity Rotations Not Following Local Nor Global Axis?

texts: In the gif below, you can see that rotating on X moves all 3 axis including the X axis. It's possible it's rotating on the global X rather than local X (hard to tell). But Y looks more like it's rotating on global Z and Z is quite clearly rotating on local Z. What is going on? Why is there no consistency?


texts: How do I translate a spherical coordinate to a Cartesian one?

texts:
Could someone point me in the right direction as to how this might be achieved? 3D math / geometry often throws me.

I'm looking for something like this (ideally in C#):

public Vector3 getCartesianFor(float elevation, float asimuth, float polar)
{
   return ????;
}


texts: Two reflective surfaces facing each other in openGL

texts:
How do I render 2 reflective surfaces, Example a mirror, face each other? To render a single surface I would use a cube map by rendering from the object on six directions.

But to render 2 surfaces it is becoming a paradox on which one to render first! Can anyone gimme a spark?

https://learnopengl.com/#!Advanced-OpenGL/Cubemaps

I used this tutorial


texts: physics of 2D car racing game with heightmap

texts:
I want to develop a simple car racing game where the road is defined by a heightmap. It looks basically like this:

The player can use throttle and brake to control the car.

I'm wondering what the best approach for the physics is. I have some ideas:

Use a mass-spring system with one mass for each wheel.

Pro: Gravity affects each wheel independly, so if one wheel stands on ground and the other one floats in the air, the car rotates. Can be extended to three dimensions by adding two more wheels.

Contra: The distance between the weels varies. The system may explode (when forces amplify each other). The car will fall down if both wheels float, but the middle of the car touches ground.
Define the car's state using position, momentum, rotation and spin.

Pro: The wheel distance is constant, no springs included

Contra: very complex, hard to compute, not really extensible to a third dimension

I think there must be a better way than those.


texts: How to detect if I click on an object (2D) using Raycast?

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

Thank you!


texts:
I really want to get into game development and one day be able to make simple games that are enjoyable to play. I have very little experience in coding/designing. I would appretiate any help :)
Thanks!


texts:
I am trying to render some trees with instancing. This is rather weird, but before sleeping yesterday night, I checked the code, and it was in a running state, when I got up this morning, it is crashing when I am calling glVertexAttribDivisor I haven't changed any code since yesterday.

Here is how I am sending data to GPU for instancing.

    glGenBuffers(1, &iVBO);
    glBindBuffer(GL_ARRAY_BUFFER, iVBO);
    glBufferData(GL_ARRAY_BUFFER, (ml_instance->i_positions.size()*sizeof(glm::vec4)) , NULL, GL_STATIC_DRAW);
    glBufferSubData(GL_ARRAY_BUFFER, 0, (ml_instance->i_positions.size()*sizeof(glm::vec4)), &ml_instance->i_positions[0]);

And then in vertex specification--

    glBindBuffer(GL_ARRAY_BUFFER, iVBO);
    glVertexAttribPointer(i_positions, 4, GL_FLOAT, GL_FALSE, 0, 0);
    glEnableVertexAttribArray(i_positions);
    glVertexAttribDivisor(i_positions,1); // **THIS IS WHERE THE PROGRAM CRASHES**

    glDrawElementsInstanced(GL_TRIANGLES, indices.size(), GL_UNSIGNED_INT, 0,TREES_INSTANCE_COUNT);

I have checked ml_instance->i_positions, it has all the data that needs to render.

I have checked the value of i_positions in vertex shader, it is the same as whatever I have defined there.

I am little out of ideas here, everything looks pretty much fine. What am I missing?


texts: Why can't i change the background color in Phaser?

texts:
what is wrong with my code? i'm using game.stage.backgroundColor but the screen remains black.

main.js:

var demo = demo || {};

demo.game = new Phaser.Game(window.innerWidth, window.innerHeight, Phaser.AUTO, '');

demo.game.state.add('state1', demo.state1);
demo.game.state.add('state2', demo.state2);

demo.game.state.start('state1');

state1.js:

var demo = demo || {};

demo.state1 = function() {};

demo.state1.prototype = {
    preload: function() {

    },
    create: function() {
        game.stage.backgroundColor = "#4488AA";
    },
    update: function() {

    }
};


texts: Libgdx , how to get mouse position relative to a Tiled Map

texts:
I'm porting a game that i did for Ludum Dare 26, this year, i made it using Contruct2, i decided to port it to Libgdx, for learning reasons,

http://www.ludumdare.com/compo/ludum-dare-26/?action=preview&uid=15150  (check the web version)

My problem is that the Player moves base on the Angle, where the mouse is pointing at,
in Contruct2, they have a really nice function called

setAngleToward(Mouse.X,Mouse.Y)

in libGdx i made this function

@Override
public boolean mouseMoved(int screenX, int screenY) {

    Vector2 centerPosition = new Vector2((float)Gdx.graphics.getWidth() / 2, (float)Gdx.graphics.getHeight() / 2);
//  Vector2 centerPosition = new Vector2(getX(), getY());

    screenY = Gdx.graphics.getHeight() - screenY ; //Inverse the Y

        Vector2 mouseLoc = new Vector2(screenX, screenY);

        Vector2 direction = mouseLoc.sub(centerPosition);
        float mouseAngle  = direction.angle();/*(float)(Math. atan2(direction.y, direction.x)); */
        setRotation(mouseAngle);

        return true;
}

which works nice, but when i reach the corners on the maps, it give me the wrong angles, because the Player is not centered anymore,

I know the solution is just use "centerPosition" with the player coords, and use
"mouseLoc" with the mouse coords but needs to be relative to the tiled map, and that's my problem i don't know how to get those paramenters , screenX and screenY, are the mouse location but base on screen position

im using OrthographicCamera and OrthogonalTiledMapRenderer

i hope can understand my problem, this is the jar i have right now

https://dl.dropboxusercontent.com/u/2553973/Others/zombiesblocksattack.jar


texts: Unity 4.6 UI button AddListener sets the same callback to all items in List

texts:
I have this method that is looping through a list and sets values on the current item in the list. Everything works fine the lists values are correct exept the AddListener. All listeners on the elements are the exact same as the last element! I have no clue where to go from here. Why is all values working exept the callback? Can anyone explain this to me please.
Thanks in advance

void PopulateList() {
        foreach (var item in itemList) {
            GameObject newButton = Instantiate(sampleButton) as GameObject;
            SampleButton button = newButton.GetComponent<SampleButton>();
            button.playerLabel.text = item.PlayerName;
            button.opponentLabel.text = item.opponentName;
            //sampleButton.myTurn.SetActive(item.MyTurn);
            button.myTurn = item.MyTurn;
            button.button.onClick.RemoveAllListeners();
            button.button.onClick.AddListener(() => test(item.callbackText)); // item.callbackText is just a a string
            button.playerTurnLabel.text = item.PlayerTurnText;
            newButton.transform.SetParent (contentPanel); // sets parent of button
        }
    }

void test(string whatever) {
        Debug.Log(whatever);
    }

public class SampleButton : MonoBehaviour {

    public Button button;
    public Text playerLabel;
    public Text playerPoints;
    public Text opponentLabel;
    public Text opponentPoints;
    public bool myTurn;
    public Text playerTurnLabel;

}


texts: Unity Physics Trouble with Platform Objects

texts:
Hi Game Development Community!
I'm new to designing in unity, and I'm having some issues with my player game object traveling through platform game objects. Several of my game objects (pink in pictured) are successfully acting as a surface for the ball (purple). But others (cylinders in white) are not. The ball goes straight through them. Yet I'm not seeing a difference in the cylinder and cube's physics settings I've set. Any advice or solutions to this problem are much appreciated!