texts:
I'm in the process of implementing a selection box for my simulation and am having difficulty with something which appears simple. At the moment, I can draw the selection box and accurately select the items under it, provided the box was dragged from the top-left-hand corner downwards:

If I start dragging the box from any other point the rectangle doesn't correspond to that of the viewport, as demonstrated by the negative width and height.

Here is my code:

// selectionBox is Rectangle

if (mouse.LeftButton == ButtonState.Pressed && prevMouse.LeftButton == ButtonState.Pressed)
{
    if (selecting)
    {
        selectionBox.Width = mouse.X - selectionBox.X;
        selectionBox.Height = mouse.Y - selectionBox.Y;
    }
    else
    {
        selecting = true;
        selectionBox.X = mouse.X;
        selectionBox.Y = mouse.Y;
    }
}

// Code to handle selection finished omitted

// Drawing code
if (selecting)
{
    DrawingHelper.DrawRectangle(selectionBox, Color.Yellow, false);
    DrawingHelper.DrawRectangle(new Rectangle(startPoint.X - 4, startPoint.Y - 4, 8, 8), Color.Red, true);
}

How can I adjust the X, Y, Width and Height of my selection box so that X and Y are always the top-left of the selection box no matter where the selection began?


texts: Should I use a visual tool or code myself?

texts: I've been writing a small game in Python that generates random dungeon rooms with creatures for the player to fight.  It's all text based, choose your own adventure style.  A couple months of working on it later, I'm wondering if it would be better to seek some development software instead of manually coding it all?  When is it better to code manually and when is it better to use a tool (Unity, Gamemaker, etc.)


texts: Player's camera, how to obtain smooth movement

texts:
In a 2D platformer, I have a player that can move both horizontally and vertically. I also have a camera that moves in relation to player. In every update I do this:

public void RepositionCamera()
{
   // For the example I don't consider world rectangle bounds
   current_camera.Position =
      new Vector2(
         player_.Position.X - 250,
         player_.Position.Y - 100));
}

The problem here is that when I press very rapidly "left-right-left-rigth..." the camera does a very annoying effect, it seems an eartquake.

I think this is due to the strict relation to player's position and camera's position.
This is just an example, it is annoying also when climbing onto stairs because every step I force the player's Y up to the step height, so the camera does the same thing!

How can I solve this? How can I edit my RepositionCamera() to be less strict about moving itself?


texts: making a tangram game in unity, how to detect when shapes match

texts:
I'm making a 2D game in Unity that's kind of like tangrams, a puzzle game where you form a specific shape (given only an outline or silhouette) by arranging smaller geometric pieces, which can not overlap.

I want to know how I could check to see if the 2+ shapes together make the target shape I'm trying to match. The shapes I'm putting together and the target shape I'm matching are two different things in the game, so it's not like I'm filling something in and can use a collider the traditional way. Does anyone have any insight?


texts: I'm considering development of some simple Unity games but am worried about distribution.  Which well known game portals currently support unity?


texts:
I have recently been looking into SceneKit for OS X and noticed that there are several factory methods to create geometric shapes such as:

Box, Capsule, Cone, Cylinder, Plane, Pyramid, Sphere, Torus and Tube.

I am interested in adding such primitive shapes to my renderer but am struggling to find any reasonable source from which I can gather an understanding of procedural generation. There are several resources which detail the theory, but lack the appropriate source code to back it up.

SceneKit provides factory methods which allow for dynamically setting the attributes of such shapes. In the case of the Box, you can provide integer values for the number of width, height and depth segments which each face should be divided into.

I understand the theory but lack the knowledge to begin subdividing geometry faces to achieve the desired effect.

The vertices for each shape are most likely quite easy to generate in simple loops. What stumps me is knowing how to create the faces, or rather the appropriate texture coordinates for each face. Normals can be calculated per face so I'm fairly confident I could achieve what I want, it's just knowing where to start.

Can anyone provide any details on procedural geometry? What I really need is some source code to glean some information from. I have searched high and low for tutorials but have so far come up with only a few reasonable sites or blogs. Any good books, tutorials, blogs or research papers would be appreciated.

Edit based on comments

I should have clarified that I know how to create vertices for basic shapes, most of these can probably be achieved by simple loops. What I don't comprehend is how to create faces from the generated array of vertices. How do I create a triangle strip, or triangles, from a seemingly unordered array of vertices?

I assume that once I get past this point, I can create the normals from each face. Whilst I haven't delved into this yet, I have seen a lot of references to this and am sure it will be easy enough to implement.

Ideally, i'd like to be able to generate geometry from a given set of properties such as the way that SceneKit provides. Given SceneKit has done it, and you can do similar things in Blender and Maya etc, I assume i'm not trying to implement the impossible.

The final aspect would be applying textures. Again, this isn't something I have implemented but have read up on and am aware of the requirements.

The main problem here is that I know what I want to achieve but am struggling to decipher how to implement for the aforementioned primitives. I was hopeful that I would be able to find some semblance of knowledge by way of source code but I really haven't come across anything suitable so far.


texts: Precalculating timespan of bullet collision on cubic bezier curve circles?

texts:
I'm fairly new to game logics, C#/XNA (The language/library of choice) and bezier curves in general, and is stuck in my current project. I'm going to try to explain as thoroughly as I can what the issue at hand is.

The illustration above shows a line (P/Player) and three cubic bezier curves (A/B/C = "Enemies") between the time interval 0 ≤ t ≤ 1.

When the player holds down the right arrowkey, the player will move in a linear path to the right accordingly to a time variable (t). If the player also holds down the "fire button", the player character will shoot out bullets with a width of about 5 px from the top of it.

If the engine I have in mind is going to work, I will have to know precisely for how long period of time the enemies moving in their cubic bezier curves are being exposed to these bullets being shot out of the player. E.g. during the timespan of 0 ≤ t ≤ 1, enemy A will be exposed to bullets for a total of 0.43 units, B = 0.27 and C = 0 (these are made up results)

Which would be the most efficient and best way to take on this issue? So far I'm thinking of solving it by finding out the roots of the intersection of the line and the curve on the X-Axis to know if the players bullets will make contact during the timespan. But even if they do make contact, how can I make sure which enemy the player hits if the enemies paths kind of "overlap" eachother (like A and B in the picture)?

Some facts about the bullets that could clarify the behavior of the bullets I have in mind:

Bullets can't penetrate enemies. When it hits it's first target, it does not affect the one's behind it
For now, I'm satisfied if someone could come up with a solution without "bullet travel time" in mind. That the bullets hits instantly doesn't bother me too much. Bonus points if "travel time" is added in the solution of course.
In the picture, I show two lines. I would like to be able to multiple bullets being able to fire from different starting points on the player (like a dual-shot, quad-shot ect).

To sum my question up: (Quick reference guide)
When player goes to the right within 0 ≤ t ≤ 1, for how long does the player's bullets collide with the enemies?


texts: Weapon index sets index values to the same

texts:
i've got a question about my unreal blueprints. I've been trying to get this right for almost a month now, but i don't know how to fix this. These are my are down below and a small video to explain my situation better.

As you can see, i have 2 variables index_NUMB & index_num. My idea was to make a weapon that i could pickup with a button when i'm in range and drop with my "hand". But of course not to destroy all weapons when i pick one up, that is why i wanted to use 2 index variables. But the result is as in my little vid, i can pick up the objects and drop them just fine for only one time and then i can only pickup the wrong one. When i for example pick up the first one it picks up the other one, and vice versa.

I've particularly noticed that when i have dropped the items it sets them to the same index value and then Unreal can't make the distiction anymore between wich one to pick up.

Does anyone see what i've done wrong here or does anyone know how to fix this? Links, tutorials, etc. are all good.( I really want this fixed!) Thanks in advance for reading and/or helping me!!

Video + pictures:
https://www.dropbox.com/home/Public/UnrealProblemMap


texts: Improve opengl drawing with less calls as possible

texts:
I'm looking to render rectangle primitives as performant as possible, here's what I did so far:

int main() {
    Window window("OpenGL", 800, 600);

    Shader shader("./file.shader");

    float vertices[8];
    glGenVertices(vertices, 200, 150, 400, 300); // return coords for a square
    const GLshort indices[6] = { 0, 1, 2, 2, 3, 0 };

    GLuint vao, vbo, ebo;
    glGenVertexArrays(1, &vao);
    glBindVertexArray(vao);

    glGenBuffers(1, &vbo);
    glBindBuffer(GL_ARRAY_BUFFER, vbo);
    glBufferData(GL_ARRAY_BUFFER, sizeof(vertices), vertices, GL_STATIC_DRAW);

    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 2, GL_FLOAT, GL_FALSE, 0, 0);

    glGenBuffers(1, &ebo);
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, ebo);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, sizeof(indices), indices, GL_STATIC_DRAW);

    while(window.isOpen()) {
        window.clear();

        shader.use();
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);
        shader.setUniforms(..);
        glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, NULL);

        window.update();
    }

    glDeleteBuffers(1, &vbo);
    glDeleteBuffers(1, &ebo);
    glDeleteVertexArrays(1, &vao);

    return 0;
}

So far what I'm doing to fix my problem and seems to work:

Created vao, vbo and ebo to make a basic indexed rectangle.
Made a function that will returns vertices coordinates based position and sizes(x, y, w, h)
Create one single shader and set uniforms like position offsets, sizes and eventualy colors/textures after every draw call to be able to render shapes in different places ( that makes the coordinates function useless)

I'm pretty sure that's not the way to do it, but can't find something else, so this is what I'm thinking.

Heard that switching shaders is expensive, but I'll require shapes that won't share the same shader..
Also heard that setting uniforms is slower than switching shaders, so probalby switching shaders will be better here, need to profile the code to see.
Currently drawing one by one with glDrawElements seems hardcoded and inefficient to me, need something like a vao that could store multiple rectangular like indexedvbo all preloaded before drawing and when it goes to drawing, draw all the data with one call.
Not sure if I can load shaders between drawing, some of them will require changing while drawing like a hover or click effect, maybe there's better practices here too.

At the end, if you've been through this issue or having some tips/docs/source codes to read, it'll be excellent, thanks!

BIG NOTE: Mostly looking for 2d support, no 3d needed in case this could make it harder.


texts: Animation workflow between Blender and Mecanim

texts:
I've recently started learning Unity. Not being able to add custom animations to the standard FBXs you get from Unity's app store is really really slowing me down. When I import one into Blender, it brings none of the animations with it. I also purchased 3D Studio Max and, while a little better, it's still a steep learning curve.

Can I create an animation in Blender or 3D Studio Max and apply it to an existing Mecanim model?

Do I need to manually create and rig a basic model, import it, then move its animation to another character, or is there an easier way?


texts: How do I make sure the player model only moves 1 unit?

texts:
I am doing a school assignment based off of the Unity3D tutorial 2D RogueLike (all code available here)

In my version though, the movement is not turnbased and I am having some trouble figuring it out.

If I I make the player lose its turn after movement, the character will stay perfectly aligned with the grid. But if I let the player keep his turn, the character moves in increments not in alignment with anything(ór how long the computer think I held down the movebutton for).

I tried to fix it with this:

    GameManager.instance.playersTurn = false;

    Thread.Sleep(500);

    GameManager.instance.playersTurn = true;

and it sort of 'fixes' it. It now only moves 1 unit, provided I don't hold down the movebutton for longer than the 500ms, hereafter it seems to 'lose sync' with the board again... Also, it now takes 500ms from i press move, till the character actually moves.

Here is an example of how it looks if i just quickly tap the button to move(so its in sync)

and here is one when i held down the button for more than the 500ms ( out of sync)

So the specific question.

How do I make sure that the character only moves 1 tile/unit with a single button press?

I would greatly appreciate a solution to this


texts: What are some ways to make a scene without walls and infinite terrain visually appealing?

texts:
My Player Character is standing in the middle on flat infinite terrain.
The player can see as far as the farplane of the camera. And there is nothing there which is... boring.

I wanted to Plant a couple of trees which move with the player (but not rotate with them).

But I would need tons of trees for that, and that would destroy performance.

Next I've thought about a "foggy-shadow", or a light or a cubemap with textures of things.

But those things are visually totally ugly.

Now I am in front of a hard decision and I dont know what to do.

Here are examples of infinite terrain so you guys know what I mean.


texts: Bitmap Font Displays in Center Always Without Coding it Manually (Fix Coordinate Problem onText)

texts:
Is there a way on how to stay the texts in center without manually coding it or something, especially when making an update? I'm making a display for the highest score. Let's say that the score is 9. However, if the score is 9,999,999, the text displays still only at the fixed X and Y coordinate. Is there really a way to stay the text in center especially when there is changes when a player beats the new world record?

Here's my code inside Sprite Batch:

        font.setScale(1.5f);
        font.draw(batch, "HIGHEST SCORE:", (900/10)*1 + 60, (1280/16)*10);
        font.draw(batch, "" + 9999999 + "", (900/10)*4, (1280/16)*8);

        batch.draw(grid_guide, 0, 0, 900, 1280); // --> For testing purpose only.

        // Where 9999999 is a new record score for example.

Here's the image shown as example. I add it some red grid so that I could check if the display of score when updated will always display on center no matter how many digits takes place in. However, it is fixed, so I have to figure it out how to display it automatically on center regardless of the number of digits while updating for the new highscore. I have used the LibGDX preferences very well though to save and load records for the highscore.


texts: Fragment shader seems to floor() imprecisely

texts:
I'm trying to interpolate coordinates in my fragment shader. Unfortunately if close to the upper edge the interpolated value of fVertexInteger seems to be rounded up instead of beeing floored. This happens above approximately fVertexInteger >= x.97.

Example:

floor(64.7) returns 64.0 --> correct
floor(64.98) returns 65.0 --> incorrect

The same happens on ceiling close above x.0, where ceil(65.02) returns 65.0 instead of 66.0.

Q: Any ideas how to solve this?

Note:

GL ES 2.0 with GLSL 1.0
highp floats are not supported in fragment shaders on my hardware
flat varying hasn't been a solution, because I'm drawing TRIANGLE_STRIP and can't redeclare the provoking vertex (only OpenGL 3.2+)

Fragment Shader:

varying float fVertexInteger;
varying float fVertexFraction;
void main() {

    // Fix vertex integer
    fixedVertexInteger = floor(fVertexInteger);

    // Fragment color
    gl_FragColor = vec4(
        fixedVertexInteger / 65025.0,
        fract(fixedVertexInteger / 255.0),
        fVertexFraction,
        1.0 );

}


texts:
I tried to find a precise definition. I found clues on Wikipedia and on Gaming SE, but I cannot find more than an approximation like:

  Equivalent of blockbuster movie in cinema, an AAA game is a game with highest development budgets and levels of promotion.

The definition seems imprecise. How can I be sure a game is AAA?

Let's imagine a small indie studio making games and growing up. They hire more and more people through the years and invest more and more money in their game. At which milestone would their game be considered as AAA?


texts:
I am learning 3D at the moment. It is going well but I am stuck on the viewing of the camera.

I have two cubes, one next to each other made up of vertices, all the faces/triangles in the cubes are clockwise vertics so that when you move around the box, only 1 or two sides are visible at once. But, here's the problem, if I look at the cubes from the right, I can see a face of the cube that is further away. Like pictured below,

What would be the best way to deal with this, and are there any tutorials that could help me please?

Thanks in advance


texts: How can I draw a model perpendicular to a sloped surface?

texts:
Possible Duplicate:
  How do I find rotation in 3D based on a vector/normal?

My models are axis-aligned. I know the normal of the surface I want to draw them on.

How do I compute the rotations or rotation matrix that I should use to draw the model perpendicular to the surface?


texts:
I've seen in some other simple 2D games that a "tick" method is used to sync game logic and graphics rendering.  My main reason for using this is due to my collision detection malfunctioning, since the player entity will completely pass through solid objects unless I tap the controls almost pixel-by-pixel to collide the rectangles.

I figure a tick method will slow the games rapid updating enough to pick up these slight collision detections.

How do I create such a method? I've tried the code you can see below, however, it is causing the entire game to freeze:

The update method:

 @Override
    public void update(float deltaTime) {
        List<TouchEvent> touchEvents = game.getInput().getTouchEvents();
            long lastTime = 0;
            long currentTime = 0;

        if (state == GameState.Ready) {
            updateReady(touchEvents);
        }
        while (state == GameState.Running) {
                lastTime = currentTime;
                currentTime = System.currentTimeMillis();
                deltaTime = currentTime - lastTime;

                player.update(touchEvents, deltaTime);
                repaint(deltaTime);
        }
        if (state == GameState.Paused) {
            updatePaused(touchEvents);
        }
        if (state == GameState.GameOver) {
            updateGameOver(touchEvents);
        }
    }

The repaint method, which is updated while the regular paint method does nothing.  I've tried the while loop with both, doesn't seem to stop freezing:

public void repaint(float deltaTime) {
        Graphics g = game.getGraphics();

        if(deltaTime >= 60) {
            g.drawRect(0, 0, 805, 485, color.black);
            map.loadMap(getXScroll(), getYScroll(), g, game);
            map.loadEntities(getXScroll(), getYScroll(), g, game, map);
            g.drawImage(Assets.bitSoldier, 448, 256);
            g.drawImage(Assets.dpad, 0, 280);

            // Secondly, draw the UI above the game elements.
            if (state == GameState.Ready)
                drawReadyUI();
            if (state == GameState.Running)
                drawRunningUI();
            if (state == GameState.Paused)
                drawPausedUI();
            if (state == GameState.GameOver)
                drawGameOverUI();
        }
    }


texts: How to call the logic of a class into another class?

texts:
I am new to c# game development and just start. I decided to start with the basics, Console Applications.

I am try trying to recreate a game created by Lincoln Li and it's called Mr Sprinkle's Great Escape.

There are 2 classes Stats (An attribute system) and Death where they kind of linked together. Here is the snippet of the code:

Stats

private static int thirst;

    static public void ThirstLevel()
    {
        Console.WriteLine("Your thirst level is: {0}", thirst);
    }

    static public void DecreaseThirstLevel()
    {
        thirst--;
        Console.WriteLine("Your thirst level is: {0}", thirst);
        if (thirst == 20)
        {
            Console.WriteLine("Your thirst level is 2/3 gone!");
            Console.WriteLine();
            Console.WriteLine("You're getting thirsty!");
            Console.WriteLine();
        }
        else if (thirst == 10)
        {
            Console.WriteLine("Danger! Danger! Your thirst level is 1/3 gone!");
            Console.WriteLine();
            Console.WriteLine("Better go get some water!");
            Console.WriteLine();
        }
        else if (thirst <= 0)
        {
            Console.Clear();
            Death.DeathByThirst();
        }
    }

Now my question, is how will I implement Death.DeathByThirst in the Death class. How will I proceed to call the logic of the Stats class to Death Class?

So far I'm stumped here :/

 static public void DeathByThirst()
    {
            ???
    }

Your help will be appreciated! :)


texts:
Not a great title but couldnt think of a shorter way to describe it.

I am trying to think of the best way to determine the shape of items placed in the players inventory. I guess the best examples to explain would be something like the Horadric Cube in Diablo 2 or I suppose also, the Workbench in Minecraft. There are others, I just can't remember them.

Currently the best way I can think of involves multiplying the cell numbers each item is in. This way I can look at the product of that multiplication and know from a short list of values, what shape the items are in.

Example

My inventory is ordered like so:

1 | 2 | 3
4 | 5 | 6
7 | 8 | 9

I would also have various arrays of preset values like:

FourSquares - 40, 180, ..., ...
VLines - 28, 80, ...
HLines - 6, 120, ...
Backslash - 45
Forwardslash - 105

etc, etc

So, say the user places items in 1, 2, 4 and 5 - That would give 40 and I could loop through each shape array and determine that it matched a value in the FourSquares array and go from there.

Does this seem like the best way to do it? Is there maybe a way that I wouldnt have to loop through the arrays? Would this be possible with bitwise operations maybe?


texts: Unity2D: wait for coroutine to finish to activate it again

texts:
is there a way to start another coroutine once the last coroutine is finish. I have a button that activates a coroutine, the button can be pressed any time you want, when pressed you activate a coroutine. However I notice that when you press the button twice the coroutine  happens twice, which is not want I want. Is there a way to make sure that once my Boomerangeffect(coroutine) is activate the coroutine  can't start (if button is pressed) until the present coroutine is finished.

public GameObject BoomerangOn, BoomerangOff;
public static int buttonCount = 4;
static int timesActivated =  0;

void Start()
{
    if (PlayerPrefs.HasKey ("boomerangbutton")) {
        buttonCount = PlayerPrefs.GetInt ("boomerangbutton");
    }
}

void Update()
{
    PlayerPrefs.SetInt("boomerangbutton", buttonCount);
}

public void Activated ()
{
    if(timesActivated < buttonCount)
    {
        timesActivated++;
        StartCoroutine(BoomerangEffect());
    }
}

IEnumerator BoomerangEffect()
{

        BoomerangOn.SetActive (true);
        yield return null;
        yield return new WaitForSeconds (10.0f);
        yield return null;
        BoomerangOn.SetActive (false);
        yield return null;
        BoomerangOff.SetActive (true);
        yield return null;
        yield return new WaitForSeconds (1f);
        yield return null;
        BoomerangOff.SetActive (false);
        yield return null;
}


texts: Unity 2D ROPE connected to moving platform

texts:
Hey guys I have realy big problem with my rope. I use a hinge joints 2D to create my rope and distance joint  to connect it with moving platform.

On moving platform I have a distance joint that show on a first chain joint, so that allows move platform and rope should fallow that platform.

Problem is that, when I will move platform then joints connection will brake and joints goes crazy. Is there any solutions for that ??

When I will move than green circle which is on image 3 then all joints go crazy :


texts: How to customize player script with different abilities in each scene?

texts:
I'm making a game with Unity. I wanted the player script to not have some features in some scenes but couldn't remove them from the script because I needed them for other scenes.
So far, I just unpacked those player prefabs, created new scripts for each of them and removed the lines that I didn't want to have. I know this was not the best idea but I don't know any other way. One of its problems is that it makes managing the scripts hard and confusing.
Is there a way that I can change them without creating new ones? Since I'm going to switch to the new Input system, I want to avoid the possible problems and headaches around these scripts. I also did this (creating a new script) for pause menu script as well. I provided two examples below to make the situation more clear.
Example A) The player can use a shotgun in one of the scenes and I chose to not let him to use the knife in there. So I created a new script for that player and copied and pasted the original script (which had the melee attack ability) and then removed those lines from the new script.
Example B) Pause menu can disable the health bar game object whenever the escape button is pressed. But for one of the levels, I don't want to use the health bar, so I pasted the code in a new pause menu script and removed the line that disables the bar.


texts: Texture2D GetPixels - Finding pixels that are not transparent. Problem as finding more than expected

texts:
I am trying to make a level design system where I use a low resolution png file with certain pixels filled. My code will turn this location of the pixel in the image into placement of platforms in my game.

But I test the following code with a png i made with only 1 pixel in it (the rest are transparent). But the result is it finds 4 every time. Is it possible there is a discrepancy between the Gimp png and the texture that Unity sees. (In GIMP I used pencil 100% hardness 1px width. There are also settings for 'resolution' of the image, which i left at defaults):

public class LevelBuilder : MonoBehaviour
{
public Texture2D sourceTex;
Color32[] pixels;
int pixelsFound = 0;

private void Start()
{
    pixels = sourceTex.GetPixels32();
    for (int i = 0; i < pixels.Length; i++)
    {
        if (pixels[i].a != 0)
        {
            Debug.Log("found colored pixel. total: " + ++pixelsFound);
        }
    }
}
}


texts: How to create a main menu using java swing

texts: I have been trying to figure out for quite some time on how to create a basic main menu for a game that just has a couple clickable labels, but I don't know how to write them. I have created a class that extends JFrame, made a JLabel and that is it. I don't know much to do after that.


texts: How to make sure a game can be completed

texts:
I'm not sure what the correct term for what I'm looking for is described, so apologies if this is a duplicate question. But is there a term/algorithm for making sure a game is "completable" with relation to an infinite scroller. What I mean by completable is that, if I had a game, where a user has to keep jumping up blocks as the screen tries to catch up with them, how would I ensure that there is always a reachable new block that the user could in theory jump to?

I know in theory I would check how high the user can jump and ensure there is a block within that reach, but is there anything else to it? i.e avoiding expensive checks when placing new blocks to make sure they're not overlapping etc?

I'm specifically looking at html5/js but I wondered if there was a term for this or a specific type of algo that I could investigate?

Thanks


texts: Logic at a low framerate with interpolated rendering at higher framerate

texts:
It takes too much processing power to do game logic on every rendered frame (60fps), so what if I made my game save frames?

It would actually calculate important stuff 20 times a second, and the render loop just interpolates the 2 frames in-between to make it look like 60fps.

Is this a good idea for improving game performance?


texts: How to calculate Camera "correct" position and distance to Frame all my Scene?

texts:
Consider I have N dynamic points on my Scene, I would like to "frame" all them, with my Camera.

How can i calculate (at runtime) Vector3 Position to correctly frame all my scene ?

This is my idea:

Calculate Avarage for all my points
Move my Camera "up" to correctly "frame" all my points  (i don't know how)
Use Unity LookAt(myAvaragePoint)

Thanks


texts: If statement causing xna sprites to draw frame by frame

texts:
I’m a bit new to XNA but I wanted to write a simple program that would fire a cannon ball from a cannon at a 45 degree angle. It works fine outside of my keyboard i/o if statement, but when I encapsulate the code around an if statement checking to see if the user hits the space bar, the sprite will draw one frame at a time every time the space bar is hit.

This is the code in question

if (currentKeyboardState.IsKeyUp(Keys.Space) && previousKeyboardState.IsKeyDown(Keys.Space) && !skullBall.Alive)
        {
            //works outside the keyboard input if statement   //{
            skullBall.Position = cannon.Position;
            skullBall.DeltaY = -(float)(Math.Sin(MathHelper.ToRadians(45)) * 50/*39.7577*/ * time + 0.5 * (gravity * (time * time)));
            skullBall.DeltaX = (float)(Math.Cos(MathHelper.ToRadians(45)) * 50/*39.7577*/ * time);
            skullBall.Alive = true;           //}
        }

The skull ball represents the cannon ball and the cannon is just the starting point. DeltaX and DeltaY are the values I’m using to update the cannon balls position per update. I know it's dumb to have the cannon ball start at the cannons position every time the update is called but it’s not really noticeable right now.

I was wondering if after examining my code, if anyone noticed any errors that would cause the sprite to display frame by frame instead of drawing it as a full animation of the cannon ball leaving the cannon and moving from there.


texts: Calculating Friction due to rotation from ball bounce?

texts:
In this question asked by codemonkey, The rotation will depend upon:

upon impact, on:

Initial Speed of the ball hitting the surface (magnitude of ball velocity vector)
Friction co-efficient of ball & surface (constants for simulation)
Angle between ball impact velocity vector and the surface normal

Everything is fine except for second point. How the friction coefficient of ball and surface should be taken into account?

EDIT: The problem with my approach is i donot know the impact time of the collision. If say the time of impact is dt, Vn1 is the final velocity parallel to the surface then

mass*(Vn1-Vn0)/dt X r = torque

Then i can calculate the angular velocity produced by this torque if it acts for dt time.

also

Vn1= Vn0 + accelaration* dt

where

accelaration+angular_accelaration*r

Please correct me if i am wrong. Also how do i calculate dt?


texts:
So I have been trying to reset this timer but for some reason I can't figure out why it isn't resetting.

Thanks,

public class controlborder : MonoBehaviour
{
    //varibles
    public static int time; //<== here I create my timer
    public static int random;
    public static bool boolreset = true;
    //varibles
    //get objects
    public SpriteRenderer m_spriteRenderer;
    //get objects

    public void Start()
    {
        m_spriteRenderer = this.GetComponent<SpriteRenderer>();
        StartCoroutine(Changecolortimer(2f));
    }

    IEnumerator Changecolortimer(float loopdaelay)
    {
        while (boolreset)
        {
            yield return new WaitForSeconds(1);
            time++; //<== here is set a interval
            if(time == 3)
            {
                boolreset = false;
                resettime();
            }
        }
    }
    public void changeColor()
    {
        if (random == 1 && time == 1)
        {
            m_spriteRenderer.color = Color.blue;
        }
        else if (random == 2 && time == 2)
        {
            m_spriteRenderer.color = Color.red;
        }
        else if (random == 3 && time == 3)
        {
            m_spriteRenderer.color = Color.green;
        }
        else if(random == 4 && time == 4)
        {
            m_spriteRenderer.color = Color.yellow;
        }
    }

    public void Update()
    {
        random = Random.Range(1, 4);
        changeColor();

    }

    public void resettime()
    {
        time += 0;
        boolreset = true;
        Debug.Log(time);
    }
}


texts: How do I build a matrix to translate one set of points to another?

texts:
I've got 3 points in space that define a triangle. I've also got a vertex buffer made up of three vertices, that also represent a triangle that I will refer to as a "model".

How can I can I find the matrix M that will transform vertex in my buffer to those 3 points in space ?

For example, let's say my three points A, B, C are at locations:

A.x = 10, A.y = 16, A.z = 8
B.x = 12, B.y = 11, B.z = 1
C.x = 19, C.y = 12, C.z = 3

given these coordinates how can I build a matrix that will translate and rotate my model such that both triangles have the exact same world space ? That is, I want the first vertex in my triangle model to have the same coordinates as A, the second to have the same coordinates as B, and same goes for C.

nb: I'm using instanced rendering so I can't just give each vertex the same position as my 3 points. I have a set of three points defining a triangle, and only three vertices in my vertex buffer.


texts: I can draw the outline of an ellipse but I want to draw a filled in ellipse, but I can't seem to get the code to work. Any help would be great! I am using DirectX 9 and D3DX.


texts: Sever-side physics simulation and client 'inputs' send rate in a fast multiplayer game

texts:
I am building a very tiny first-person multiplayer game. I'm just aiming to get the basic rights: client-side prediction and reconciliation + entity interpolation. I have read many articles on these topics but I have a question that I can't find answer for. Consider the following problem:

There's a queue on the server where the client inputs are stored (movement keys + camera vectors)
Server runs the physics simulation 60 times per second. This means that each input from a client will be simulated for 16.6 ms.

Now, consider that I have two clients: one with a beefy computer able to run the game loop 100 times per second, and a slower one that is only able to run it 30 times per second.
My game will send the 'client inputs' packet to the server on every iteration of the game loop. This means that the 100 fps client will send 100 packets, while the 30 fps client only 30.
What this means is that the fast client will get more simulation time on the server, since each input is simulated for 16ms. So the fast client will move significantly more than the slower client.
What is the appropriate way to design the 'client input' packet send rate? What is a solution that ensures that fast clients and slow clients receive an equal or roughly equal amount of simulation time?
Thanks for your time!


texts: Play animations from the same blender file separately in unity

texts:
I am making a building in blender to use in unity. The building has 2 different doors with different armatures. They also have their own opening animation. I want to play one door animation at a time when the player chooses to open one of them. But when I play the opening animation on one of them they both play the opening animation. How can I get them to play their animation separately?
All of the objects are located in the same blender file.


texts:
A few questions from LibGDX newbie:

How do you deploy a Mac/Windows app? If Mac app, can this be deployed to Mac App Store?
Do you need to pay monthly (for RoboVM) for iOS development/deployment?

I am using Android Studio. Thanks!


texts:
How is an economy system implemented in clicker games? Obviously, you can't store values like 1 Quintilian in long type. I understand that there might be some string operations or even better, some int array where every index has it's value, though I'm curious if there are better methods and what they are.

Also, how to make this system generic and reusable for any other clicker or not clicker game.

And about bonus system, for example, 50 000% increase, I bet it's a bad idea to multiply this value every frame for every other kind of object that generates game currency.

How is this system implemented as well? If you have different sources of bonuses, do you have modifier object that multiplies values?


texts:
I'm using Unity 5 and want to disable a script called Unit based on whether the instance is a client or a server. I have tried using:

GetComponent("Unit").enabled = false;

However I get hit with this error:

  Assets/Scripts/DisablingUnitScriptIfPlayer.cs(14,46): error CS1061: Type UnityEngine.Component' does not contain a definition for 'enabled' and no extension method 'enabled' of type 'UnityEngine.Component' could be found (are you missing a using directive or an assembly reference?)

Looking at some tutorials, this worked in previous versions, but I can't find how to make this work for Unity 5. What do I need to change?


texts: Render hands and gun in front of everything

texts:
I'm currently learning about Unreal Engine 4 by making an FPS game.
How can I render the player character's hands and gun on top of everything?
Currently when I walk up to a wall, the hands and gun can clip into the wall like this:

I want it to look like this, where even when the player is facing into a wall, the hands and gun stay on top:

How can I achieve this?
Update:
Found this solution:

Render the meshes at the end of the depth-only prepass with depth testing disabled and tagging those pixels in the stencil buffer. Then enable stencil test in the base pass to not touch those pixels. At the end of the base pass you turn off stencil test and render your foreground meshes with depth testing enabled to get their properties in the gbuffer."


texts:
In a 3D SDL application I inherited (I have little 3D or SDL experience), I have a 'screenshot' routine that either saves a full-size image or a scaled image, depending on the context (differing key-press).  To save a full-size (i.e. graphics-mode-sized) screenshot I'm using:

SDL_SaveBMP(SDL_GetVideoSurface(), SDL_RWFromFile(filename.c_str(), "wb"), 1);

This works exactly as-intended, and saves an 8-bit bitmap (the display mode is always 8-bit, for another reason entirely) as expected.

However, in order to resize the image, I'm making use of a library that came heavily recommended in several places when searching for a suitable surface-/image-resizing library for SDL: SDL_Resize.

I'm implementing this as such:

SDL_Surface *toResize = SDL_GetVideoSurface();
SDL_Surface *resized = SDL_Resize(toResize, (int)w, (int)h);

SDL_SaveBMP(resized, SDL_RWFromFile(filename.c_str(), "wb"), 1);
SDL_FreeSurface(resized);

This works mostly as intended.  It saves a resized, 8-bit bitmap, seemingly with the correct palette.  However, the colours in parts of the image are incorrect, e.g.

Now, I don't need the output images to be 8-bit, I'd be perfectly happy with a 24-bit or 32-bit bitmap, if I could solve this problem; but I can't find out the answer to either of these questions:

How do I convert an SDL surface to a different bit-depth?
How do I ensure that the output image displays the colours correctly after resize?

I'm anticipating that I may have to settle for a higher-bit-depth bitmap, and that's fine... but a few pointers in the right direction would be fantastic.

Many thanks!


texts:
I have a very general question about how game classes interact with eachother in a growing RPG game project I'm working on. (Writing it in java/Slick2D, not that is matters because the question is about the concepts)

I have a lot of classes, to name a few, a game class that stores the main game loop that updates all the objects and other classes like player, enemy, HUD, etc. Some variables (mostly ones from Player) are needed in other classes. For example, I need to get the player name, level, xp many times in other classes; my HUD needs the player info to display, I have a class to execute ingame cheat commands such as giving player xp, and my Inventory HUD needs to get the players inventory items to show, etc.

To summarize, what are some general pointers when it comes to getting variables from other classes. Lets say playerXP: my World class declares and holds a Player class, but there are so many other classes, unrelated to the player but still need to get player information. I don't want to make the playerXP public because then some class might accidentally change it. I just need to be able to access player info from many other classes.


texts: Tile detection on a 2D isometric layered diamond shaped map - What are the math?

texts:
What are the math for tile detection on a 2D isometric layered diamond shaped map ?

Here is an image of a layer (this is an image from an old folder, I didn't write the display yet for my current project, so it's incomplete but you get the idea) :

A layer

I have them staggered on top of each other.
Tile detection could works with a loop but it would take too much time. The basic math for floor tiles doesn't work.

A layer is composed of a tiles(array) :

A tile_size * tile_size image representing a 3D square.

A long time ago I asked this question with an account I'v lost unfortunatly and I  had one answer :

Create an hollow ground

But I never understood what that was and when I type "tile detection hollow ground" on google, I got nothing.

I also found several solution I do not understand the concept :

Ray scan on neightbours (I know the theory for ray scanning, but neightbours ??? All of that sounds very difficult for me)
using color mask for a pixel perfect detection (no time to implement such a method)

So, was left the math. And here I'm stuck. I'm looking at my formula 'isometric to screen' conversion(for display), hoping a miracle ha ha :

int x = (i - j) * TILE_SIZE_HALF,
    y = (i + j) * TILE_SIZE_QUARTER - (layer_id * TILE_SIZE_HALF);
//This one is totally working

Anyway, is there even a formula able to solve tile detection for such a map ?
Am I missing something ?

What I'm looking for :

   //With given x & y (mouse coordinates on screen)

    int i = ?,
        j = ?,
        layerID = current_layer_index,
        //tile's index in tile array(layers are tile arrays) :
        tileIndex = calculated from I & J;
        //Where goes the offsets in these calculations ?

How am I gonna know which layer the tile is from ?

I decided to only edit the selected layer (current_selected_layer variable) and then check if the tile is empty. If yes, I'll select the "same tile" but the layer under the selected one and so on.
Now the problem should be less complicated since it's like there is only one layer. What bother me are the map offsets.

EDIT : I didn't tought about the corner... This is not gonna work. If I don't find a solution, I'll maybe switch to classic 2D. Sounds very complicate to code tile selection with isometric map.

There is another problem I have no idea how to handle these :

(this is a layered map, the screen do not represent the final result)

End note: Pseudo code is welcome. Also, consider you have all informations about the map. Since I use a pseudo MVC code, I have access to all data everywhere (tile size, layers number, etc...). There is no restriction.


texts:
In 2D everything is easier to understand. I'm not enought experienced to join people who say that 3d is the same: you JUST need to add a dimension - THAT adding a dimension is my problem, bacause I can't easily visualize (or draw on paper) the situation I'm dealing with. So please don't say it is the same.

First let's talk of a concrete situation.

Use case: bounding sphere intersection

I have two entities colliding with theirs bounding sphere intersecting at a certain point. Let's consider two vectors, the velocity of the first entity v1 and distance between boundingsphere centers d. If I want to get v1 component along d I may want to do

V1 * Math.Cos(alpha)

with alpha = Math.Atan2(...)

a. My questions come now. Math.Atan2(...) takes 2 arguments, the
    first is the difference between Xs and second is the difference
    between Ys of the two vectors involved. So, since I'm working in 3D
    and not in 2D, should I assume that common practice is to consider a
    pair of dimenstion at time when dealing with angles in 3D? Since I'm
    a bit confused here, can someone tell me what's the best practice to
    follow in this case? (details would be appreciated here).

b. Then I have some information I'd like someone to confirm. When my
    double angle value is returned from the Math.Atan2(...), I have my
    angle in radians. I read somewhere that this float value varies
    between +- Pi, reasonable. And also that Math.Atan2(...) always
    consider the lesser between the 2 angles, which is not important if
    you need to calculate Cos(angle) but you must keep it in mind if
    you wants to get the Sin(angle). Is this how things work?


texts: What causes sprite tearing / corruption in unity PC stand alone running on Windows XP?

texts:
The image below is representative of my client's experience running the released version of an app I created for him on his Windows XP Machine.

I built it using Unity 4.5.  The messed up buttons are the product of a png import to a sprite render all done using the Unity editor.  I created the sprites at a resolution of 1024X96 and scaled them down using the editor.  I have the applications default resolution set up for 800X600 windowed and the user can resize the game window.

I cannot seem to recreate the problem using the editor or a release on my local machine.  He said it worked fine on his Windows 7 Machine, though he said the text looked blurry.  Any thoughts?


texts:
How I can make a b2Body in box2d so that it could form a ring which does not collide from the center just like a ring. like when we flick the object and there's another body (like pole), the pole can go inside from the ring.

like this:


texts: How to create a mathematical mechanism in order for a game to be balanced?

texts:
For example, in a game like Diablo, how did they decide how much damage each skill does?
Is it the amount of clicks that the player needs to do? Or maybe the expected lifetime of a player? Maybe calculate the probability that the player will die?


texts:
I feel like most will think this is a dumb question but I'm really curious.

Are levels made of just multiple textures or just a collection of models that make up the whole area? I'm working on creating assets at this point and I feel like this is a question I should ask now because I get to deep in the wrong direction. (if i'm headed there)

Example,
Lets say I wanna make level setups like those in Bastion, would that be models that
represent each area of the map? Or possibly one big model for each square area?


texts:
I am following this guide:

http://www.cocos2d-iphone.org/wiki/doku.php/prog_guide:tiled_maps

Trying to create a tiled map that also supports multiple layers. The guide says that a way is to use depth buffer, and says to:

1) Create the z-buffer and a 2D projection;
2) For every layer in the tiled map, set the cc_vertexz attribute;
3) Enable alpha test and set the sprite alpha func.

The first question is: if I use a tiled maps with multiple layers, are also the point 1 and 3 needed?

I am fine with the first two points, but as for the third point I don't know how to do that. I should subclass CCSprite and override the draw method, but the problem is that when I create a tiled map there are already sprites on it, so the instances don't belong to the subclass I created. How I go around this?


texts: How to implement pixel art lighting as in the game Project Eastward?

texts:
Project Eastward Lighting Demo

Can somebody point me to the right direction as to how this lighting is done to recreate this lighting effect?
The game is 2D but uses a 3D lighting system.


texts: Display and render only a specific object in wireframe in Unity3D

texts: I want to know how to view and render a specific game object (mesh) in wireframe, not the whole scene. I can change the scene to wireframe using GL.wireframe but the problem I want to view and render only a certain object (not the whole scene) in wireframe. Any advice please?


texts: How can I mod a game to render only certain pixels during pixel shader stage?

texts:
I am a gamer and hobbyist programmer in game dev and deep learning algorithms.

I want to train a deep learning algorithm like DLSS from NVIDIA, which can render a complete frame by taking certain pixels of the frame. The logic is that since all the pixels are not rendered, it gives higher frame rate.

But first, I want to know how I can mod an already created game to force it to render only certain pixels.


texts:
I'm trying to implement a voxel engine in C++ using OpenGL, and I've been working on the rendering of the world. In order to render, I have a 3D array of uint16's that hold that id of the block at the point. I also have a 3D array of uint8's that I am using to store the visibility data for that point, where each bit represents if a face is visible. I have it so the blocks render and all of the proper faces are hidden if needed, but all of the blocks are offset by a power of 2 from where they are stored in the array. So the block at [0][0][0] is rendered at (0, 0, 0), and the block at 11 is rendered at (1, 1, 1), but the block at [2][2][2] is rendered at (4, 4, 4) and the block at [3][3][3] is rendered at (8, 8, 8), and so on and so forth.

This is the result of drawing the above situation:

I'm still a little new to the more advanced concepts of C++, like triple pointers, which I'm using for the 3D array, so I think the error is somewhere in there. This is the code for creating the arrays:

uint16*** _blockData; //Contains a 3D array of uint16s that are the ids of the blocks in the region
uint8*** _visibilityData; //Contains a 3D array of bytes that hold the visibility data for the faces

   //Allocate memory for the world data
_blockData = new uint16**[REGION_DIM];
for (int i = 0; i < REGION_DIM; i++)
{
    _blockData[i] = new uint16*[REGION_DIM];

    for (int j = 0; j < REGION_DIM; j++)
        _blockData[i][j] = new uint16[REGION_DIM];
}

//Allocate memory for the visibility
_visibilityData = new uint8**[REGION_DIM];
for (int i = 0; i < REGION_DIM; i++)
{
    _visibilityData[i] = new uint8*[REGION_DIM];

    for (int j = 0; j < REGION_DIM; j++)
        _visibilityData[i][j] = new uint8[REGION_DIM];
}

Here is the code used to create the block mesh for the region:

//Check if the positive x face is visible, this happens for every face
//Block::VERT_X_POS is just an array of non-transformed cube verts for one face
//These checks are in a triple loop, which goes over every place in the array
if (_visibilityData[x][y][z] & 0x01 > 0)
{
    _vertexData->AddData(&(translateVertices(Block::VERT_X_POS, x, y, z)[0]), sizeof(Block::VERT_X_POS));
}

//This is a seperate method, not in the loop
glm::vec3* translateVertices(const glm::vec3 data[], uint16 x, uint16 y, uint16 z)
{
    glm::vec3* copy = new glm::vec3[6];
    memcpy(&copy, &data, sizeof(data));

    for(int i = 0; i < 6; i++)
        copy[i] += glm::vec3(x, -y, z); //Make +y go down instead

    return copy;
}

I cannot see where the blocks may be getting offset by more than they should be, and certainly not why the offsets are a power of 2. Any help is greatly appreciated. Thanks.


texts:
In my engine I create infinite terrain with usage of Perlin noise alghoritm computed on CPU.

Creation of terrain goes like this:

If camera is near unloaded patch, create it
Compute 513x513 noise array with given boundaries
Compute normals, tangent, binormal, indices
Pass data to vbo

Pros:

Only needs to be rendered when needed
Easy to make collision

Con

Slow 64 513x513 patches are created in 3,1s(one thread). For each tile ~20ms noise creation, ~25ms vertices, normals, tangent, bitangent, indices. When camera moves fast, user can notice tiles loading.
memory consuming???

Now I was wondering how to speed this up by generating terrain completely on GPU
But there are some doubts:

If shaders run every frame, isn't this computation power waste to compute noise over and over? This can be avoided by writing result into RBGA texture and used later in vertex shader for displacement, but increase memory usage. From the other hand if the creation would be super fast, only visible tiles should stay in memory. However detaching buffer causes gpu-cpu sync which may slow down the app (am I right?)
If the terrain is just a flat grid displaced by vertex shader, the same work needs   to be done on CPU to compute height and normal at given point for collision.
This is just a concept, but to speed everything up I was thinking about projecting grid on viewport so only minimal amount of vertices is used. Do you think this would work?

My final question is:

What the best/fastest/broadly used technique to create infinite terrain on GPU?


texts: Are there any advantages to different programming paradigms specifically releated to game programming?

texts:
I have been researching three different programming paradigms namely procedural, object oriented and functional. So far I have been able to find a lot of good information regarding general differences and advantages/disadvantages like readability, re-usability, difference in learning curve, program size, etc.

I am now looking for differences more related to game programming, but I am struggling to find good examples. Does anyone know of specific issues when programming games that these paradigms handle differently, that I could look into? This could include things like handling I/O, rendering and programming AI, but other things related to game programming would also be appreciated.


texts:
This is a general question, but as a specific example, I'll use the XNA Particles3D sample (http://xbox.create.msdn.com/en-US/education/catalog/sample/particle_3d).

What is the point of the index buffer in a particle system? If the advantage is indexing repeated vertices, wouldn't only a connected mesh take advantage of these? The probability that the vertices in a particle system will be shared for extended periods of time is extremely low.


texts: Libgdx Music error QCMediaPlayer mediaplayer NOT present

texts:
Problem solved with music = Gdx.audio.newMusic(Gdx.files.internal("song.mp3"));

I am looking for music implementation in my app with LibGDX. I saw the guide provided in LibGDX documentation but it doesn't work for me and this is my code :

public class GameScreen implements Screen {

    Music music;
    public GameScreen(MyGdxGame game)   {

        music = Gdx.audio.newMusic(Gdx.files.local("assets/song.mp3"));
        music.play();

    }

When I run my code it returns me this error :

    at com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:124)
            at GameScreen.<init>(GameScreen.java:62)
            at FirstScreen.render(FirstScreen.java:99)
            at com.badlogic.gdx.Game.render(Game.java:46)
            at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
            at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
            at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
05-22 20:49:06.213  15534-15534/  E/SysUtils﹕ ApplicationContext is null in ApplicationStatus
05-22 20:49:09.358  15534-15572/ E/MediaPlayer-JNI﹕ QCMediaPlayer mediaplayer NOT present
05-22 20:49:09.374  15534-15572/ E/AndroidRuntime﹕ FATAL EXCEPTION: GLThread 10072

com.badlogic.gdx.utils.GdxRuntimeException: Error loading audio file: assets/song.mp3
            at com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:132)
            at .GameScreen.<init>(GameScreen.java:62)
            at .game.FirstScreen.render(FirstScreen.java:99)
            at com.badlogic.gdx.Game.render(Game.java:46)
            at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
            at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
            at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)
     Caused by: java.io.IOException: setDataSource failed.
            at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1076)
            at android.media.MediaPlayer.setDataSource(MediaPlayer.java:1022)
            at com.badlogic.gdx.backends.android.AndroidAudio.newMusic(AndroidAudio.java:124)
            at .game.GameScreen.<init>(GameScreen.java:62)
            at .game.FirstScreen.render(FirstScreen.java:99)
            at com.badlogic.gdx.Game.render(Game.java:46)
            at com.badlogic.gdx.backends.android.AndroidGraphics.onDrawFrame(AndroidGraphics.java:422)
            at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1522)
            at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1239)


texts: When I select one vertex it selects multiple vertices?

texts:
I'm trying to do some kind of a face. When I select a vertex it selects two other vertices. However, when I try to select one of the two other vertices it doesn't select them.

I want to move only one vertex to make it right.

My model is an editable poly.

Link to my model so if you want to inspect it properly.

Front view :

Linked vertices :


texts:
I have been researching on 2D Animation Blending technique similar to what Unity 4.3 has.
I know how Animation blending in 3D works but I have no idea how it works in 2D. How does 2D Animation Blending work?

Thank You.


texts: Nearest Vector3 to Vector3 from last frame

texts:
Suppose you have a Vector3 provider of pointcloud positions that update every frame - call it Nullable<NativeSlice<Vector3>> pointClouds
Say you want to use particles whose emitters create continuous animation effects, how do you find the nearest Vector3 in the current frame for a previous frame's point cloud particle to "migrate" there (instead of being destroyed and re-created each frame)?


texts: I have my mouse coords converted to world coords. Now how do I detect objects with it? (C++, OpenGL, FreeGlut)

texts:
I found a way to convert my mouse coordinates to world coordinates that I can easily understand but now I need to know how to use it to check if the mouse is currently over any of my rendered objects.

Here is my mouse click code that converts the mouse coordinates to screen coordinates when the left mouse button is clicked.

code:

void mouseClick( int button, int state, int x, int y ){

//if any mouse button was pressed
if (button == GLUT_LEFT && state == GLUT_DOWN) {

GLint viewport[4]; //hold the viewport info
    GLdouble modelview[16]; //hold the modelview info
    GLdouble projection[16]; //hold the projection matrix info
    GLfloat winX, winY, winZ; //hold screen x,y,z coordinates
    GLdouble worldX, worldY, worldZ; //hold world x,y,z coordinates

    glGetDoublev( GL_MODELVIEW_MATRIX, modelview ); //get the modelview info
    glGetDoublev( GL_PROJECTION_MATRIX, projection ); //get the projection matrix info
    glGetIntegerv( GL_VIEWPORT, viewport ); //get the viewport info

winX = (float)x;
winY = (float)viewport[3] - (float)y;

//get the world coordinates from the screen coordinates
    gluUnProject( winX, winY, 0.0, modelview, projection, viewport, &worldX, &worldY, &worldZ);
    gluUnProject( winX, winY, 1.0, modelview, projection, viewport, &worldX, &worldY, &worldZ);

}
}

I've tested it to make sure that the coordinates are converting successfully, and it works fine!!!

As for the near and far planes I did double check that their coordinates are the same as defined in my glorthro.


texts:
I am fairly new to Unity2D and am making a 2D platformer to get used to the engine. I am trying to create a platform that moves when the player jumps on it, however, on the script for the platform the OnCollisionEnter2D method is just not being called. This is the script:
public class ThrustPlatform : MonoBehaviour

[SerializeField] float thrustSpeed;
[SerializeField] float thrustDistance;

Animator thrustAnim;
Rigidbody2D rb;

private bool thrust = false;
private Vector2 startPos;
private Vector2 targetPos;

void Start()
{
    thrustAnim = GetComponent<Animator>();
    rb = GetComponent<Rigidbody2D>();

    startPos = transform.position;
    float targetX = startPos.x + thrustDistance;
    targetPos = new Vector2(targetX, startPos.y);
}

private void OnCollisionEnter2D(Collider2D coll)
{
    Debug.Log("COLLISION");
    thrust = true;
}

private void FixedUpdate()
{
    if(thrust)
    {
        rb.velocity = new Vector2(thrustSpeed, 0);
    }
}

The player and platform are on layers that can collide with each other in the collision matrix, the player still lands on the platform, and the player has a dynamic rigid body and the platform a kinematic rigid body. As far as I am aware kinematic rigid bodies detect collisions from dynamic rigid body, I have watched tutorials where this works. Even if I change the platform rigid body to dynamic there is no detection. I have also tried using continuous collision detection on both rigid bodies but still it is not calling. If I change it to a trigger and use OnTriggerEnter2D however, the Debug line appears.
This is the rigidbody for the platform.

This is the rigidbody details for the player.

I am very confused as to why this isn't working and I can't find a solution anywhere else (unless I am missing something very obvious).


texts: Unreal Engine 4 - Error in Macro Syntax Causes Build to Hang

texts:
Problem
Errors in macro syntax causes the module's build to hang for 2+ hours (possibly, indefinitely) with no indication of a build error.
Steps to Reproduce

Create a template game project in the editor.
Introduce the following macro into some C++ code:

UE_LOG(LogTemp, WrongVerbosityTypeHere, TEXT("Some Text Here"));

Trigger a module-only build e.g. right-click project > Build.

Look for the following in the build output:

1>Using Visual Studio 2019 14.28.29335 toolchain (C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333) and Windows 10.0.18362.0 SDK (C:\Program Files (x86)\Windows Kits\10).
1>Building 4 actions with 32 processes...

The message should stay the same for 2+ hours. So wait for that long or until you feel something is wrong...

Remove or correct the macro usage with something like the following:

UE_LOG(LogTemp, Log, TEXT("Some Text Here"));

Trigger module-only build.

Build completes in seconds.

Development Environment

Windows 10 (Version 10.0.19042 Build 19042)
Visual Studio Community 2019 (Version 16.8.3)
Unread Editor 4.26 (Version 4.26.0-0+++UE4+Release-4.26)

Questions

Is this a known bug?
If not, is there a configuration in UBT via Visual Studio or in the terminal to report errors quickly?

Cross Postings
Unreal Engine Forums


texts: Finding the scale of pixels in map with given dimensions

texts:
For the game I am making, I have textures for planets. Each texture has a size of 2048 x 1024 pixels. I also know the size, thus the diameter, of each planet. Not every planet is the same size, you know.

What is the size in kilometers of one pixel?

I know it has to do with the circumference - but I'm not sure this translates into a scale.

For example, let's say a planet is 18,872 km in size, so it's a circumference of about 59258,08 km (diameter * PI).

Can anyone provide pointers in the right direction?


texts: ItemManager / Creating Managing Item Instances

texts:
I am looking for advice on how to proceed, currently in my project all items extend from a base ScriptableObject called BaseItem, this class has a property that holds the ItemPrefab for when the item is spawned in-scene.
[CreateAssetMenu(fileName = "BaseItem", menuName = "Item/New BaseItem")]
public class BaseItem : ScriptableObject
{
    public string name;
    public string id;
    [TextArea]
    public string description;
    public Sprite icon;
    public GameObject ItemPrefab;

    public virtual void Use()
    {

    }

    public virtual string GetDescription()
    {
        return description;
    }

    public string GetName()
    {
        return name;
    }
}

I also have "EquippableItems" that as you might have guessed are equippable by the player, these weapons/armour etc have "Rune slots" on them, where a player can slot in runes to alter the behaviour/stats of the equipment via the inventory.
The problem I have is, I am altering the Prefab of the weapon, when I only want this to effect the current item I'm modifying.
I know why this is occurring because I'm editing the prefab and not an instance of it, I know sort-of what I need to do to fix it, but I can't find many examples to learn from.
I belive I need some kind of Manager that handles creating specific instances of a prefab and assigning them an ID, but I do not understand how this would work for inventory items which is where you alter the runes.
Because;
A: all items are essentially "stateful" scriptable objects while in my inventory and
B: instantiating all the items in my inventory hiding them and referencing that instead seems like a silly way to go about it.
Example Scenario:
I have two metal katana's in my inventory, I right click one of the metal katana's and click "Manage Runes" and add a +5 Fire Damage rune, I "drop" both katana's so they are now spawned into the scene on the floor, both weapons have the +5 Fire Damage rune slotted.
How do I handle this scenario so only Katana #1 is slotted with the rune? I know it needs its own instance of that Prefab, but when do I create this while it's in-game but not in scene?
thanks for reading!
Apologies I feel this question is rather poorly worded but If I had the correct vocabulary for wording this then I could've done a better job of googling/github..ing.


texts: UE4 Blueprint / Variable Communication Issues

texts:
So I have a system set up in my game that whenever the character collects an object the monster begins to speedup and this is used for each object that player must pickup, although I'm having issues getting the variable for the monsters speed to change when the item is picked up

I need a system so that once the item is picked up it changes the float variable of the monsters movement so he moves faster, also the next item appears that is also able to speed up the monster

I've attempted using a blueprint userface which I assume is the right choice to go for, but I still don't fully understand it's workings

I'm still very new to blueprints so sorry if they seem all over the place

Any help is greatly appreciated!

Monster Blueprint for location and rotation, the variable 'Speedup' is the input that changes the speed of the monster

 Pickup Item Blueprint, a bit all over the place sorry for that I was testing tons of different methods but none of them turned out to work

 Pickup Item Function


texts: Dialogue System only plays the same words

texts:
I'm trying to modify brackeys dialogue system using raycast in an interactableOjects Script so that I can talk with multiple characters, however, when I talk to Character A it appears Characters B text and if I go to Character B the same text shows up (which in character B's Case wouldn't be a problem haha). is there a way that I can tell my script to identify both different objects and play different script (I mean without having to create different layers or tags)
InteractableObjects Script:
public void PersonInteract()
{
    int layer_mask = LayerMask.GetMask("Person");

    RaycastHit hit;
    if (Physics.Raycast(fpsCam.transform.position, fpsCam.transform.forward, out hit, range, layer_mask))
    {
        Debug.Log("Speak");

        FindObjectOfType<DialogueTrigger>().TriggerDialogue();

    }
}

DialogueTrigger Script(the one that is attached to the NPC's):
    using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class DialogueTrigger : MonoBehaviour
{
    public Dialogue dialogue;

    public void TriggerDialogue()
    {
        Debug.Log("Talk");
        FindObjectOfType<DialogueManager>().StartDialogue(dialogue);

    }

}


texts: What resources are available for iPhone development using AS3?

texts:
I've just realeased my first game developed for the iPhone using AS3 and the iPhone Packager http://itunes.apple.com/us/app/snapshot-paintball/id407362440?mt=8&uo=4

I want to take the game to the next level but I am not using the native iPhone SDK so I need some other ideas, I am fresh to iPhone development and it's hard to find good resources, any AS3 developers out there willing to share some links? Highscore frameworks and best practices, connecting to Facebook, ui classes/gestures. Thanks.


texts: Extract derived 3D scaling from a 3D Sprite to set to a 2D billboard

texts:
I am trying to get the derived position and scaling of a 3D Sprite and set them to a 2D Sprite.

I have managed to do the first part like this:

        var p:Point = sprite3d.local3DToGlobal(new Vector3D(0,0,0));
        billboard.x = p.x;
        billboard.y = p.y;

But I can't get the scaling part correctly. I am trying this:

        var mat:Matrix3D = sprite3d.transform.getRelativeMatrix3D(stage); // get derived matrix(?)
        var scaleV:Vector3D = mat.decompose()[2]; // get scaling vector from derived matrix
        var scale:Number = scaleV.length;
        billboard.scaleX = scale;
        billboard.scaleY = scale;

...but the result is apparently wrong.

PS. One might ask what I am trying to achieve. I am trying to create "billboard" 3D sprites, i.e. sprites which are affected by all 3D transformations except rotations, thus they always face the "camera".


texts: Having trouble writing a controller class

texts:
Okay so I'm writing a controller class to expand the SFML joystick library capabilities.  Since the different controllers I want to use for this game have different integer values mapped to different buttons, I want to be able to pass integer values to the class to map these values to buttons I have defined.  As well, SFML can detect whether a button is pressed with sf::Joystick::isButtonPressed(unsigned int joystick, unsigned int button).  However, this only detects if a button is currently pressed and thus holding the button will just register as repeated presses.  So I wrote my own code to detect for a button press without a hold.

So here's the issue: What is the proper way for the player (outside the class) to access the set of buttons without exposing data?  I could have getters for the buttons, but then the buttonPressed method couldn't change the value of held.  The only way I could see this working is if I gave full access to the Button's.  Or should I go about this a different way?  Any help would be greatly appreciated.  Here's the relevant code:

// Controller.h

class Controller
{
public:
    struct Button
    {
        unsigned int id;
        bool held;
    };

    // constructor which assigns a controller ID
    // and a set of buttons
    Controller(...);

    // Checks each frame for each button if
    // any are not held and sets held to false
    void update();

    bool buttonPressed(Button& button);
private:
    unsigned int controllerId_;
    Button A_, B_, X_, Y_, Z_, R_, L_,
    START_, D_PAD_UP_, D_PAD_LEFT_, D_PAD_DOWN_, D_PAD_RIGHT_;
};

// Controller.cpp

bool Controller::buttonPressed(Button& button)
{
    if (sf::Joystick::isButtonPressed(controllerId_, button.id) && !button.held)
    {
        button.held = true;
        return true;
    }
    else
    {
        return false;
    }
}


texts: XNA ContentManager.Load causes string allocation

texts:
I was running the Visual Studio memory profiler on a project and noticed that an enormous amount of strings were being instantiated. It turns out that ContentManager.Load appears to create a new string instance each time it's called.  This might not be a big deal on a PC, but on other platforms like the Xbox, it quickly forces a garbage collection.

Maybe I'm just a bit naive, but I assumed that ContentManager would manage my game content, given the name and all. This led to calling the Load method every time I needed a texture (like during Draw), but it seems like this approach apparently can't work since the Load method will allocate strings, even if it's not allocating extra memory for already-loaded textures.

Is there a good solution to this? The obvious answer seems to be to maintain my own references to the textures and not call Load if they've already been loaded...but that seems like precisely what the ContentManager should be doing.


texts: How do you get the world position from the screen position in a URP shader graph used in a ScriptableRenderPass?

texts:
I'm using a shader graph in the Universal Shader Pipeline (URP) to do some post-processing in a ScriptableRenderPass. How do I get the world coordinates of the screen position?
I have tried using the View Direction node, set to World:

And I have tried the Screen Position node, with either a Transform node or Transformation Matrix node:

Neither seems to be working because the colors change as I move the camera around, but I would expect the color to stay the same since the world position of the GameObject in the view is not changing. Any suggestions?


texts: help using image to overlay grayscale around player

texts:
I'm sorry for the confusing title but it is hard to explain in one sentence.

This is what I have

What I want to do is use that black overlay to convert everything in the black area to grayscale. This will create a colored aura around the player.

Does this require pixel shading or is there a simpler method?


texts: When to detect and respond to collisions?

texts:
I've usually implemented collision detection like this in the past:

Move entity
Check if it collides with anything
Resolve the collision by moving it back

That's also the approach employed by most tutorials on the topic I've seen, so it seems popular. But isn't the following cleaner?

Calculate entity's velocity based on its acceleration
Check if it would collide with anything
Resolve the collision by adjusting its velocity
Move entity based on its velocity

The former approach has always been buggy for me, with objects getting stuck in walls or sometimes moving right through them.

One issue I see with the latter approach is with the time step. All of my entities have an void update(int ticks) method which updates their position. Now, I'd have to calculate the position twice: Once to anticipate a collision and once to actually move the object. Also, can I accurately resolve the collision by just updating the velocity?


texts:
Have i understood this correct: If i want to use a rigidbody for physics then

i should not move an object through its transform.position.
I should never move it by riigidbody.velocity since i then affect the physics.
So what is left is moving it using addForce. I guess its like mimicking how in the real world everything that moves has something that drives it.


texts: iOS Game Center - Quit turn-based games for previous version of app

texts:
I have a game on the iOS App Store that uses Game Center for turn-based multiplayer (GKTurnBasedMatch). I recently updated the app with a new game mode and I had to change the network protocol for that to happen. As a result I marked my new version as incompatible with the old one. That is, you cannot see the old games within the new app and you cannot initiate a game with someone with the old version of the app. This works as expected. However:

The old games remain active after updating. There seems to be no way to quit them. What is worse is that they still count to the maximum number of games you can start. I have been contacted by players that can only start 1-3 games without hitting the roof.

Have anyone experienced this before? Is there any way to quit the games?

Thanks in advance


texts: What is the purpose of mesh optimization functions?

texts: I remember there is a specific function in Direct3D which optimizes a mesh or a 3D object in some way. What is the purpose of this function? How does it reorganize vertices to make it better?


texts: Inverse Kinematics using Pseudoinverse Jacobian

texts:
I'm having problems solving IK with Jacobian Pseudoinverse method.

What I do is:

At each local joint frame q_i of the chain q calculate the cross product between rotation axis (taken from local transform) and joint-to-end-effector vector (end-effector is transformed to q_i coordinates):

// for each joint q_i -> to parent iteration

// Get Local Joint Position and Rotation Axis
lTransform = ... // local transform of i-th joint
if (lTransform.Decompose(s, q, t)) {
    q.AxisAngle(lRotationAxis, angle); // quaternion, XMQuaternionToAxisAngle
}

// Transform End-Effector To Local Joint Coordinates
lEndPosition = Vector3::Transform(lEndPosition, lTransform); // each iteration is updated to-parent
lJointToEnd = lEndPosition - lTransform.Translation();
lResultAxis = lRotationAxis.Cross(lJointToEnd);

jacobian(0, i) = lResultAxis.x;
jacobian(1, i) = lResultAxis.y;
jacobian(2, i) = lResultAxis.z;
jacobian(3, i) = lRotationAxis.x;
jacobian(4, i) = lRotationAxis.y;
jacobian(5, i) = lRotationAxis.z;

Set up desired change in position dX = globalObjective - globalEndPosition (fill the rest with zeros [orientations]).
Calculate configuration dQ with jacobian pseudoinverse:

jT = jacobian.transpose();
inv = (jacobian * jT).inverse();
jpinv = jT * inv;

dQ = jpinv * dX;

So what exactly is dQ? Each value should represents a local change in i-th joint.

Is it the angle of rotation around rotation axis in local joint frame?
Or maybe translation value along cross product?

I tried applying both variations above updating local joint transform with simple matrix multiplication and none of this works. The end-effector position seems to be moving very randomly - at each iteration it's very different.


texts: Calculate matrix transformation components separately

texts:
It is possible to calculate the translation, rotation and scale that were used to build a matrix?

I mean if I have a matrix M can I calculate the rotation, scale, and translation it represents?

Of course I could save each component in the matrix individually, but can I recover this information from just the matrix data?


texts: 18.5:9 Android ratio force to 16:9 problem in Unity

texts:
I want to my game build in devices with 18.5:9 ratio like Samsung S8 forced to be displayed as 16:9 ratio.
I already set Aspect ratio mode to Custom and set it to 1.86 in Player Settings.
I also overrided Android Manifest like this:

    <?xml version="1.0" encoding="utf-8"?>
    <manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.unity3d.player" xmlns:tools="http://schemas.android.com/tools" android:installLocation="preferExternal">
    <supports-screens android:smallScreens="true" android:normalScreens="true" android:largeScreens="true" android:xlargeScreens="true" android:anyDensity="true" />
    <application android:theme="@style/UnityThemeSelector" android:icon="@drawable/app_icon" android:label="@string/app_name" android:isGame="true" android:banner="@drawable/app_banner">
  <activity android:name="com.unity3d.player.UnityPlayerActivity" android:label="@string/app_name" android:screenOrientation="sensorLandscape" android:launchMode="singleTask" android:maxAspectRatio="1.86" android:resizeableActivity="false" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale|layoutDirection|density" android:hardwareAccelerated="false">
  <intent-filter>
    <action android:name="android.intent.action.MAIN" />
    <category android:name="android.intent.category.LAUNCHER" />
    <category android:name="android.intent.category.LEANBACK_LAUNCHER" />
  </intent-filter>
  <meta-data android:name="unityplayer.UnityActivity" android:value="true" />
  </activity>
  <meta-data android:name="unity.build-id" android:value="633a700a-7389-4a19-972c-ac1f177788f8" />
  <meta-data android:name="unity.splash-mode" android:value="0" />
  <meta-data android:name="unity.splash-enable" android:value="True" />
  <meta-data android:name="android.max_aspect" android:value="1.86" />

  </application>
  <uses-feature android:glEsVersion="0x00020000" />
  <uses-permission android:name="android.permission.INTERNET" />
  <uses-feature android:name="android.hardware.touchscreen"
android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch"
android:required="false" />
  <uses-feature android:name="android.hardware.touchscreen.multitouch.distinct" android:required="false" />
  </manifest>

And as you see add attributes like android:maxAspectRatio & android:resizeableActivity to AndroidManifest manually.

But by installing the app on devices with that specific ratio, the game still running full screen and out of the bounds.
I am using Unity 2018.1.4f1 (64bit).


texts: Unity 5.6.0f3 Inspector Tooltips are off in macOS, is me or everyone the same?

texts:
Running latest version (5.6.0f3) in macOS, my tooltips are always misalign to the left of my screen, is me or anyone else also experience the same? And, it is still misalign even after I reset the layout setting to factory default.

Here are the screenshots http://imgur.com/a/dR0Pv

Update: Filed a bug report.


texts:
I'm new to game development and I'm trying to build my first Pong game on the Godot engine. the tutorial I'm following is given below.

Simple Pong Game

What I don't understand is the line:

ball_pos += direction * ball_speed * delta

How is the new ball position being calculated?

As far as I know, delta is the time elapsed in seconds (float) since the last _process() call.

Also, why is the direction vector set to (1.0, 0.0)?

I'm looking for a clear explanation since the tutorial doesn't explain much. Thank you.


texts: Game Loop Problem - Growth and Recharge as Integer Values

texts:
I have a question about game loops. I understand that you shouldn't have a static loop, say 100ms and set something's speed to 1px/frame so it moves 10px/sec. You should have a speed and multiple that by the elapsed time so frame rate does not effect game speed. This works fine for values that can be floats, but what if I need integer values? Say shields recharging or something. I have a damage system is my game and I would really love to stay away from float damage values, both for memory and game design reasons.

However if I just have a running total of elapsed time, and I recharge one point once this elapsed time is over 1 second then over the course of time won't I have some consistency errors between recharging over one set of 100 real seconds and another set of 100 real seconds because those two sets may not have the same number of frames in them. This questions also comes up in rate of fire. If I need a turret to fire every .5seconds, won't there be some variance if I do a running total of elapsed time? Sometimes it may fire every .501 seconds and other time .510 seconds?

I guess my question is, how exact are games really? Do most games just do a check every frame and say, "Well your rate of fire is .5 seconds, and its been .504 since you last fired, so fire now." If so would it work out for the next fire cycle to only check for .496 seconds to average out? I know it most games under 10 minutes this would barely be noticeable, but over the long term this may actually mater in some cases.


texts: How to synchronize damage with attack animation in a RTS game?

texts:
I have been working on a RTS game in unity and did damage deal through code and a timer but it does not fit with the animations quet well. The damage is dealt in the beginning of the animation and about 4 attacks it fits perfectly and after more 4 attacks the damage is dealt delayed after the animation.

My big question is if hitboxes would be a good answer to solve this problem or is it to preformance heavy?


texts: In GameMaker, is it possible for users to code something into a game while playing, and verify that it is correct?

texts:
I was wondering if in GameMaker it would be possible to allow people to code a small bit of the game in so that they then unlock that move/code?

Think of the game DLC Quest, in the way that you had to find a few coins and then you were able to buy the ability to jump, would it be possible to do this but instead of getting people to buy the ability to jump, get them to code it? (Only a little bit of code, of course, not an entire script?)


texts: How to rotate velocity Vector3 to always point the same direction so that it can be applied to 2d blendtree?

texts:
Given two variables, a Vector3 representing body velocity and a Quaternion representing body's local rotation, how could I normalize the velocity vector so that it's always oriented towards the default Vector3.forward direction?
The context of this problem is that I have a 2D blendtree for character movement animations. I wanted to use the RigidBody.velocity to control the two blendtree axes. This did not work as I initially expected because, depending on body rotation, the velocity also rotates to that direction and this when I'm moving forwards but my body is rotated 90 degrees to the right, my right (x) velocity would be 10 and my forward (z) velocity would be 0. In that case I would like to, using the current body rotation and velocity values, "normalize" the given velocity vector so that it has 10 in forward (z) velocity and 0 in right (x) velocity any time the entity is moving forward, no matter it's orientation.
I've tried playing with Vector3.RotateTowards and Quaternion.LookRotation but I haven't gotten the desired results and I don't really know what to look for.


texts: How can I create character graphics similar to Valkyrie Profile?

texts:
I want to create a game with the character graphics similar to Valkyrie Profile.
I don't know whether I should make my game character sprites pre-rendered or hand drawn, or which technique would let me create a similar look.
Are these created pixel by pixel, what sets me off is the ditter found in a lot of the images, kind of looks like the characters from treasure hunter G or harvest moon friends of mineral town.
@edit
Added the screenshots from Treasure Hunter G and Harvest Moon. I know these are pre rendered sprites that are later incorporated into the game, just for comparison against the valkyrie profile ones.
Also, the treasure hunter G is a SNES game, and the Valkyrie Profile is PSX one, so I expect an upgrade in graphics.


texts: Optimal number of work groups for compute shaders

texts:
In OpenGL, is there a way to dynamically determine the preferred workgroup size of the underlying hardware? Or at least, to approximate it using some queried metrics?

In OpenCL, you can do this using some implementation defined constants, but so far I wasn't able to find something similar for OpenGL.


texts:
How would you path plan a volume for a game?

For example a 1 km cube with tunnels and caverns. Also the terrain is destructible.

You have walking and flying modes.

I would separate it into phases. Create a volume of the open space. Find a path that takes into account dynamic destruction.

Performance is a huge concern and the ability to find paths that are used in a short time.

Concrete example:
Mine something deep in the ground efficiently.

The ground is destroy-able. "Caverns" are easy to dig areas. Mining is like flying. Need to see with sensors. The dataset is huge. Need to construct a transportation path to the target. May be multi-agent.


texts: Unity - Scroll Rect shows buttons outside of the rectangle

texts: I have this problem. I'm using a scroll rect to display a series of buttons, but I would make sure that as soon as the buttons (with the scroll rect), come out of a certain area (bounded by a panel), become invisible. to explain it better in the pictures. I would like the visible part of the list of buttons to stop where there is the black arrow, and then I would delete the part where I drew the red waves


texts:
I have opened new scene, deleted camera and imported first person character controller from Standard assets.
I placed plane on scene and put first person character controller on plane.

I got this error:

  Assets/Standard Assets/Characters/FirstPersonCharacter/Scripts/RigidbodyFirstPersonController.cs(3,27): error CS0234: The type or namespace name CrossPlatformInput' does not exist in the namespaceUnityStandardAssets'. Are you missing an assembly reference?

How to fix it?


texts: unity spriterenderer scale to fit screen portion

texts:
let me explain what i have.
a camera that render only a sprite ( sprite renderer) and what i'm looking for is to scale that sprite renderer to fit a screen portion (not the entire screen) for example 0.145 (normalized) anyone can help me?
fix : i mean, from 0 to 0.145 so the entire area ( it will be a 125x125 image ) so i need to keep the aspect ( same width and height) and i'm using orthographic camera


texts: Drawing a deferred decal when the camera clips its bounding geometry

texts:
I have a building grid effect that I decal onto my terrain using a cube that moves to follow the cursor.

You can see if the camera gets too close to the cube, it gets clipped by the camera's near plane:

See the clipping just starting here:

I'd like to find a solution to this as the camera may be this low to the ground or lower upwards of 50% of the time during gameplay. (the rest of the time you would use the view from above, as illustrated by the clip I provided).
Is there any way to solve this problem?
I'd like to correctly render the cube's shader despite/while clipping with the camera.
is this possible and how?
.
.
.
EDIT & UPDATE :

I'm implementing camera-to-cubemesh clipping detection and already having issues :
public class Grid : MonoBehaviour
{
    #region
    [Header("First point to Camera Controller")]
    [SerializeField]
    public CameraController CameraController;
    MeshRenderer constructionGrid;
    private Camera cam;

    private void Start()
    {
        cam = GameObject.FindGameObjectWithTag("MainCamera").GetComponent<UnityEngine.Camera>();
        constructionGrid = GameObject.FindGameObjectWithTag("GridViewer").GetComponent<MeshRenderer>();
    }

    void Update()
    {
        Plane[] frustumPlanes = GeometryUtility.CalculateFrustumPlanes(cam);
        if (GeometryUtility.TestPlanesAABB(frustumPlanes, constructionGrid.bounds))
        {
            Debug.Log("Clipping");
        }
        else
        {
            Debug.Log("Not");
        }
    }

This always logs "Cliping" whether clipping or not.
If I add a meshCollider to the shadercube the same happens but the shadercube jitters all over the place.
I can't figure out clipping detection.


texts: Generate Geodesic Sphere from Hex and Pentagons

texts:
I have two polygonal meshes, a hexagon and a pentagon (They are tiles in a strategy game). I want to use them to construct a geodesic sphere (https://upload.wikimedia.org/wikipedia/commons/e/e7/G%C3%A9ode_V_3_1_duale.gif).

I can modify the sizes of each mesh to fit what I need, but I can't figure out how to get the radial coordinates of each face in the geodesic sphere. Is there a way to do this?

I'd like to only need two meshes for the tiles, but I can make different versions if absolutely necessary.


texts: How to get a game popular without a publisher?

texts: I have just finished a game I had been developing last month, but whilst making the game I was pestered by the fact that I had no way of getting it to the public eye. I didn't  want to pitch it to a publisher, as being tied to a publisher is the absolute last resort for me. So with little in the ways of funds for advertisement and supplementary materials, coupled with the fact that I am a fledgling to the industry to the highest degree and thus have nothing in the way of backing or accolades or any reputation at all. How does someone such as me get his work out there, and keep it as a work of his own merit and design? Am I just going to have to put my pride aside and join the veterans, or is there some way, any way at all, to make my way through? I really appreciate the help of anybody who answers.


texts:
I am developing a little Game with something like particles, where every particle is represented by a box2d Body.

To insert new particles I need to find a place in the b2World where no bodies reside. How can I obtain this?

greeting...


texts:
How can I make transition between stages in libgdx ?

I have 2 screens MenuScreen and GameScreen each of which has a stage

I write the following to make a transition :

in MenuScreen

SequenceAction sequenceAction = new SequenceAction();
sequenceAction.addAction(Actions.moveTo(-Gdx.graphics.getWidth(), 0, 4.0f));
sequenceAction.addAction(Actions.run(new Runnable() {
     @Override
     public void run() {
        gameMain.setScreen(new GameScreen(gameMain));
             }
     }));
stage.getRoot().addAction(sequenceAction);

in GameScreen

stage.getRoot().setPosition(Gdx.graphics.getWidth(), 0);
stage.getRoot().addAction(Actions.moveTo(0, 0, 4.0f));

but the problem is GameScreen does not following MenuScreen directly
i.e it wait until MenuScreen has completely gone from screen and I want them to move at the same time


texts: How can I animate an element from ngui in Unity? For example, how can I move it from the left to the scene when the button is clicked?


texts:
I'm currently working on a Voxel game in 3D and need a tad bit of help to figure out what Voxel the player is looking at. This is the data I currently have:

GRRLIB_Camera3dSettings(Player.x, Player.y, Player.z + 4, 0,0,1, Player.x + Camera.lookx,Player.y + Camera.looky,Player.z + Camera.lookz);

And the two 3d arrays that contains the player cords and block cords:

struct Player{
  int X;
  int Y;
  int Z;
}
int World[X_MAX][Y_MAX][Z_MAX];
//The cords are ALWAYS positive. ( and the array data: 0 Means air, anything higher is solid), The player

(GRRLIB camera is described here: http://grrlib.santo.fr/doc/group___all_func.html#ga7300940a38526ab5aa9be0f4abe4a32a)

So what I basically need to understand is how I would implement ray tracing using this data.
The whole project can be found here: https://github.com/filfat/WiiCraft

For clarification I am asking for a simple way in C or C++ to create a Ray tracing algorithm that would be used in a Minecraft like game for selecting the block the player is looking at, all data that is needed is above. So in short I need help to understand the math in a Ray Tracing algorithm and need a simple example so I could implement it myself.

Thanks! :)


texts:
I need to develop a simple multiplayer card game. For example, a poker game; this is only for study. I am going to develop it in Java.

How I can I manage communication between the server and clients? Can I use sockets for this game?

Edit: Thanks, I know socket programming. I know the programming socket. I just wanted to know if it was the correct technique for a multiplayer game like online poker.


texts: How can I simulate a randomly-generated universe?

texts:
Possible Duplicate:
  How to generate a universe?

Were would I start looking if I wanted to develop an engine to simulate space at random. Things like black holes, galaxies at distance and moving stars, asteroids and so on?

I would like to know if anyone has some good tips for this, or if there is some information online?


texts: How do I draw individual pixels in the distance?

texts:
Hello everyone I am working with unity3d and I am faced with a task. I have a list of 3D points and I want to draw a pixel for every point on the list that exists after my cameras frustums far-plane. After I draw each of the pixels I would like to add a few simple effects to them. Sorry for the terminology I am new to unity!
Any help is much appreciated.


texts: How to manage merging/splitting viewports to create a dynamic splitscreen

texts:
I'm making a multiplayer 2D game where each player has an entity that they can move in any direction. This will be local only, so split screen.

Typically the player controlled entities will be in close proximity to each other. What I would like to do is have the screen get split only when players are far away - i.e. when it needs to.

See around mid way through this YouTube clip of Mari0 for an example of what I mean.
See this clip of Super Mario Bros X (sorry, it's a bit of a low FPS) for an example of horizontal & vertical splitting.

There starts off being a single viewport (or maybe 2 rendered to look like one). Then, as the players separate, either vertically or horizontally it splits the screen giving each player is own viewport.

How would I go about creating this effect? (managing the viewport merging/splitting etc)
How about extending it to work for up to 4 players? (is that even possible?)