texts: Faces on 3D model not rendering in the correct

texts:
I seem to be having trouble with rendering models in monogame. I'm trying to draw several cubes, in a minecraft style world. It's a simple .obj file, nothing special. But... for whatever reason, both the top and the bottom are rendering over the sides, as can be seen here in these four cubes.

My code is simple as can be, so I can't imagine the problem is directly the fault of this:

public static void DrawModel(Model model, Matrix modelspace, Texture2D texture)
    {

        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {

                //effect.EnableDefaultLighting();
                effect.TextureEnabled = true;
                effect.Texture = texture;
                effect.World = modelspace;
                effect.View = Cameraworks.ActiveCamera.View;
                effect.Projection = Cameraworks.ActiveCamera.Projection;
            }

            mesh.Draw();
        }

    }

How do I fix this?


texts: What is the best way to avoid colorblind issues?

texts:
About 5-10% of males have some form of colorblindness.  What's the best way to ensure you are not turning away 5-10% of your male population from your game?

Just to note colorblindness does not mean people see in black and white.  It usually means they see less green and get red/green confused easily.  Colorblindness comes in degrees.  Some forms are mild some are extreme.


texts:
My game features a top down camera that follows the player as he moves via virtual joystick on a cellphone screen. I want the movement of the player to always walk forward and the direction will be the only thing varying, thus allowing the character to move around the level. I currently have two scripts, the first one is the user's input on the virtual joystick which returns two floats. This values are used in the second script which is character controller. Right now the character moves yet it won't rotate to face the direction where the joystick is moving, when I try to apply rotation to the character the movement just goes crazy. Here are the two scripts. What fix can I use to achieve the desired movement?.

    public class Joystick : MonoBehaviour, IDragHandler, IPointerUpHandler, IPointerDownHandler{
    private Animator anim;
    private CharacterController controller;
    public float speed = 6.0F;
    public float turnSpeed = 60.0f;
    private Vector3 moveDirection = Vector3.zero;
    public Joystick inputJoystick;
    private float horizontal = 0.0f;
    private float vertical = 0.0f;

    void Start()
    {
        controller = GetComponent<CharacterController>();
        anim = gameObject.GetComponentInChildren<Animator>();
    }

    void Update()
    {

        horizontal = inputJoystick.horizontal();
        vertical = inputJoystick.vertical();

        moveDirection = new Vector3(horizontal, 0, vertical);
        moveDirection = transform.TransformDirection(moveDirection);
        moveDirection *= speed;

        controller.Move(moveDirection * Time.deltaTime);

        //transform.Rotate(0,turnSpeed * horizontal * Time.deltaTime,0);
 }

.

    public class Joystick : MonoBehaviour, IDragHandler, IPointerUpHandler, IPointerDownHandler{

    public Image back;
    public Image front;
    private Vector3 inputVector;

    public virtual void OnDrag(PointerEventData data)
    {
        Vector2 position;
        if (RectTransformUtility.ScreenPointToLocalPointInRectangle(back.rectTransform, data.position, data.pressEventCamera, out position))
        {
            position.x = (position.x / back.rectTransform.sizeDelta.x);
            position.y = (position.y / back.rectTransform.sizeDelta.y);

            inputVector = new Vector3(position.x * 2 + 1, 0, position.y * 2 - 1);
            inputVector = (inputVector.magnitude > 1.0f) ? inputVector.normalized : inputVector;

            front.rectTransform.anchoredPosition = new Vector3(inputVector.x * (back.rectTransform.sizeDelta.x / 2), inputVector.z * (back.rectTransform.sizeDelta.y / 2));

        }
    }
    public virtual void OnPointerDown(PointerEventData data)
    {
        OnDrag(data);
    }

    public virtual void OnPointerUp(PointerEventData data)
    {
        inputVector = Vector3.zero;
        front.rectTransform.anchoredPosition = Vector3.zero;
    }

    public float horizontal()
    {
        return inputVector.x;
    }

    public float vertical()
    {
        return inputVector.z;
    }
}


texts:
My AudioClip is lagging when I play it in Unity3d. The AudioClip is supposed to play when you left-click inside the game window.

Steps I've tried for fixing it:

Uncompressing the .wav sound file.
Setting the clip variable of an AudioSource to a clip and then playing the sound, but that's a different story.

How the issue occurs: When I start the game, on the first click it plays fine. But then after a few clicks, it starts slowing down and/or lagging.

This is my code:

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

[RequireComponent(typeof(AudioClip))]
[RequireComponent(typeof(AudioSource))]

public class GameProcess : MonoBehaviour {

    public Canvas Game;
    public AudioClip explosion;
    AudioSource beatBox;
    Transform btn;
    Vector3 canvasMin;
    Vector3 canvasMax;
    Vector3 pointerMin;
    Vector3 pointerMax;
    Vector3 pointerPos;

    void Start () {
        btn = Game.transform.FindChild("Pointer");
        canvasMin = Game.GetComponent<Collider>().bounds.min;
        canvasMax = Game.GetComponent<Collider>().bounds.max;
        pointerMin = btn.GetComponent<Collider>().bounds.min;
        pointerMax = btn.GetComponent<Collider>().bounds.max;
        beatBox = GetComponent<AudioSource>();
    }

    void Update () {
        if (Input.GetMouseButton(0))
        {
            beatBox.PlayOneShot(explosion);
        }
        if (!(pointerMin.x <= canvasMin.x) || !(pointerMin.y <= canvasMin.y))
        {
            if(!(pointerMax.x >= canvasMax.x) || !(pointerMax.y >= canvasMax.y))
            {
                btn.transform.position = Input.mousePosition;
            }else
            {
                btn.transform.position.Set(pointerPos.x - 1, pointerPos.y - 1, 0);
            }
        }else
        {
            btn.transform.position.Set(pointerPos.x + 1, pointerPos.y + 1, 0);
        }
    }
}


texts:
I got the following problem. I have implemented transposition tables, which seem to work well or at least I can not see they are not working.

Additionally, I wanted to implement some move-ordering.

Basically, I search the move first that's saved in my transposition table. For some reason, that doesn't improve the search at all. Either I haven't implemented move-ordering properly or my implementation of the alpha-beta algorithm along with transposition tables is just wrong.

To measure the performance I counted the number of nodes visited during search. My implementation of move-ordering didn't have any effect at all.

Here is the Java-Code I have come up with:

public  int alphabeta(final CheckerBoard board,int alpha,int beta,int depth,boolean nullMoveAvailable){
  nodeCount++;

 int alphaOrig=alpha;
    Transposition entry =table.find(board.key);
    if(entry!=null && entry.depth>=depth){
        if(entry.flag==Transposition.EXACT){
            return entry.value;
        }else if(entry.flag==Transposition.UPPER){
            beta = Math.min(beta,entry.value);
        }else if(entry.flag == Transposition.LOWER){
            alpha =Math.max(alpha,entry.value);
        }
        if(alpha>=beta){
            return entry.value;
        }
    }

    if(depth==0 || board.isTerminalState()){
        return quiesceneSearch2(board,alpha,beta);
    }

ArrayList<Move>sucessors =MGenerator.getMoves(board);
Move currentBest =null;
for( int i=0;i<sucessors.size();i++){
        if(entry!=null && entry.depth<depth && (entry.flag == Transposition.UPPER || entry.flag == Transposition.EXACT) &&  sucessors.get(i).equals(entry.best)){
          Collections.swap(sucessors,0,i);
            break;
        }
    }

    int bestValue =Integer.MIN_VALUE;
    for(Move  move : sucessors){
        board.makeMove(move);
        int value =-alphabeta(board, -beta, -alpha, depth - 1, true);
        board.undoMove(move);
        if(value>bestValue){
            bestValue =value;
            currentBest = move;
        }
        alpha =Math.max(alpha,value);
        if(alpha>=beta){
            break;
        }
    }

    Transposition next =new Transposition();
    next.depth=depth;
    next.value =bestValue;
    next.zobrisKey=board.key;
    next.best = currentBest;
    if(bestValue<=alphaOrig){
        next.flag =Transposition.UPPER;
    }else if(bestValue>=beta){
        next.flag = Transposition.LOWER ;
    }else{
        next.flag = Transposition.EXACT;

    }
    table.insert(next);

    return alpha;
}

and the following code to start the search:

    public int findBestMove(int depth){
    if (table != null) {
        table.clear();
    }
    ArrayList<Move> sucessors =MGenerator.getMoves(board);
    int max = Integer.MIN_VALUE;
    for(Move m : sucessors){
        board.makeMove(m);
        int value =-alphabeta(board, -1000000, 1000000, depth, true);
        board.undoMove(m);
        if(value>max){
            max=value;
            bestMove=m;
        }
    }

    board.makeMove(bestMove);
    return max;
}

Would appreciate it if someone looked at my code. Maybe there isn't anything wrong with this part of my code but I didn't want to post everything since it's already quite a lot of code to look at.


texts:
This is my project structure!
I am using Java Libgdx

I want to make my Man class shoot the bullets from my bullet class. To make it more clear for example the spaceship game that you shoot asteroids the bullets come from the spaceship while you move it I want the same thing.
   package com.kovach.gameobjects;

  import java.awt.*;

  import com.badlogic.gdx.Gdx;
  import com.badlogic.gdx.graphics.Texture;
  import com.badlogic.gdx.graphics.Texture.TextureFilter;
  import com.badlogic.gdx.graphics.g2d.TextureRegion;

public class Bullet {

int x,y;
public static TextureRegion bullet;

public static Texture texture;

public Bullet(int startX, int startY){

    x = startX;
    y = startY;
    texture = new Texture(Gdx.files.internal("data/texture.png"));
    texture.setFilter(TextureFilter.Nearest, TextureFilter.Nearest);
    bullet = new TextureRegion(texture, 238, 5, 6, 13);
}

public void move(){

    x = x + 2;
    if (x > 700)
        visible =false;

   }

}

Fire method in Man class

   public void fire() {

    Bullet z = new Bullet((left + width), (y + height/2 ));
    bullets.add(z);

}

GameRenderer draw method

    private void drawBullets(){
    ArrayList bullets = Man.getBullets();
    for (int w = 0; w < bullets.size(); w++){
        Bullet m = (Bullet) bullets.get(w);

    }
}


texts:
Since there is no timeout for responce in windows phone xna version of WebClient i need to implement one. The idea is to make MyWebClient derived class from WebClient with timer. But i got stuck on it.
Is there any way to implement timer here without using Update for every instance of MyWebClient so that i can use it like WebClient?


texts: How can i change the camera view when clicking a button?

texts:
I added enum with all the views options.
But when i click/press on V nothing happen with the game is running.

using UnityEngine;

public class FollowTargetCamera : MonoBehaviour
{
    public enum Views
    {
        Forward, Backward, Left, Right
    }

    public Transform Target;
    public float PositionFolowForce = 5f;
    public float RotationFolowForce = 5f;

    public Views views;

    void Start()
    {

    }

    void FixedUpdate()
    {
        Vector3 vector = new Vector3(0, 0, 0);
        Vector3 dir = new Vector3(0, 0, 0);

        if (Input.GetKeyDown(KeyCode.V))
        {
            switch (views)
            {
                case Views.Backward:
                    vector = Vector3.back;
                    dir = Target.rotation * Vector3.back;
                    break;
                case Views.Forward:
                    vector = Vector3.forward;
                    dir = Target.rotation * Vector3.forward;
                    break;
                case Views.Left:
                    vector = Vector3.left;
                    dir = Target.rotation * Vector3.left;
                    break;
                case Views.Right:
                    vector = Vector3.right;
                    dir = Target.rotation * Vector3.right;
                    break;
            }
        }
        dir.y = 0f;
        if (dir.magnitude > 0f) vector = dir / dir.magnitude;

        transform.position = Vector3.Lerp(transform.position, Target.position, PositionFolowForce * Time.deltaTime);
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(vector), RotationFolowForce * Time.deltaTime);
    }
}


texts:
I have a VertexBuffer that I am remapping on a per frame base for a bunch of quads that are constantly updated, sharing the same material\index buffer but have different width/heights. However, currently right now there is a really bad flicker on this geometry.

Although it is flickering, the flicker looks correct. I know it is the vertex buffer mapping because if I recreate the entire VB then it will render fine. However, as an optimization I figured I would just remap it. Does anyone know what the problem is?

The length (width, size) of the vertex buffer is always the same.

One might think it is double buffering, however, it would not be double buffering because it only happens when I map/unmap the buffer, so that leads me to believe that I am setting some parameters wrong on the creation or mapping.

I am using DirectX11, my initialization and remap code are:

Initialization code

  D3D11_BUFFER_DESC bd;
  ZeroMemory( &bd, sizeof(bd) );
  bd.Usage = D3D11_USAGE_DYNAMIC;
  bd.ByteWidth = vertCount * vertexTypeWidth;
  bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
  //bd.CPUAccessFlags = 0;
  bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;

  D3D11_SUBRESOURCE_DATA InitData;
  ZeroMemory( &InitData, sizeof(InitData) );
  InitData.pSysMem = vertices;

  mVertexType = vertexType;

  HRESULT hResult = device->CreateBuffer( &bd, &InitData, &m_pVertexBuffer );

  // This will be S_OK
  if(hResult != S_OK)
     return false;

Remap code

  D3D11_MAPPED_SUBRESOURCE resource;
  HRESULT hResult = deviceContext->Map(m_pVertexBuffer, 0,
     D3D11_MAP_WRITE_DISCARD, 0, &resource);

  // This will be S_OK
  if(hResult != S_OK)
     return false;

  resource.pData = vertices;

  deviceContext->Unmap(m_pVertexBuffer, 0);


texts: Can't move character at all in unity basic platformer guide

texts:
so, I followed below tutorial.

https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/creating-a-basic-platformer-game

Going well until 18:50 (video time in tutorial), when the tutor compiles and able to move and jump the character. And then, when I try it, mine was not moving or jumping at all.

So, how to move the character?

I've also tried some solutions on the video's youtube comments, but nothing works.

P.S. I'm not new to C# at all, but new to Unity development. I'm using Unity 5.

Thanks.

Update :
Here are the props screenshots and Controller c# code :

Cube

Hero

SimplePlatformController

using UnityEngine;
using System.Collections;

public class SimplePlatformController : MonoBehaviour {

[HideInInspector] public bool facingRight = true;
[HideInInspector] public bool jump = false;

public float moveForce = 365f;
public float maxSpeed = 5f;
public float jumpForce = 1000f;
public Transform groundCheck;

private bool grounded = false;
private Animator anim;
private Rigidbody2D rb2d;

// Use this for initialization
void Awake ()
{
    anim = GetComponent<Animator> ();
    rb2d = GetComponent<Rigidbody2D> ();
}

// Update is called once per frame
void Update ()
{
    grounded = Physics2D.Linecast(
        transform.position,
        groundCheck.position,
        1 << LayerMask.NameToLayer("Ground"));

    if (Input.GetButtonDown ("Jump") && grounded)
    {
        jump = true;
    }

}

void fixedUpdate()
{
    float h = Input.GetAxis ("Horizontal");

    anim.SetFloat ("Speed", Mathf.Abs (h));

    if (h * rb2d.velocity.x < maxSpeed)
        rb2d.AddForce (Vector2.right * h * moveForce);

    if (Mathf.Abs (rb2d.velocity.x) > maxSpeed)
        rb2d.velocity = new Vector2 (
            Mathf.Sign (rb2d.velocity.x) * maxSpeed,
            rb2d.velocity.y);

    if ((h > 0 && facingRight) || (h < 0 && !facingRight))
        Flip ();

    if (jump)
    {
        anim.SetTrigger ("Jump");
        rb2d.AddForce (new Vector2 (0f, jumpForce));
        jump = false;
    }
}

void Flip()
{
    facingRight = !facingRight;
    Vector3 theScale = transform.localScale;
    theScale.x *= -1;
    transform.localScale = theScale;
}

}


texts: It's one thing to get the graphics aligned perfectly, it's another to do this for every single resolution and not take too much time and/or make the code unreadable due to size. Games like Battlefield 3 and Minecraft seem to manage this. But what do they do to keep things from stretching or going off the screen? I don't know any algorithms to do this. I'd like some help on this topic. I've always programmed games that only handle a single resolution, so help would be appreciate.


texts: How to implement a component-based model for menus in Unity?

texts:
I'm trying to create a "sims-like" context menu when an item / game object is clicked.

This comes as an add-on question from this question:
How to design context menus based on whatever the object is?

Specifically:

  Each object of class Item would have a list of components like
  Equipable, Edible, Sellable, Drinkable, etc. An item can have one or
  none of each component (for example, a helmet made of chocolate would
  be both Equipable and Edible, and when it is not a plot-critical quest
  item also Sellable). The programming logic which is specific to the
  component is implemented in that component. When the user right-clicks
  on an item, the components of the item are iterated and context-menu
  entries are added for each component which exists. When the user
  selects one of these entries, the component which added that entry
  processes the option.

  You could represent this in your XML-file by having a sub-node for
  each component. Example:

 <item>
      <name>Chocolate Helmet</name>
      <sprite>helmet-chocolate.png</sprite>
      <description>Protects you from enemies and from starving</description>
      <edible>
          <taste>sweet</taste>
          <calories>2560</calories>
      </edible>
      <equipable>
          <slot>head</slot>
          <def>20</def>
      </equipable>
      <sellable>
          <value>120</value>
      </sellable>
   </item>

When I read this, it reminds me of an interface in programming. My question is, how do you implement this? Perhaps a better question is "is the answer still valid" but it does seem relevant to me.

What have I tried?
Nothing at this point, because I'm not sure where to start. Given the example above, I'd guess that Item would have a list of... interfaces? that it could implement? This is why I am a bit confused.

I want to add, this isn't just a UI issue. I found a few radial menus in the store, my issue is how to populate the menu depending on what game object is clicked.


texts:
I am researching the possibilities for a new iOS game. It's going to be a run-n-gun type platformer, and I'm looking into the possibility of co-op multiplayer.

The game itself wouldn't be very physics intensive, there will most likely be 20-30 physics bodies at any given time. For the multiplayer, I think I would have one player "hosting" and up to 3 other connecting via the Internet.

Here's my first question, are there any 2D physics engines that work over a network(preferably open source)?

My second question, Does anyone have any thoughts on using a non-networked engine (like Box2D or Chipmunk) and adding the networking component? Since there would not be very much information sent, do you think it would cause a lot of lag?


texts: Get collision details from Rectangle.Intersects()

texts:
I have a Breakout game in which, at some point, I detect the collision between the ball and the paddle with something like this:

// Ball class
rectangle.Intersects(paddle.Rectangle);

Is there any way I can get the exact coordinates of the collision, or any details about it, with the current XNA API?

I thought of doing some basic calculations, such as comparing the exact coordinates of each object on the moment of the collision. It would look something like this:

// Ball class
if((rectangle.X - paddle.Rectangle.X) < (paddle.Rectangle.Width / 2))
    // Collision happened on the left side
else
    // Collision happened on the right side

But I'm not sure this is the correct way to do it.

Do you guys have any tips on maybe an engine I might have to use to achieve that? Or even good coding practices using this method?


texts: Practice openGL or learn a specific engine?

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

I am a university student.
I want to work in the game industry.
Now I am thinking about either practicing my openGL skills or learn a complete new game engine during my time in school.
I will do this by developing a smartphone game.
I am debating over using just openGL or using a game engine.
If I learn a game engine, then if the company I want to work for does not use that game engine, then wouldn't it be a waste of time to learn that game engine now instead of solidifying my openGL skills?
So, openGL or game engine?
Thanks.


texts: How to solve the overlap between a rectangle and a circle that collide

texts: I have two figures - a circle and a rectangle and i have a method that checks whether the two figures collide. How to prevent them  from overlapping during collision?


texts: How to identify individual keyboard keys across devices from different locales

texts:
I'm trying to make a UI system that adapts images for key binding depending on the keyboard type (azerty/qwerty/etc).

For the moment I've done the binding with DirectInput Key Codes so it does not depend on the type of keyboard, so that part is OK.

But for the choice of UI image to display I face an issue.

The nearest solution I have is to translate the tszName of DIDEVICEOBJECTINSTANCE to ASCII or Virtual-Key Codes and use this code to find the appropriate image for my UI. But tszName is localized depending on the device (eg. the tszName of a french keyboard will return "ESPACE" instead of "SPACE")

So I haven't found a way to bypass this localization in tszName to get an unique code that's consistent across devices with similar keys. Have you some idea?


texts: How were 8-bit and 16-bit games developed?

texts:
We have a lot of information on the internet out there on plenty of engines, SDKs, fancy IDEs, etc.
But how did people manage to develop games in the past? Are there 'famous' tools? What was the most used programming language? how were they deployed into cartridges?


texts: Sprites draw-order sorting for top-down 2D game with floors and bridges

texts:
I am working on custom 2D engine for a game.
I am having trouble figuring out a working system for sprite drawing-order sorting for this specific game.

Game description:

2D
Top-down perspective
Multiple floors
Bridges

More details for clarity:

Characters (Player characters, enemies, NPCs) can be positioned and move around any Floor and move between Floors.
Objects (crates etc.) can be positioned on any Floor. (Not on Stairs.)
Floors are traversed using Staircases.
Staircase is a "ramp" connecting 2 Floors.
Staircase can connect 2 Floors that can be any number of Floors apart.
Characters and Objects cannot be positioned / move "behind" back-facing walls and behind Objects.
Characters can be positioned / move behind other Characters and pass through each other.
Characters and Objects can be positioned / move both on and under a Bridge.

Entities that need their sprites sorted are Characters, Objects, Bridges.
Visuals (tiles) that make rest of the game level, are rendered first (under everything else) in one pass, and don't need any kind of sorting.

What I tried so far:

V0. Sorting by Y
Obviously doesn't work because it can't solve verticality (Floors).

V1. Sorting Characters into lists by Character current Floor, than sort each list by Character current Y
Than drawing eg.
Floor 0 sorted Characters list
Floor 1 Bridges
Floor 1 sorted Characters list
...

Problem with this is approach, that Floor has to have a hard edge.
Each Character is at one point on one and only one Floor.
When two Characters are close enough together on Y axis to overlap, and each one is on a different Floor, this happens:

V2. Sorting Characters and Bridges using "Painter's Algorithm" (average distance to camera of 3D rectangle vertices)
Even though the graphic engine is 2D, I defined every Character and Bridge as 3D positioned rectangle, and defined virtual camera (view point) with 3D position.
Than calculated average 3D position of every entity and it's distance to camera. Than sorted by the distance.

Problem with this is approach is one of problems of Painter's Algorithm: the distance to camera is calculated from position of center point of the rectangle.
The bigger the rectangle, the more imprecise the calculation.
If the rectangle is big enough, it will start wrongly overlapping surrounding rectangles.
Characters on different heights (elevations) are often sorted wrongly.
Also if the Bridge is wide enough on Y axis, it will be wrongly sorted between Characters on and under the Bridge.

V3. I can make the game fully 3D
and use Z-Buffer, that is made to solve the problems mentioned above.
But before I make that leap, I would like to be sure I explored all other (2D) possibilities.

I searched the internet high nad low for any tutorial or article on this, and surprisingly didn't find a single one that would fit my case.

I will be very grateful for any advice.


texts:
I'm struggling with a problem for a while and I hope some of you can help me out. The title for this question is vague, so I will try to explain my problem as best as I can!
I'm am creating a project (in C++ using Visual studio 2012) with a DLL that has the DirectX toolkit and DXUT as references. I initialize DXUT (the device and all that kind of stuff) in the DLL and create a GameScene (GameScene is in the executable) after DXUT is initialized. The GameScene derives from its base class BaseScene (BaseScene is in the DLL project).
When I call DXUTGetD3D11Device() to get the DirectX device in the GameScene (in the executable) it is all fine, but when I call DXUTGetD3D11Device() in the BaseScene it returns null.
Note: This counts for all the DXUT functions!
Note: The executable has the same references as the dll + the dll!
If you need more information to answer my question, ask me! I find it really hard to explain my problem and I will try my best to make it more clear!


texts: How do I make objects' speeds appear the same despite screen resolution?

texts:
I'm working on my HTML5 game with Intel XDK. I'm stuck on making all devices display the same number of frames per second.

The first generation iPad has a screen resolution of 1024 pixels horizontally, while the Motorola Moto G Android phone has ~2657 pixels horizontally. With my game running at 30 FPS and sprites moving at 1 pixel per frame on the Motorola, this can take up to 5 mins to get from one side to the other.

Changing the FPS to 300 makes it work normally on the Motorola but too fast on the iPad.

Is there a work-around for this?


texts:
I have a elongated rigidbody sphere with Mesh Collider. It falls through the plane. (I made a rigidbody cube and does not fall through.)

I have problem with Mesh Collider repeately.. The collision of the object is not detected.

If I replace the mesh collider with box collider, it collides again.

I would like to collide a mesh collider with another mesh collider.


texts: How to 'point' an arrow in the direction that it's going?

texts:
I am relatively new to OpenGL and 3D environments and am having trouble creating a rotation matrix that will rotate an arrow model so it 'points' in the direction that it is going. I am using GLM as a math library. My current approach is to predict the position the arrow will be at next frame and try to rotate the arrow to face that position.

double nextVelY = velocity.y - (gravity * (((glfwGetTime() + dt) - clock) / 1000.0));
glm::vec3 nextVelocity = velocity;
nextVelocity.y = pos.y - 0.5 > -3 ? nextVelY : velocity.y;

glm::vec3 lookat = glm::vec3((nextVelocity * glm::vec3(20) * glm::vec3(dt)));
glm::vec3 pos2 = glm::vec3(0);

And then try to calculate angles between the current position and the predicted position

model = glm::translate(model, pos);
model = glm::scale(model, glm::vec3(0.05));

float angleX = atan(nextVelocity.y / nextVelocity.z);
float angleY = atan(nextVelocity.x / nextVelocity.z);
float angleZ = atan(nextVelocity.x / nextVelocity.y);

glm::vec3 zAxis = glm::normalize(lookat - pos2);
glm::vec3 xAxis = glm::normalize(glm::cross(up, zAxis));
glm::vec3 yAxis = glm::cross(zAxis, yAxis);

model = glm::rotate(model, angleX, xAxis);
model = glm::rotate(model, angleY, yAxis);
model = glm::rotate(model, angleZ, zAxis);

I'm not at all sure if this is a good way to try and achieve this. I've also tried using glm::lookAt

model = glm::transpose(glm::lookAt(pos2, lookat, glm::vec3(0, 1, 0)));

and various other methods I've found with no success.


texts: Cinematographic camera manipulation techniques for a 2D adventure game

texts:
I'm coding a subsystem to manipulate camera for our 2D adventure game.

I plan to support panning and zooming. Also, perhaps, rotation (but current scenario does not call for that). We also support parallax scrolling, if that matters.

To better understand what means of expression my level-designer would need to design best experience for the player in cutscenes, I'm looking for a good documentation on relevant cinematographic camera manipulation techniques. (Yes, of course, I plan to have a discussion with my level-designers as well.)

Maybe there is a good basic guide for a camera manipulation in a 2d-animation movie or something like that — what techniques are there, and when to use what.

Or maybe there is some relevant document that is written from the game-development point of view?

Any advice welcome.


texts: What is the little dot/icon at the center of the screen in an FPS game called?

texts:
So I am developing a game and trying to find one of those to use, but I don't know what to search for. If you don't know what I am taking about, look at these examples:

What are these called?


texts:
I am coming straight from XNA and I installed the latest version of MonoGame today (2015-12-22) for Visual Studio 2015 Community. I created a project from the windows Project template.

I right click the content folder and add a png-file. I compile without error but it stops during runtime because it can't find the content file. My solution look like this

Game1.cs look like this:

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;

namespace homer
{
    public class Game1 : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        private Texture2D simpson;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
        }

        protected override void Initialize()
        {
            base.Initialize();
        }

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            simpson = Content.Load<Texture2D>(@"Images/Homer");
        }

        protected override void UnloadContent(){ }

        protected override void Update(GameTime gameTime)
        {
            if (Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);
            spriteBatch.Begin(SpriteSortMode.FrontToBack, BlendState.AlphaBlend);
            spriteBatch.Draw(simpson, new Vector2(200, 100), Color.White);
            spriteBatch.End();
            base.Draw(gameTime);
        }
    }
}

The problem I encounter is that MonoGame do not make xnb-files from the png and put it in my output folder. I tried to copy the file manually from a compiled XNA project to my MonoGame debug folder and it worked. I have done nothing but create a project from the template and trying to load an image. What do I need to do to make MonoGame compile xnb-files for me. It also runs if I change "Do not copy" to "Copy always" but that is not optimal for runtime as I understand it. Also, I don't want it to be too easy for the users to doodle in the graphics.

Content.mgcb look like this

#----------------------------- Global Properties ----------------------------#

/outputDir:bin/Windows
/intermediateDir:obj/Windows
/platform:Windows
/config:
/profile:Reach
/compress:False

#-------------------------------- References --------------------------------#

#---------------------------------- Content ---------------------------------#


texts: Generate random people with demographics

texts:
I would like to have random people with preferences generated for an economic strategy game.
For simplicity, lets say each person has age(number), home area and its type (city,village,...) and preferences(likes ice cream,..).
The problem is, if I used uniform random generation(choose random age, home, and preference) all people would be ...uniformly distributed and there would be no demographics for player to discover. By features I mean, for example, young people like soda, in addition people living in village tend to prefer red colored packaging (=> player shipping it with different packaging to country will sell more). I would like to have the people generated so that there are always some distinctive demographic features(which does not have to be known to the game itself) present in the data.  The features does not have to and should not resemble real-world ones, the algorithm should work without requiring any 3rd party databases. Homes for people are given as input from previous generation step as array of tuples of settlement id and capacity (thus also type).
What could be general procedure for this type of procedural generation?


texts: Using a custom map gui disables the ability to save

texts:
I'm quite confused at the moment. I've created a custom gui (a fuel display on map) that works nicely, but somehow whenever I try to save the game when this gui is active....clicking on the slot where I want to save the game does not work!
thus when I add the following code and let it be called via a trigger (a common event which has a switch as trigger calls this javascript code...event runs parallel with a wait (5)):
REITD.SpaceClass.prototype.showCargoAndFuelStatusUI = function (vehicleType, currentCargo, maxCargo, currentFuel, maxFuel) {
    if (!(SceneManager._scene instanceof Scene_Menu)) {
        if ($gameSystem._REITD_definedWindows["CargoAndFuel"] !== undefined) {
            SceneManager._scene.removeChild($gameSystem._REITD_definedWindows["CargoAndFuel"]);
        }

        $gameSystem._REITD_definedWindows["CargoAndFuel"] = new Window_Base(new Rectangle(1, 1, 211, 200));
        SceneManager._scene.addChild($gameSystem._REITD_definedWindows["CargoAndFuel"]);

        $gameSystem._REITD_shownStatusUIWindows["CargoAndFuel"] = "shown";

        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText("Vehicle Fuel", 1, 5, 190, "center");
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 40, 200, 25, _Colors.gray);
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 40, 2 * this.calcFuelPercent(vehicleType), 25, _Colors.blue);  // 2 px per percent full.
        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText(
            padLeft(this.getCurrentFuel(vehicleType), 6, "0") + " / " + padLeft(this.getMaxFuel(vehicleType), 6, "0"), 30, 35, 100, "left");

        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText("Vehicle Cargo", 1, 75, 190, "center");
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 110, 200, 25, _Colors.gray);
        $gameSystem._REITD_definedWindows["CargoAndFuel"].contents.fillRect(1, 110, 2 * this.calcCargoPercent(vehicleType), 25, _Colors.red);  // 2 px per percent full.
        $gameSystem._REITD_definedWindows["CargoAndFuel"].drawText(
            padLeft(this.getCurrentCargo(vehicleType), 6, "0") + " / " + padLeft(this.getMaxCargo(vehicleType), 6, "0"), 30, 105, 100, "left");
    }
}

update: Even when I call a method to deactivate the custom gui....saving is still not possible:
REITD.SpaceClass.prototype.hideStatusUI = function (uiType) {
    if (uiType in $gameSystem._REITD_shownStatusUIWindows && $gameSystem._REITD_shownStatusUIWindows[uiType] == "shown") {
        //  Status UI exists => hide it!
        SceneManager._scene.removeChild($gameSystem._REITD_definedWindows[uiType]);
        $gameSystem._REITD_shownStatusUIWindows[uiType] = "";
    }
}

Also what I noticed...deactivating just the adding to the scene is enough to eliminate the problem (but means no custom gui being active):   //SceneManager._scene.addChild($gameSystem._REITD_definedWindows["CargoAndFuel"]);  => no problem. Thus somehow this part starts the problem and I don't understand why
I'm running into the problem.
Now my question is:
Why is that so and what can I do to correct this problem (or can I somehow deactivate this while a menu is open?)
Engine: RPGMaker MZ


texts: Heightmap implementation in javascript question, a 2D water heightmap

texts:
I have a height map function from GPU Gems 2 Chapter 18, where they're generating a set of B/W pixels from this equation:

H(x,y,t) = Σi=0N h (
Axi x + Bxi,
Ayi y + Byi,
Ati x + Bti )

The article suggests using 4 height maps to generate the final height map, so that's N = 4. I understand it's using 3 equations of a line to describe the 2D plotting of a 1D B/W pixel. So, I have to iterate through a set of points, say from (0,0) to (100,100):

[
x0 - x100,
y0 - y100,,
t0 - t100
]

So that's a "for loop" of 100 x 100 x 100 and with the 4 times that's 100 x 100 x 100 x 4 loops, the number of A's,B's and T's, i.e. the data I would need to provide would be:

[
A0x,
A0y,
A0t
] , [
B0x,
B0y,
B0t
]
[
A1x,
A1y,
A1t
] , [
B1x,
B1y,
B1t
]
[
A2x,
A2y,
A2t
] , [
B2x,
B2y,
B2t
]
[
A3x,
A3y,
A3t
] , [
B3x,
B3y,
B3t
]

My question is, is this correct? Are my for loops correct? Did I interpret the equation OK so that its just 4 for loops of 4x100x100x100 and the 24 pieces of data are all I need to generate this map?

I'm implementing this in javascript, using a plot pixel function.

Edit: I have another problem, how do I output the data? If I have say a 100x100 pixel height map, how do I "keep" only the data that applies to that area, do I just "throw away" the rest of the data in a conditional if statement that only does within that range?

Edit: also it was my understanding that x and y were the plots for the u and v of the height map and t was that alpha channel? I think I'm misunderstanding that part if the equation


texts: Will changing app name in iOS app store affect/reset app ranking?

texts: I want to change the name of my app but was wondering if that would change/affect/reset the ranking it already has. Anyone know?


texts: How to ignore collision between two objects

texts:
I have a player that shoots in the direction that it is facing. However, the shot that is created when I click, also destroys the player (example). How would I make the shot ignore collision with the player? Or better yet, how to make a shot destroy anything it touches and destroy itself without affecting the player?

This is the code that controls collisions:

function OnTriggerEnter (col : Collider) {
    Destroy(col.gameObject);
}

The shot is a trigger, but the player isn't. Not sure if this changes anything in this case.


texts: How to make a custom inspector component

texts:
I have a script component, but I want to know how I can add things like sliders buttons etc.

I wrote a grid system that generates at the start of my script but I want to run it in editor when I push a button to not to force calculations, lessen load times for my game and even see result of my work in editor. How can I do that?


texts:
I've been very interested in the last few months about getting in to audio programming (I'm from a musical background). I've been a .NET developer for two years and have also done some objective c for an iPhone app recently. I realise I would probably need to work on my C++ chops and have been having a play around with FMOD EX and doing a lot of research into the industry.

I was just wondering if anyone could suggest some good resources for audio programming (be they websites, podcasts, books, videos, online courses etc). Anything from Fourier analysis, low level coding, audio engine creation to audio APIs. I just want to learn as much as possible!

Thanks in advance.


texts: libGDX, Android Studio assets not found but linked properly

texts:
I used the libGDX setup UI to create a new project, copied sources from my tablet project and fixed all the errors due to libGDX version changes. Finally at the point to test and run, but first I hate the setup UI for libGDX . It's broken horribly as necessary folders were not created as they used to be, or were not properly imported by Android Studio. Regardless, when I run the desktop launcher the first file it attempts to load causes a file not found crash:

    skin = new Skin(Gdx.files.internal("/data/defaultSkin.json"));

The JSON, Atlas, and PNG files are all in android/assets/data folder. Desktop launcher config is using that folder for the working path as is the ONLY thing I've found online to look at for Android Studio and this particular issue. However I still get the file not found error. And I am using the default skin that I pulled off GitHub. Funny that all this code worked fine on my tablet and Eclipse, however Android Studio is being a broken POS, and this is the "preferred" IDE for development? I had less problems with Eclipse and AIDE (for mobile) except that AIDE pushes libGDX for game development but doesn't fully support the Gradle build that libGDX pushes for uses to utilize rather than downloading the simple to use zip folder with the libs in it. Why the hell fix what isn't broken? It almost always breaks what was perfectly fine.....


texts: Calculating a RPG character's wages based off their attributes?

texts:
I am programming a Mafia RPG where you can hire people with attributes. The attributes are the same for everyone, and are ranked from 1 to 10 (although this might change to 1 to 20)
I want to keep the attributes simple, no more than 6 skills.
The attributes could be anything, but lets say there are examples.

Driving: 1/10
Stealth: 1/10
Robbery: 1/10
Brains: 1/10
Toughness: 1/10
Greed: 1/10

Greed is meant to be a modifier, the higher the number the more greedier they are.  I'd like to use this for wages
The problem I have is, I am not sure how I should calculate a goons wages.
I don't just want to randomly pick a number; its needs to be reflective of the person's attributes.
At first I thought if they all go up to 10 or 20, I could use an average, with greed being a multiplier.  But this does not feel right.
The other idea I have is bands; so that if each attribute score is between X and Y the goon could get Z wages (which are then totalled up) with greed being a modifier; but this feels very dry.
Ideally, I would like the wages to be reflective of their attribute, and most importantly reflect how greedy they are but at the same time not make the wages unrealistic or spiral into very high figures.
I'm thinking the wages should be from $100 /wk up to $5,000 or $10,000 /wk but would welcome suggestions.
What would be the best way to calculate a RPG character's wages based off their attributes?
Many thanks


texts: How can I link to callback functions in Lua such that the callbacks will be updated when the scripts are reloaded?

texts:
I'm implementing Lua scripting in my game using LuaBind, and one of the things I'm not clear on is the logistics of reloading the scripts live ingame.

Currently, using the LuaBind C++ class luabind::object, I save references to Lua callbacks directly in the classes that use them. Then I can use luabind::call_function using that object in order to call the Lua code from the C++ code.

I haven't tested this yet, but my assumption is that if I reload the scripts, then all the functions will be redefined, BUT the references to the OLD functions will still exist in the form of the luabind::object held by the C++ code. I would like to be able to swap out the  old for the new without manually having to manage this for every script hook in the game.

How best to change this so the process works?

My first thought is to not save a reference to the function directly, but maybe save the function name instead, and grab the function by name every time we want to call it. I'm looking for better ideas!


texts: Why don't we use octogonal maps instead of hexagonal maps?

texts:
I understand the advantage of hexagonal tiles over square ones. But why aren't octagons used instead? I would think they would provide better, more natural movement in eight directions.

I was thinking about using that kind of map in some game, but I haven't seen any games using it, so I wonder if I missed something obviously flawed about using it?


texts: Coding a left/right object movement C# script for android phones in unity

texts:
I have 2 spheres and a cube on screen.

I'm experimenting to make a 'left/right movement script' for the cube so that when I touch the left sphere, the cube moves left-wards and when I touch the right sphere, the cube moves right-wards.

I have 2 scripts. I have attached SphereLeft.cs to left sphere and SphereRight.cs to right sphere.

Any pointers on how to achieve this ?


texts: How can I draw curves above a mesh surface?

texts:
I am making an animation of a deformed sphere that represents some aspects of the wave function in a hydrogen atom.  I am starting with an octahedron that i push through a tessellation shader. The tessellation evaluation shader then first deforms the octahedron into something more sphere-like and then applies the deformation stuff.

Now, to further improve the visual impression of the deformation, I would like to place lines on top of the sphere and also deform those, to achieve something resembling level curves.  What would be a good way to achieve this? Generating circles on the cpu side and then sending them to GL and having them deformed separately seems rather odd, but I cannot figure out another way.

If I want to achieve this in one shader run I am also limited to drawing triangles (patches) and making these appear as lines also seems rather unwieldy.


texts: If I use vertex shader to do all operations on object, then constant buffer can be empty?

texts:
The program cycle is

Update();
UpdatePipeline();

In Update() constant buffer for each object, that after transformations, has this object world matrix is copied to GPU upload heap. And in UpdatePipeline(), among other things, installed shaders are called. Because we do all matrix transformation using CPU, vertex shader just returns position, right? If yes - is it true that performance will increase?

Now I want to do all transformations using GPU, i.e. via vertex shader. It means that in Update() I just should call memcpy() with an empty constant buffer as a source?

Learning more, I found that I can put in constant buffer position vector float4 or matrix float4x4 of vertex, and as a root constant choose ProjectionView Matrix. The shader will mul one on other. Keep searching... Or constant buffer is one of the root constants? Confused

I don’t understand how to choose what to send as an argument to shader function, like input here:

VS_OUTPUT main(VS_input input)
{
...
}

As I understand, I can access constant buffer the next way:

cbuffer ConstantBuffer : register(b0)
{
float4x4 mat;
}

There can be ProjectionView matrix, okey got that. But how to send vertex pos to input then?


texts: How do developers balance games despite massive skillgaps from their players?

texts:
My question regards properly balancing games with a high skill ceiling; one unattainable by the developer himself.

For example, Halo is a game with a low skill-ceiling. Master Chief has limited mobility in-game, can only equip 2 guns, and the guns are all pretty standard. Most situations have only a couple of ways to play out, and escape from sticky situations primarily depends on the player's loadout and aim. Fancy high-skill tricks aren't available to players in Halo. Players primarily improve in Halo by improving their situational awareness and aim; skills common to all FPS games. This is not hard for me to imagine balancing.

Rocket League OTOH is a game with a very high skill ceiling, and a rather unique concept / feel. Moreover, Rocket League is the type of game I can see myself developing, but not being very good at myself. The concept is simple, but the number of ways to succeed in a given scenario is hugely dependent on a player's skill and imagination.

This kind of high skill ceiling does not only apply to games of technical skill like Rocket League. For example I consider WoW, DotA, Star Craft, Magic the Gathering, Settlers of Catan, and Minecraft to be games with high skill ceilings as well.

How do low-skill developers approach creating and balancing features within their games which satisfies players vastly more imaginative and technically skilled than themselves?


texts: Still players keep moving on the clients

texts:
With UNET, despite Interpolation is set to None in the NetworkTransform, I've noticed that still players keep moving on the clients, very slowly, one pixel at a time.

Their position on the server is correct, and as soon as they move again, they warp to where they should actually be and go on. As soon as they stop, the slow horizontal movement often starts again.

This happens most often with yourself, and only sometimes to others. Sometimes you see yourself moving, while others will see you correctly, while some other times you also see others moving.

Googling around yielded no results, and other than disabling interpolation, which I already tried, I'm a bit clueless about what to do.

What could be causing this, and how could I fix it?


texts: How do I inform the end user about cheat codes?

texts:
I have added an interface to input cheats, and of course the backend of this.

Current cheats include:

unlimited health
unlimited time
faster movement
no need to use keys (I have a door/key system)
triple firing lasers (normally there is only one)
grenades (changes your weapon to grenades)

How will I tell the user the cheat codes? Normally, cheats would be sold by the programmer, but this isn't that sort of game currently.


texts: Unity 5: Error when everything is okay(Object reference not set to an instance of an object)

texts:
i'm getting this error when the collider colides with something:

Object reference not set to an instance of an object

It's referencing to the gamecont.Death(); from this script:

and the death method is on this one:


texts: Unity - Proper rotation of object from 3 points in space

texts:
I have a rectangular object (for now), with children placed partially in it in its forward, up, and right sides (to make rotations easier to track).
I am trying to get the object to rotate according to 3 points in space. One is the origin (0,0,0), one is in the forward direction (0,0,1), and one is in the right direction (1,0,0).
The origin and forward direction are how I define the origin and direction, so these coordinates are local. I assume for now that the right direction is correct for now.
My simple solution was to set transform.forward = (forward-origin); and transform.right = (right-origin); (where the points are given in global coordinates).
My problem with this is that the rectangular object won't roll around its forward direction. I'm not great with geometry, but I can't get past the thought that setting right ought to solve that problem.
I was, however, not surprised to see that trying to set transform.up as the cross-product of those two made things worse and the object was no longer facing in the forward direction.
So,

Why doesn't the combination of forward and right account for this rolling?
What if right weren't exactly right? I'm assuming simply normalizing it against forward would do it (and with unity, I could also get up out of it with one function call), but I'm not certain.


texts:
I've been thinking about developing a small engine not only to develop small experimental games, but also to serve as a base to test various rendering techniques and things like that. Right now I've been thinking a lot about how to handle textures and stumbled on megatexture, but this is something that is a bit puzzling. There is a lot of talk of it being better than the traditional approach to having a bunch of textures around and loading them as needed, but how does megatexture avoid this, I've read around that they use streaming and you can just stream bits and pieces of it as opposed to loading each texture individually, but how does that offer better performance, and isn't that just another form of tilling?

How do we sample such a texture when in a shader, do we stream part of it into memory then work on it. I've seen the latest videos of Rage and the texture do look great, but is that just the result of great artists or does the tech come into play.

To sum up, how does it work, why is it great and how could I do something similar.


texts: Dynamic obstacles avoidance in navigation mesh system

texts: I've built my path finding system with unreal engine, somehow the path finding part works just fine while i can't find a proper way to solve dynamic obstacles avoidance problem. My characters are walking allover the map and collide with each other while they moving. I try to steering them when collision occurs, but this doesn't work well. For example, two characters block on the road while the third one's path is right in the middle of them and he'll get stuck. Can someone tell me the most popular way of doing dynamic avoidance? Thanks a lot.


texts: 4-player arena game networking model : dedicated servers?

texts:
So my question is not technically limited to 4-player games, but there has been a lot of games on steam lately (brawlhalla, duck game etc) that seem to be quite popular lately.

My question is, are these games hosted on a separate server, or do one player host the game, and the game developers just providing a match-making service?

If it's hosted by one of the player, how do they get around with NAT issues? If hosted by some server somewhere - that sounds like it's super expensive to run?

Also, for these games, what kind of networking model is "standard"? Are there any articles about this I can read?


texts: I have a DirectX scene. I want zoom in using mouse wheel to the mouse location. I am able to zoom the view to center of screen but I need to zoom to mouse location. Please suggest how it can be done. Thanks


texts: How to implement mouselook in the browser?

texts: I am currently creating a 3D first-person shooter game in the browser using WebGL. How would I implement mouselook/free look for such a game?


texts:
I'm a little bit stuck on how I might go about programming dynamic, interesting water in a game. To qualify that a little bit, I'm interested in creating water with broad, rolling waves that affect collision, physics, and the visual shape of the mesh. As an example, here's a screenshot from Wave Race 64, a 1996 jetski racing game for the Nintendo 64!

In Wave Race, not only do the waves move visually, but the choppy water pushes your vehicle around and creates bumps that give the game a really fun and unique feeling. I imagine that this type of thing is pretty standard in water simulation and physics, but I think the 'arcadiness' of the water physics in Wave Race makes it a pretty decent example.

I'm not really sure what steps need to be taken to create this effect though. I imagine that the visual effect of waves would be pretty simple to do create using a vertex shader, but I'm uncertain on how to program the physical 'entity' of the water. Here are some of my exact sticking points:

What might the data structure of that water look like?
And how does one 'animate' the physics/collision while keeping the visual mesh deformation in sync?

I have some "starting point" ideas, like possibly using a 2D or 3D vector field for the water. But I'm still fuzzy on the general implementation of fluid simulations, especially as a gameplay element!


texts:
I've made a basic UI with the following interface in Unity:

I have a few different states that I want to switch between by pressing buttons - the "in-game" the "menu" and "submenus". There's buttons that can close and open certain menus, and in addition I have the functionality of the escape button doing one of the following:
if in-game, esc goes to main menu
if in main menu, esc goes to in-game
if in one of the sub-menus, esc goes to the menu above it

I implemented this by having a specific menu element structure that I added as a component to each of the in-game, main-menu, sub-menu objects. It contains a pointer/reference called next, that points to another menu-element. In particular, it points to the object that gives the "esc" functionality above. So for example, the menu-element component on "in-game" contains a pointer to the menu-element component on "main-menu". I also have a static reference current, that points to the current object that should be active, and at the start of the game, it's set to the main menu.

Now when esc is pressed, the current object is disabled, the current is set to `current.next, and then this object is enabled. If in addition the switch was from in-game to main menu, we do additional stuff like turn off the in-game GUI, set time.scale to 0 etc. (and the opposite when going from menu to in-game).

Is all of this reasonable and reliable? Everything works fine, but I have no experience with UI and I don't know if what I did is good practice.

Second - UI obviously has to be reliable. Is it even reliable to do UI like this? How can I assure this is safe? What if I press esc, and current goes to current.next, but for some reason the things that should happen during this switch (various objects turning on/off) doesn't happen. It could happen that now I'm stuck in-game with no crosshair, and when I go to menu, the cross-hair will turn on instead. This shows that I should probably determine what the esc button exactly based on what object I'm pointing at currently, and not just say "switch" between true and false on each "esc" button press, as then they could go out of sync.

What are some good practices for making reliable UIs, that will still work and won't cause horrible issues if something goes wrong?


texts:
I have a shader to perform LUT coloring of a texture and a c++/c# programs that call it which work perfectly when i use a 1D texture.
Since i need to support computers that don't support the 1D texture in the shader i thought the easiest would be to convert the 1D texture to a 2D texture with the height==1.
After the conversion (1D -> 2D) when i run the program it seems that the LUT 2D texture is received gray in the shader. I render the exact same texture in another place (not using a shader) in the program and the texture looks fine (same as it did when i used a 1D texture).
The shader code:

uniform sampler2D FluorImage;
uniform sampler2D FluorColorLutRGBA;

void main(void)
{
  vec3 FluorPix = texture2D(FluorImage, gl_TexCoord[0].st).rgb;
  vec2 Coord = vec2(FluorPix.g, 0.0);
  vec4 NewColorFluor = texture2D(FluorColorLutRGBA, Coord).rgba;
  gl_FragColor.rgb  = NewColorFluor.rgb;
}

The texture creation code

glGenTextures(1, &m_FluorShadersParams[fpsFused].m_LutTexture);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 256, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, m_FluorShadersParams[fpsFused].m_LutTexture);

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, 0);

Filling the texture with data

glActiveTexture(a_FluorTextureIndexes[fpsFused]);
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, i, 256, 1, GL_RGBA, GL_UNSIGNED_BYTE, pLUT);
glActiveTexture(GL_TEXTURE0);

Calling the shader

glUseProgram(m_progObj[fsFluorFused]);

glActiveTexture(FluorTextureIndexes[fpsFused]);
glBindTexture(GL_TEXTURE_2D, FluorTextureIndexesNum[fpsFused]);
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, inputTextures[eftIR]); // Fluor image

glBindFramebuffer(GL_FRAMEBUFFER,outputFBO.m_FBO[eftFused]);

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorImage");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, 1);
}

uniformLoc = glGetUniformLocation(m_progObj[fsFluorFused], "FluorColorLutRGBA");
if (uniformLoc != -1)
{
  glUniform1i(uniformLoc, FluorTextureIndexesNum[fpsFused]);
}

glClear(GL_COLOR_BUFFER_BIT);

glBegin(GL_QUADS);
 glTexCoord2f(0,    fTextureRatioY);
 glVertex2f(0,      fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   fTextureRatioY);
 glVertex2f(fTextureRatioX,     fTextureRatioY);
 glTexCoord2f(fTextureRatioX,   0);
 glVertex2f(fTextureRatioX,     0);
 glTexCoord2f(0,        0);
 glVertex2f(0,          0);
glEnd();

glUseProgram(0);
glActiveTexture(GL_TEXTURE0);

glBindFramebuffer(GL_FRAMEBUFFER,0);
glBindTexture(GL_TEXTURE_2D,0);

The strange thing is that if i change all the places in the code back from Texture2D into Texture1D and the sampler in the shader to 1D everything works great.
Anyone has any idea where the issue can be?


texts: How do I create a bounding frustum from a view & projection matrix?

texts:
Given a left-handed Projection matrix, a left-handed View matrix, a ViewProj matrix of View * Projection - How do I create a bounding Frustum comprised of near, far, left, right and top, bottom planes?

The only example I could find on Google (Tutorial 16: Frustum Culling) seems to not work; for example, if the math is used as given, the near-plane's distance is a negative. This places the near-plane behind the camera...


texts: Throwing Exceptions in C++ game DLL's? Pros and Cons

texts:
What are the pros and cons of using Exceptions in C++ in relation to game development.

Google style guide says that they don't use Exceptions for a variety of reasons.  Are the same reasons pertinent towards game development?

  We do not use C++ exceptions...  - google-styleguide.googlecode.com

Some issues to think about.

How it pertains to the development of a libraries used through multiple projects.
How does it affect unit testing, integration testing, etc?
What does it do to using third party libraries.


texts:
I am really new with Unity, I am making a game, but I am having some problems with the animators, my problem is that I am trying to add some animations to my menu, and also add new characters to my game, but none of my new animations are working. This question is the same like these ones :

http://answers.unity3d.com/questions/717046/animator-state-freezing-blue-bar-progress-bar-not.html

http://answers.unity3d.com/questions/778616/animator-state-freezing.html

The animator freezes when I run the game.

What is really interesting is that the first animation that I created in the game works correctly. I have tried several things, but nothing works. I really need help with this.

I'm using several plug ins on this development: facebook, ngui and admod

This is the list of things that I tried:

Create a new level, without any ngui component. I added a new animator to an empty game object and I created a sprite animation.
I tried to move the whole project to a new one, the result was the same problem.
I added a the animator to the object programmatically using a script. It correctly added the animator, but the result was the same.
I tried to change properties of the project, but It seems to not work at all.
I started a new project and followed the same steps to add the same animation, in the project everything works, but I want to avoid to created the whole project again It will take me a lot of time since I have to recreated everything to ensure this problem will not happened again.

As an addition I want to mention that in the beginning everything works correctly but suddenly the animations stopped working. As I say there is only one animator that is working, and this one was the first one that I created.


texts: Can I have keyboard controls in an MMO and still do movement calcuation in the server?

texts:
I'm trying to decide between keyboard and mouse movement controls for a web-based multiplayer. It would be quite resource-intensive to use the WASD-keys and AJAX the server with controls every second.

Can I implement WASD-key movement and still have the server do all the movement calculations (to deter cheating)?


texts: How to set default pose of model from Blender? (Exported as FBX)

texts:
I have a model that has lots of animation clips(actions).

Before export as FBX, I set the pose to named "default" pose and exported as FBX like this.

But in Unity, it's changed to first animation clip in animation list in Blender!

I try to fix it, but there is nothing I can do. I can't change the order of animations in Blender and Unity either.

This wasn't first time, I had same issues before but I just ignored because it's fine in game play, but I really want to fix it this time.

What I want is set "default" pose in edit mode in Unity(not play mode). How do I set "default" pose as default, not first animation clip in the list?

Using Blender 2.78, and Unity 2017.3.0f3.


texts: How can I evoke a sense of dislike/hate for a character through game mechanics?

texts:
In my game there is a villain who I would like the player really despise from the moment the character is first encountered. I want the player to hate the character so much that it affects (and drives) the player's decisions during the game, to the extent that the player may choose a course of action that harms him or herself if it would also set the villain back.

I'd like to accomplish this through game mechanics, not just writing, not just through the fact that the character is "the bad guy." What strategies and types of mechanics can I use to ensure that no matter who may play my game, this character will be completely despised?


texts: Finding moves with multiple jumps in checkers

texts:
I'm currently working on a minimax implementation for a game of checkers in C#. The minimax itself works fine if you ignore a few bugs I've yet to fix, but I'm having some problems finding a way I can properly create lists of 'Chain' moves, or moves with multiple jumps.

I've made several attempts at building a function which would take an attacking move and run it through some recursion to find all the possible branches, but so far the main result is that no attack move at all has been working.

Anyhow I'd appreciate some pointers on how to go about generating all the attack moves that could follow as a result of an attack. I'm guessing some form of recursion is going to be necessary at the very least.


texts:
I want to highlight a certain item in an inventory. It is a 3D scene although it looks a bit 2D. That is confirmed.

To do do that I have create a cube with a very small z scale (so that it looks like a plane... yes, I could have used a plane right away, I notice it now that I write it).

I have put a transparent material onto my cube.
This material constantly changes its alpha value so that it looks like it's glowing.

I'm doing this because I want to re-do this inventory:

It does work, but my weapon is rendered before the glowing cube is renderer. That is the default behaviour as the weapon is physically in front of the glowing cube.

In the inventory system that I want to redo (see screenshot), the cube however it rendered after the weapon, so that it looks as if the cube was over the weapon (while in fact it is below the weapon. One can see that by the fact how perfectly the glowing cube aligns with the grid, and the weapon is over the grid).

I would therefore like to ask if I can make it so that a certain material / mesh is rendered after a certain other material.

I have only seen Sorting Layers for 2D, but nothing for 3D meshes.

Thank you very much!

Edit:
Somebody suggested that I should place the glowing cube over the weapon. I had tried that, but it doesn't look good as the cube isn't "aligned" with the grid anymore, but hovers / floats over it instead. Here is a screenshot:


texts:
I've started rewriting some of my code (npcs, navigation and such) and I need some help with my new navigation system.

Basically the way it works is: the game generates a random dungeon. For example:

With the black representing walls. After the map generates, it goes through the map and finds all the outward corners and places a node on them. The end result is something like this:

When it finishes that, it goes through the nodes and connects the nodes that have a clear line of sight to each other. Like this:

So it works like this: enemies use the nodes to navigate their way around the map. When they want to do things like wander, they choose a random node (one they can see) and go to it. Every node has a list of the nodes it's connected to, so from there they choose another node and head towards that one. The enemies keep a list of the previous three node locations, so they don't wander in circles (if there's only one node connected to the current node, they head back.)

The whole thing is based on line of sight, basically. However, there are some limitations, namely: movement. Creatures in my game have tile based movement and can only move in cardinal directions. I also need enemies to try to avoid each other and change direction based on stimuli (such as a change in "bravery" level, causing them to rush the player, retreat or stand their ground.)

Given all that, how can I calculate the ai's next move?

Edit: To be more clear: I want to know how I can have the ai calculate the direction it will move in next. So I need to know what kind of formula the ai needs to determine which tile is the best to get it to it's destination. Something that takes into account the target, other enemies (if there are any) and the bravery level of the ai (which will change player interactions and make them group with other enemies when their bravery is low and they're alone.)

Edit 2: Okay, let me change the question and add some information. My game is turn based, so I need to make steering behaviors work in a system where it can only move once per update (one tile length) and can only move up, down, left and right. I'm not sure how to do this, can you help me?


texts: frustum culling and exporting a big scene model

texts: Let's assume that I created in Blender a race track with landscape. I can export it to single wavefront obj file and then load in my graphics engine using assimp but it doesn't allow to use frustum culling. Should I split such big scene too seperate objects or some model formats allow to split object within single file. How graphics engines load such big scenes ? Do you know some useful techniques/articles ?


texts:
I have a Sprite class like this:

class Sprite
{
  double rotation ; // in degrees 0-360
  double x;
  double y;
}

I'd like to have one sprite to rotate to another point with a constant rotation rate, the sprite should not rotate directly but mor like "rotate more left, rotate more right"

The reason for this is that I want to implement a homing lethargic missile.

Someone knows the math behind this? :)


texts: What do I need to develop for the Playstation 3?

texts: I made a game, and I want to port it to the Playstation 3. What do I need in terms of hardware, money, licenses and such?


texts:
I'm trying to get a model rendered in monogame using a texture shader. I'm using the code from this tutorial project: http://kgiannakakis.github.io/MonoGameEffects/

I created a simple textured cube using Wings3D with it's own texture and saved it as cube.x. With  no modified code, the 'BasicEffect' shows the cube with the texture as defined in the 3D model file. Switching to the 'Textured' effect, the cube is textured with the helicopter texture. Now I completely understand this is because the texture is passed to the TexturedEffect 'texture' parameter.

My question is, how to modify the shader or the code to use the texture as defined by the mesh? My goal is to have a model passed to a draw function without having to pass the textures (as I have no idea how to match the textures to the parts- also these seem to be present in the model's data anyway).

I tried two things (both without the desired result):
1: modify the shader. I expected the texture to be passed in a register:

Modified section in Textured.fx:

sampler2D textureSampler = sampler_state {
    Texture = (register(s0));
    MinFilter = Linear;
    MagFilter = Linear;
    AddressU = Clamp;
    AddressV = Clamp;
};

Why did I try s0? Because I assumed based on experience with 2D shader this would be the texture passed by the draw call (also based on this question: https://stackoverflow.com/questions/7617424/some-simple-xna-hlsl-questions) I am not sure this assumption is correct for 3D models (apparently not).

The other thing I tried: I noticed that the basicEffect.Texture was set on the mesh part. So in the code:

private void DrawModelWithTexturedEffect(Model model, Matrix world, Matrix view, Matrix projection)
    {
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (ModelMeshPart part in mesh.MeshParts)
            {

                texturedEffect.Parameters["World"].SetValue(world * mesh.ParentBone.Transform);
                texturedEffect.Parameters["View"].SetValue(view);
                texturedEffect.Parameters["Projection"].SetValue(projection);
                texturedEffect.Parameters["ViewVector"].SetValue(viewVector);
                texturedEffect.Parameters["ModelTexture"].SetValue(part.Effect.Parameters["Texture"].GetValueTexture2D());

                Matrix worldInverseTransposeMatrix = Matrix.Transpose(Matrix.Invert(mesh.ParentBone.Transform * world));
                texturedEffect.Parameters["WorldInverseTranspose"].SetValue(worldInverseTransposeMatrix);

                part.Effect = texturedEffect;
            }
            mesh.Draw();
        }
    }

I tried extracting the texture from the mesh.effect, but I could not retrieve it (debugger shows it is there) as I cannot seem to cast the part.Effect to a BasicEffect? edit I found the above code to work the first call only; as the part.Effect has been replaced by the last last call of the loop. Still, the question remains, how to deal with textures and models?

So what is the best way to get this to work? The samples I found work with older XNA and older shader models that do not seem to compile with Monogame (for example Riemers or Whitakers).


texts:
I'm working on a 3d game in LibGDX, got help on here with my model rotation. Worked great. But now I'm dealing with the model's roll, and it's not behaving as expected. It's controlled by:
handPos.set(cam.position);
        handPos.add(forwardTemp.set(cam.direction).scl(2.5f));

        handInst.transform.setToRotation(Vector3.Z, cam.direction);

        handInst.transform.getRotation(handRot, true);
        handAngle = handRot.getRoll();

        camAngle = getCameraRotation();
        float h = (camAngle-handAngle);
        handInst.transform.rotate(Vector3.Z, h);

        handInst.transform.setTranslation(handPos);

Moving it works great, and I've had no difficulty getting my camera roll - I've made a method to do that. I have a label onscreen that shows current camAngle, and current handAngle. CamAngle looks right, but the handAngle doesn't match what I'm seeing, and so my math to keep hands stationary in the view isn't working. I've tried getting the yaw or pitch instead, in case the axes are messed up, but it isn't better.
I'm trying to keep the roll of the model in front of the camera to match the roll of the camera - so if you look around, your hands don't spin. Any ideas on what's wrong here?
Edit, here's my getCameraRotation method
public float getCameraRotation()
    {
        Quaternion p = new Quaternion();
        cam.combined.getRotation(p);
        float cammy = p.getRoll();
        return cammy;
    }

The camera can look in full 3d space, controlled by touch gestures. When doing so, it rolls around. I'm fine with that, kinda like the effect, but I want to match the hands model in front of the camera to it. The number I get from this method seems to match visually what I'm seeing pretty well.
Edit again - had code trying to getYaw. I want getRoll, that was just there from me experimenting with different axes to fix the problem.


texts: How do I use SharpDX with the .NET Core framework?

texts:
I started a project to build a game engine. As a result of circumstance, I won't have the luxury of building the engine in C++, so I'm going to have to settle for C# with the .NET Core.

Given that background, I thought I would use SharpDX to supply me with some basic functionality to build my engine on top of, except it seems like SharpDX doesn't support .NET Core, and only supports .NET Native. After testing it, and trying to include SharpDX in my dependencies file, Visual Studio Code explicitly tells me that SharpDX conflicts with .Net Core and it couldn't be installed. However, an issue posted to their GitHub page seems to imply that they might support .NET Core.

Unfortunately, this is the only piece of information I found regarding SharpDX supporting .NET Core, so I'm not entirely sure if support was ever implemented or not. Perhaps I'm just not including it correctly in my project file.

Does SharpDX support .NET Core, and if so how do I link against those libraries properly in VS Code?


texts: Using Kinect V2 SDK to track ONLY head position

texts: Another way of describing what I need is to only track a single x,y,z coordinate (preferably head) of a person. In the SDK is it possible to 'turn off' parts of skeletal tracking to improve tracking performance or is skeletal tracking either ALL on or off?


texts: Targeting system, Vectors and Angles Maths

texts:
I need a bit of help with the maths for a targeting system for a space simulator. The problem is working out the correct turret angle so that the bullets hit the target ship...

I have a ship at location X, Y and the ship has turrets which can turn 360 degrees. I want to aim at an asteroid at location Xa, Ya.

The maths for this which is working great is like this....

VectorX = X - Xa
VectorY = Y - Ya

Angle = (57.2957795 * atan2(VectorX , -VectorY ))

Now consider the asteroid is moving at a velocity vector of Xsa, Ysa and the bullets fired from the turret have a speed.

The maths for this which again works really well is....

VectorX = X - Xa
VectorY = Y - Ya

Distance = sqrt((VectorX * VectorX) + (VectorY * VectorY))

VX = VectorX - (Xsa * (Distance / BulletSpeed));
VY = VectorY - (Ysa * (Distance / BulletSpeed));

Angle = (57.2957795 * atan2( VX, -VY )

Ok the bit I cant get to work right is when the ship is also moving, lets call this velocity vector Xs, Ys. When the ship is moving the bullets fire maintain the movement of the ship plus the bullet firing speed at the angle vector. Think of driving a car and shooting a bullet out the window the bullet would fire out sideways from the car but would also maintain the car's forward momentum as it traveled.

BulletVelX = Xs + ( BulletSpeed * cos( Radians( Angle ) ) )
BulletVelY = Ys + ( BulletSpeed * sin( Radians( Angle ) ) )

I have found a site that says simultaneous equasions could be used to solve the problem but has anyone working knowledge of how this is done.

Thanks


texts:
Is it possible to get the elements or the textures of a Flare and to change them at runtime? If so, then how do I get them?

Pseudocode:

Flare flare = GetComponent<Flare>();
foreach (Element e in flare) {
    e.Size = 10;
    e.Color = Color.green;
}

Thanks in advance :)


texts:
I'm looking to create a demo using the source development kit.
Because i want it to have a similar style to portal, but one I'm wondering can i get the portal 2 authoring tools without owning the game,
and two I'm finding it very difficult to find any form of tutorials for it, could anyone link me to some preferably PDF format or eBook i rather read them.


texts: Spherical Area Lights do not match reference

texts:
So I'm adding spherical area lights to my application, and comparing my results with mitsuba, I am getting some differences (left is my approach, right is mitsuba - a pathtraced reference):

What I am mainly noticing is that:

The specular is way too bright for roughness values over 0.5
The specular shape gets "flat" (Left-mine, Right-mitsuba, noise
caused by low sample count):

I am using the closest point approximation and the normalization term proposed in Real Shading in UE4, that is: (radius / (distance * 2.0) + alpha)²

I believe issue 1) could be an issue with my normalization term, however I think issue 2) might probably be an issue with the closest point approximation?

Is this kind of inaccuracy expected with the approximations I use, and if so, are there better approximations?


texts: Create sprite renderer using custom material

texts:
I have done following thing.

Create Material
Attach sprite with texture type as Texture
Add sprite renderer component to game object
Assign material to it that I create in last steps

There is no sprite available for selection. Following image illustrate my problem correctly.

So my question in how to create sprite renderer with custom material?


texts: How can I detect a Gameobject touching another gameObject without using collider2D's?

texts: I have fish gameObjects that have colliders2D so that I can click and move them. I added fish food with Collider2D's but it was hard for me to click on the fish. After I disabled the fish food collider2D it was easier to click on the fish. Is there an alternative when detecting two gameObjeccts without colliders?


texts:
I want to execute native iOS code in unity. For this I have added two files in /plugins/ios.

ViewController.h
ViewController.m

Code for each file represented as under.

ViewController.h

@interface ViewController

-(void)sampleMethod;
@end

ViewController.m

#import "ViewController.h"

@implementation ViewController

-(void)sampleMethod
{
     NSLog(@"Sample Method Execute");
}
@end

For C# file I have added following code

[DllImport("__Internal")]
private static extern void sampleMethod();

and call to above method

sampleMethod();

When I am export project for iOS, xCode give me following error that I can't able to understand.

I can't able to understand how to solve this problem? Please give some suggestion here.

EDIT :

I have added extern keyword in my .m file after reading some suggestion.

#import "ViewController.h"

@implementation ViewController

extern "C"
{
   -(void)sampleMethod
   {
        NSLog(@"Sample Method Execute");
   }
}
@end

But in xCode now I am getting Expected Identifier or '(' at the line of extern keyword line. So what to do next?


texts: Rotating a vector around a vector in 3D space

texts:
I am trying to rotate a moon around a planet (the planet is also rotating around an axis) but I am having trouble doing so.

I tried to make the model move through space like so:

@Override
public void render() {
moon.getInstance().transform.setToTranslation(moon.center.x + 0.5f, moon.center.y + 0.5f, moon.center.z);
}

I know that this wil not give me the correct (or indeed any) rotation, but the model doesn't even move. When I use moon.getInstance().transform.setToRotation(1f, 0, 0, 10f) it does rotate (around its axis) so I assumed that I could use .setToTranslation the same way.

So, my question is actually two questions:

How can I move a model in 3D space
How can I let it move around a certain vector, following a circular path


texts: HTML5 Canvas: Get rect coords after rotation (relative to screen)

texts:
update: function(delta) {
    for (var i = 0; i < this.bullets.length; i++) {
        this.bullets[i].velocity = this.bullets[i].speed * delta;
        this.bullets[i].contextX += this.bullets[i].velocity;
    }
},

draw: function(ctx) {
    for (var i = 0; i < this.bullets.length; i++) {
        ctx.save();

        // Move the context to where the player is then make it face the target degree
        ctx.translate(this.bullets[i].startX, this.bullets[i].startY);
        ctx.rotate(this.bullets[i].rotation);

        ctx.fillRect(this.bullets[i].contextX, -5, 10, 10);
        ctx.restore();
    }
}

The code above contains two methods that describe a class that manages the drawing and updating of bullets. The update method moves a bullet along and the draw function then draws it to the screen.

The canvas does the following:

Saves the current canvas context state
Moves the context to where the bullet originated from
Rotates the canvas to the way the bullet was facing when shot
Draw the rectangle
Restore the canvas context to original state

Here is an image I have made that better describes what the canvas context is doing:

So we know the x position of the bullet but this is relative to the context as it's been rotated. What I need to know is the bullet's X and Y properties in relation to the actual screen. Any ideas as to how I can do this?


texts: Android appstore developer account, to not charge then change

texts:
The idea of charging for my early releases doesn't sit well with me, but at some stage, I will want to devote more time to games dev activities, when I will need it to be rewarding.

On the Play Store site a lot of options become locked once the app is published. Can this be revised at a later date? Thanks, I'd rather not worry about money already.


texts: Locust Swarm algorithm for path finding (devour and move on)

texts:
I need to model a locust swarm that devour food stacks and move on to next stacks. I searched for articles and found few articles. These papers is about optimization applications but I want to convert it to a path finding algorithm to reach multiple targets (like randomly seeded many food stack). Swarm should split when food stack is not enough to feed them( multiple objective problem). How can I do this?

x: position
v: velocity vector


texts: Conversion from matrix defining rotation and position to camera matrix

texts: I have a matrix that defines the rotation and translation of an object, relative to (0, 0, 0). Assuming that the identity matrix defines the camera to be at (0, 0, 0) pointing at (0, 0, 1), how would I go about constructing the view matrix from the world + rotation matrix?


texts: Unity objects not rotating around pivot point

texts: Suddenly, for some reason, objects in the unity editor started rotating around their center of gravity (at least that's what I think is going on) instead of their pivot point. I tried placing the object inside an empty object which would serve as the new pivot point, like usual, but this did not change anything. Is this some setting or some updated feature? How can I stop it?


texts: Modify texture of sepcific area of Terrain in unity

texts:
I am developing a farming simulator 3D game in unity. I have a crop field on terrain which is actually a texture paint in square to show a crop area, and i have to perform sowing (prepare field for seeding) in which process as tractor pass on that texture part its texture from plain soil which i had applied on it should change to more darker and rough texture. I have a idea to get that specific texture part from terrain data but i do not understand how to modify that specific area's texture at run time (through code). Any help would be helpful.
Thanks in advance.


texts: enabling and disabling the script in unity

texts:
I have three gameobject(G1,G2,G3) and I have set their tag name as "enemy".And I have another gameobject(Manager) where I have attached the script and I have a button when I click on the button the script in all the three gameobjects should be disabled .But the problem is that ,the script is disabled for only one gamobject.

public void ArrowIndicatorInvisible()
{
    GameObject.FindWithTag ("enemy").GetComponent<MessageScript>().enabled=false;
}

What will be issue.Can anybod help me solving it


texts: How do I manually define save paths in GMS?

texts:
I want to know if it is possible to set the path for my game's save data in GameMaker: Studio outside of the two default options I am given in the program. The options I get are:

%LocalAppData%\<game_name>

and

%AppData%\<game_name>

I can't seem to find a text box or text feild that let's me set something different. I feel like there should be one for advanced users so that path variables and wildcards can be used in the save data path.

I also tried opening the game's config .gmx and setting the path there. Unfortunately it did not work as the only values that do work are 0 & 1 which represent the default path options respectively. Is this possible? Am I missing something?


texts: How to physically move a rigid body up the stairs?

texts:
When an object is controlled by a CharacterController, it is easy to make it climb ramps with a certain slope, or climb steps with a certain height.

When the object is controlled by a RigidBody instead, it can still climb ramps naturally - I just use AddForce and it walks on ramps just like on any other surface. I do not have to add any special logic for a ramp. However, it does not climb stairs. Is there a natural "physical" way to make the RigidBody climb stairs, without explicitly checking that there are stairs ahead?


texts: How to make a sidescrolling effect in lwjgl

texts:
I use the following methods and the screen moves away from the player.

glTranslatef(h.x - width/2, h.y - hieght/2, 0);

        if ((Keyboard.isKeyDown(Keyboard.KEY_D))) {

            h.x += 10;
        }

        if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
            h.x -= -10;
        }

How do I make it so the player and the screen moves? Also shouldn't I just use the camera?


texts: What freeware frameworks and tools to choose if I want to build a game like Farmville or Club Penguin?

texts:
Say I like to experiment with multiplayer games and I do not want to reinvent the wheel and build yet another game server. I don’t mind configuring and writing wrappers and adapters (both in c++ and java) for the server.
What server does Farmville use? Is it Java or C based?
What isometric flash engine do they use?  What other examples can I look into to learn the subject?
Thanks.


texts: Prevent Reavers from dealing splash damage to friendly and allied units

texts:
Just for fun I made some games in the Starcraft Broodwar map editor (scdraft2.0).

I notice that in my map Reavers deal damage to friendly and allied units as well as to neutral units. It's a cat and mouse map so when friendly units kill your teammates it's not fun.

Is there any way to prevent this?


texts: LibGDX: Is it necessary to set a stage as an input processor when creating a touchpad?

texts:
I mean, I've been searching it, they always use set a stage as an input processor after they had added the Touchpadto the Stage because it extends from Actor indireclty(it extends from Widget that extends from Actor), just like this:

myStage.addActor(myTouchpad);
Gdx.input.setInputProcessor(myStage);

Is there any other way to set the input processor when creating a touchpad?


texts: Android - Efficient way to draw tiles in OpenGL ES

texts:
I am trying to write efficient code to render a tile based map in android. I load for each tile the corresponding bitmap (just one time) and then create the according tiles. I have designed a class to do this:

public class VertexQuad {

private float[] mCoordArr;
private float[] mColArr;
private float[] mTexCoordArr;
private int mTextureName;
private static short mCounter = 0;
private short mIndex;

As you can see, each tile has it's x,y location, a color array, texture coordinates and a texture name.
Now, I want to render all my created tiles.

To reduce the openGL api calls (I read somewhere that the state changes are costly and therefore I want to keep them to a minimum), I first want to hand ALL the coordinate-arrays, color-arrays and texture-coordinates over to OpenGL. After that I run two for loops. The first one iterates over the textures and binds the texture.
The second for loop iterates over all Tiles and puts all tiles with the corresponding texture into an IndexBuffer. After the second for loop has finished, I call

gl.gl_drawElements()

whith the corresponding index buffer, to draw all tiles with the texture associated. For the next texture I do the same again.

Now I run into some problems:
Allocating and filling the FloatBuffers at the start of each rendering cycle costs very much time. I just run a test, where i wanted to put 400 coordinates into a FloatBuffer which took me about 200ms.

My questions now are:

Is there a better way, handling the
coordinate and color structures?
How
is this correctly done, this is
obviously not the optimal way? ;)

thanks in advance,
regards Markus


texts: In Unity, how do I make text/annotations appear when I mouse over GameObjects in playmode?

texts: How do I make text appear when I mouse over GameObjects in-game? What is the Unity jargon for this? I'm assuming it's 'annotations'.


texts: Should I use one GLSurfaceView.Renderer for each part of my game?

texts:
I am creating a small platformer-like game for Android using OpenGL. The game has 3 main screens/states:

Main menu screen
Level selection screen
The game screen

Currently I use a GLSurfaceView.Renderer to render all three screens and just run different parts of the render code depending on which screen I am on. Now my code is getting really messy because the render(), update() and onTouchEvent() methods of the renderer all have code for all three states in big if statements.

My question is now: Is it possible to have multiple GLSurfaceView.Renderer's (one for each screen/game state) and how can I implement the switching between them?


texts:
I want to create for example 4 cubes and then to connect them all making a square but making them scaling to one direction and not two directions as by default.
The prefab variable is a Cube.
I have this old script I did long time ago. The script is working but not what I wanted.
This script create like a cube from all the walls.
How can I add some flag bool to decide if to create a kind of cube like it is now or to create a square empty square not to fill it. I mean if I want to make it like hollow.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class GenerateWall : MonoBehaviour
{
    public GameObject prefab;
    public Vector3 wallsStartPosition;
    public float width = 0;
    public float height = 1;
    public float lengthX = 2;
    public float lengthZ = 2;
    public float time = 1;

    private List<GameObject> walls = new List<GameObject>();
    private IEnumerator coroutine;

    void Start()
    {
        for (int i = -2; i < 2; i++)
        {
            GameObject go = Instantiate(prefab);
            go.transform.parent = transform;
            go.tag = "Wall";
            Vector3 scale = Vector3.one;
            Vector3 adjustedPosition = wallsStartPosition;

            float sign = Mathf.Sign(i);
            if ((i * sign) % 2 == 0)
            {
                adjustedPosition.x += (lengthX * sign) / 2;
                scale.x = width;
                scale.y = height;
                scale.z *= lengthZ + width;
            }
            else
            {
                adjustedPosition.z += (lengthZ * sign) / 2;
                scale.x *= lengthX + width;
                scale.y = height;
                scale.z = width;
            }
            adjustedPosition.y -= height / 2;
            go.transform.localScale = scale;
            go.transform.localPosition = adjustedPosition;
            walls.Add(go);
        }
        coroutine = raiseWall(walls[0], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[2], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[1], height, time, 0, 100);
        StartCoroutine(coroutine);
        coroutine = raiseWall(walls[3], height, time, 0, 100);
        StartCoroutine(coroutine);
    }

    IEnumerator raiseWall(GameObject wall, float amount, float time, float delay, float steps)
    {
        Vector3 position = wall.transform.localPosition;
        float finalHeight = position.y + amount;

        yield return new WaitForSeconds(delay);

        while (position.y < finalHeight)
        {
            float remainingHeight = finalHeight - position.y;
            position.y += Mathf.Min(remainingHeight, amount / steps);
            wall.transform.localPosition = position;
            yield return new WaitForSeconds(time / steps);
        }
        yield break;
    }
}

The result is :

but if I want it to be like this ?


texts:
Why particle effect alway rendered after UI though they have same sorting layer and same sorting order?
I searched a lot of information about it,every one said that both of effect and UI are controlled by sorting order and sorting layer.If UI's sorting layer is same to effects' and sorting order is bigger then effects', then UI will render after effect and the result is that UI cover effect.
But what they will do if they have the same sorting layer and the same sorting order?I found that effect alway cover UI in this case.I think this is because effect render after UI.  But why?
There are some pictures below:

Hope anyone could answer me.Thanks.