texts:
Got a problem, with collision detection, I need to detect collision between bullets and meteors using nested loop for this, but it isn't working.

                            }
                }
                    check();
                    LoadMeteors();
        base.Update(gameTime);
    }

    public void LoadMeteors()
    {

        int randY = random.Next(100, 400);
        if (spawn >= 0.5)
        {
            spawn = 0;

                meteors.Add(new Meteor(Content.Load<Texture2D>("Backgrounds/meteori"), new Vector2(800, randY), new Rectangle(0,0,50,50)));
        }
    }

    public void SpawnBullet()
    {

        bullets.Add(new Bullet(Content.Load<Texture2D>("Backgrounds/pula"), new Vector2(rocket.rectangle.X + 20, rocket.rectangle.Y + 20), new Rectangle(0, 0, 10, 5)));
        soundEffect.Play();

    }
    public void check()
    {

        for (k = 0; k < bullets.Count; k++)
        {
            for (i = 0; i < meteors.Count; i++)
            {
                if (bullets[k].rectangle.Intersects(meteors[i].rectangle))
                {
                    meteors[i].isVisible = false;
                }
            }
        }
    }

that is my meteor class:

using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace Rocket
{
   class Meteor
 {
    public Texture2D texture;
    public Rectangle rectangle;
    public Vector2 position;
    public Vector2 velocity;

    public bool isVisible = true;

    Random random = new Random();
    int randX, randY;

    public Meteor(Texture2D newTexture, Vector2 newPosition, Rectangle newRectangle)
    {

        texture = newTexture;
        position = newPosition;
        rectangle = newRectangle;
        randY = random.Next(-4, 4);
        randX = random.Next(-4,-1);

        velocity = new Vector2(7, 0);
    }

   public void Update(GraphicsDevice graphics)
    {

        position -= velocity;
        if (position.X < 0 - texture.Width)
            isVisible = false;
    }
   public void Draw(SpriteBatch spriteBatch)
   {

       spriteBatch.Draw(texture, position, rectangle, Color.White);

   }

}
}

and that is my bullet class:

    using System;
   using System.Collections.Generic;
  using System.Linq;
  using Microsoft.Xna.Framework;
  using Microsoft.Xna.Framework.Audio;
  using Microsoft.Xna.Framework.Content;
  using Microsoft.Xna.Framework.GamerServices;
 using Microsoft.Xna.Framework.Input;
  using Microsoft.Xna.Framework.Media;

 namespace Rocket
{
class Bullet
{
    public Texture2D texture;
    public Rectangle rectangle;
    public Vector2 position;
    public Vector2 velocity;

    public bool isVisible = true;

    public Bullet(Texture2D newTexture, Vector2 newPosition, Rectangle newRectangle)
    {

        texture = newTexture;
        position = newPosition;
        rectangle = newRectangle;

        velocity = new Vector2(10, 0);
    }

    public void Update(GraphicsDevice graphics)
    {
       position += velocity;
               if (position.X < 0 - texture.Width)
            isVisible = false;
    }
   public void Draw(SpriteBatch spriteBatch)
   {
       spriteBatch.Draw(texture, position, rectangle, Color.Aqua);

   }
    }

so, I call function Check(): in update method, than in that function i check for collision, but it isn't detecting collision, also meteor and bullet classes, both have rectangle, I don't get any errors and it seems to be right, thanks for any help!


texts: How does one prevent homing missiles from orbiting their targets?

texts:
I am developing a 2D space game with no friction, and I am finding it very easy to make a homing missile orbit its target. I am curious about anti-orbiting strategies.

A simple example is a homing missile that simply accelerates directly toward its target. If that target were to move perpendicular to the missile's trajectory then stop, the missile's acceleration toward the target would not be enough to overcome it's own velocity, and the missile could be driven into orbit around the target, as depicted:

In frame 1, the missile is heading straight for its target, no problems.
In frame 2, the target has moved to a new position as demonstrated. The missile continues to accelerate directly toward the target (in red), while still moving toward where the target used to be (in black) due to its existing velocity.
In frame 3, the missile's velocity continues to carry the missile around the side of the target (black) while the acceleration vector tries desperately to pull the missile toward the target.
In frames 4 and beyond, the missile falls into a potentially stable orbit around the target and never reaches its goal. The black arrows indicate a velocity vector while the red lines indicate acceleration vectors at the same moment in time.

Considering that there is no friction in space, there is nothing to slow the velocity of the missile down and collapse the orbit. A possible solution would be to aim "behind" the target, and this would cause the orbit to close, but how is this done from a programming point of view?

How do I make a homing missile reach its target?


texts: "The associated script cannot be loaded", how can I see what script is associated?

texts:
I have a couple objects that are throwing errors in the warning log:

  The referenced script on this Behaviour (Game Object 'myObject') is missing!

Here is what they look like in the inspector:

How can I see what script is (or was) associated?


texts: In theory would it be faster to render a lot of grass patches that would dynamicly batch or big meshes of combined patches, too big for batching? Rendering chunks should be faster because unity doesn't have to combine them and it avoids some overhead but smaller patches will make it easier for culling.


texts: Applying texture maps from Blender to Unity material properties

texts:
When I bring my Blender file into Unity, I will attach the texture maps from my Blender material (left) to the Unity material (right) as follows:

diffuse/color map  --> albedo

normal --> normal

roughness --> ?

specular --> ?

displace ---> ?

metalness --> metalic ?

I haven't found matches for the roughness, specular, or displacement maps. What should I do with those maps?


texts: How can I get/find all the UI texts and TextMesh Pro in the hierarchy?

texts:
When pausing/resuming the game, I want to disable/enable all UI texts.
The following code works for finding UI texts, but I also want it to find TextMesh Pro text.
How can I do this?
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
using UnityEngine.UI;

public class BackToMainMenu : MonoBehaviour
{
    [ContextMenuItem("Fetch", nameof(FetchAllTexts))]
    public Text[] uiTexts;

    // Start is called before the first frame update
    void Start()
    {

    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale == 0)
            {
                SceneManager.UnloadSceneAsync(0);
                DisableEnableUiTexts(false);
                Cursor.visible = false;
                Time.timeScale = 1;
            }
            else
            {
                Time.timeScale = 0;
                MenuController.LoadSceneForSavedGame = false;
                DisableEnableUiTexts(true);
                SceneManager.LoadScene(0, LoadSceneMode.Additive);
                Cursor.visible = true;
            }
        }
    }

    private void FetchAllTexts()
    {
        var tmp = new List<Text>();
        foreach (var root in SceneManager.GetSceneAt(0).GetRootGameObjects())
        {
            tmp.AddRange(root.GetComponentsInChildren<Text>(true));
        }
        Text[] texts = tmp.ToArray();

        uiTexts = texts;
    }

    private void DisableEnableUiTexts(bool uiTextEnabled)
    {
        if (uiTexts.Length > 0)
        {
            foreach (Text ui in uiTexts)
            {
                ui.enabled = uiTextEnabled;
            }
        }
    }
}


texts: Which optional features would you recommend for a raytracer?

texts:
I'm developing a basic triangle mesh raytracer on a short deadline.
This means I can't implement every feature I come across, so I'm looking for some feedback about which features you think are most important, taking into consideration the performance of the feature and how much punch it packs.

I'm especially looking for optimization techniques that allow for a faster rendering and simple techniques that make a big impact on the final scene quality.
Is there any chance of making it fast enough to run in realtime?

Here are some example of features I've read about:

Anti-aliasing
Bounding box
Sky box


texts: Click on an isometric plane and obtain normal coordinates

texts:
I have photos distributed as cells. When I click, I get the corresponding row and column.
console.log("Col:" + X + "Row:" + Y);

When applying an isometric view conversion like this:

ctx.translate(0, 300);
ctx.scale(1, 0.5);
ctx.rotate(-45 * Math.PI /180);

I do not know what mathematical formula applies to get the coordinates correctly.

Based on feedback so far, I've been able to get this far. The x coordinate seems to work fine, but the y coordinate not.

Isometrico();

function Isometrico(){
     ctx.translate(0, 300);
     ctx.scale(1, 0.5);
     var radianes= -45 * Math.PI /180;
     ctx.rotate(radianes);
}

/*
document.addEventListener("mousedown", function(e) {
             CorIsometrico( e.offsetX, e.offsetY);
});
*/

/*
function CorIsometrico(xI,yI){
     //RESPUESTA yI=yI-300;
     yI = yI * 2;
     xI = xI * Math.cos(45) - yI * Math.sin(45);
     I  = yI * Math.sin(45) + yI * Math.cos(45);
     console.log("Coor Isometricas:" + xI + "/"+ + yI);
}
*/

Edit:

Each cell is 50x50. Having 10 columns and 50 rows, the information of each cell would look like this:

1: 50/50
2: 100/50
3: 150/50
...
49: 450/250
50: 500/250

Maximum Y value = 250.

xI=xI*Math.cos(45 / 180 * Math.PI)-yI*Math.sin(45 / 180 * Math.PI);
yI=yI*Math.sin(45 / 180 * Math.PI)+yI*Math.cos(45 / 180 * Math.PI);
yI=yI*2;
yI=yI-300;

Click in X:1 / Y:1 = -138.5929291125633/ 531.5575746753798
Click in X:1 / Y:5= 198.69700551341987/ 90.3229432149742

Y exceeds the maximum value.

Edit2:

var xI2=xIMath.cos(45 / 180 * Math.PI)-yIMath.sin(45 / 180 * Math.PI);
 var yI2=xIMath.sin(45 / 180 * Math.PI)+yIMath.cos(45 / 180 * Math.PI);
 yI2=yI*2;
yI2=yI-300;
xI2=xI2+150;

/// console.log("Coor Isometricas:" + xI2 + "/"+ + yI2 );

x coor : 100 to 400 px if x+150; y coor: 0 to -155.

Been thinking that the problem is not necessary on isometry.
What I'm looking for can be simplified to get the coordinates of a 2d plane by having it rotated X degrees


texts: How should I use Monte Carlo method to simulate some police cars that keep patroling in a tile based map?

texts:
I have a tile map (isometric) and I have some police cars that they patrol all the time on the map, there is some building and other cars in map too so they are considered as constraints in my shortest path algorithm (below).

I use to randomly select some target for each police car and use A* algorithm to find the path to the randomly selected destination tile and this cycles over and over. because cars should move all the time! (except those that gamer should control)
The problem is police cars routes are correlated and they do not just traverse the area randomly, for instance, they do not usually cover a same area or they do not repeat their own route so my implementation based on some random destination point wasn’t a good idea and the result was not satisfying. Take a look at the following picture, it shows how randomly selecting the destinations worked for me, obviously, it is a dumb patroling for sure, even a cockroache could do better!

Suddenly, I remembered Monte Carlo Method and I thought it would solve my problem, because it exactly does what I wanted to do, However may be I should use Zobrist Hashing since it is tile base in nature. Does anyone has any idea how should I use this kind of methods?
Question in Brief :
How can I use Zobrist Hashing or Monte Carlo method to set destinations points for my patroling car (like police car)?
If anyone knows another way to implement a patrolling method, he/she is very welcome to post an answer, I am not sure if Zobrist Hashing is the best and worth to implement.
---First Edit (added following paragraph) :
I need to distribute the cars and their destination points in a homogeneous manner. Every kind of solution that get me close to a good pattern could be my answer, of course there is a lot of methods to do so, but I dont have any clue.


texts: Problem connecting to Steamworks via Facepunch.Steamworks

texts:
I'm using Facepunch.Steamworks (https://github.com/Facepunch/Facepunch.Steamworks) to connect my Unity game to Steam. The login seems to work fine. The board object is an FP class, and AddScore is a call to the library to send the score to Steam.

I have the boards set up on Steam, and they come out with IsValid == true. Here are the output and the code. The boards currently have no data in them, so I don't think it's because the score isn't beating an existing one.

xxxxxxxx
Standard-Normal
True
Fail

public void SubmitScore(Globals.ApplicationMode mode, Globals.SkillLevels skillLevel, int score)
{
    int index = GetLeaderboardIndex(mode, skillLevel);
    if(index == -1 || !IsSteamPlatform())
    {
        return;
    }
    Leaderboard board = m_leaderboards[index];
    Debug.Log("xxxxxxxx");
    Debug.Log(board.Name);
    Debug.Log(board.IsValid);
    board.AddScore(true, score, null, AddScoreSuccessCallback, AddScoreFailureCallback);
}

private void AddScoreSuccessCallback(Leaderboard.AddScoreResult result)
{
    Debug.Log(result.Score);
}

private void AddScoreFailureCallback(Facepunch.Steamworks.Callbacks.Result result)
{
    Debug.Log(result.ToString());
}

Here's a shot of the leaderboards on the Steam control panel. They seem in order; their "Writes" attributes are false so that the client can submit to them directly.


texts:
I'm using THREEjs's exporter to export a 2D polygon plane. The resulting JSON gives me the vertices. I'm trying to properly order these vertices as to make the actual polygon shape, without luck.

Right: Default vertex order

Left: Actual order

I manually put the needed order together and found it to be this.
0,1,2,3,4,5,6,7,8,9,11,13,17,16,15,19,21,22,23,25,27,29,39,38,37,36,35,34,33,32,31,30,28,26,24,20,18,14,12,10 (element represents index in default order).

Is there a pattern to this ordering? Does the JSON file reveal more information on how to properly order it? Seems the only other information in there is the faces array. I do not understand how to read it or what it represents.


texts:
A naive Snake game implementation works by using a queue data structure to store the position of every single square that the snake is a part of.

You can reduce the amount of memory by only storing the location and direction of the head, the location of the tail, and an array of locations where the snake bends.

In a 100 x 100 grid, there's 10,000 squares. A queue of points (stored as pairs of bytes) would require 10,000 * 2 bytes = 19.5KiB of memory in the worst case scenario, where every square is filled up. (This would be accomplished by the snake starting on a corner, and the dots always appearing right in front of him in an S-shaped pattern.)

Assuming you can store the location of the head, direction of the head, and location of the tail in bytes (total of 2 bytes + 2 bytes + 1 byte for location), what is the maximum amount of bends that could exist in a 100x100 grid, and how much space would you save with this method in the worst case? In the average case?


texts:
I have fixed timestep code in my main thread, it looks like this:

float oldTimeSinceStart = 0;
float accumulatedTime = 0;
float maxDeltaTime = 0.1f; // 10 FPS
float fixedTime = 0.016f; // 60 FPS

while(running)
{
    float timeSinceStart = System.nanoTime();
    float deltaTime = (timeSinceStart - oldTimeSinceStart) / 1000000000;
    oldTimeSinceStart = timeSinceStart;

    deltaTime = Math.min(deltaTime, maxDeltaTime);

    accumulatedTime += deltaTime;

    while (accumulatedTime >= fixedTime)
    {
        accumulatedTime -= fixedTime;

        gamePanel.update();
    }

    gamePanel.draw(canvas);
}

I have objects on scene, which positions are updated as

position += speed;

And speed is calculated on app start as

speed = (screenWidth / 2) * fixedTime;

These codes should work well to get same objects speeds on all devices and also smooth visual. Speed works quite well, but visual appereance is bad. I'm getting periodical "lags" about each half second on my old Galaxy Ace and also on S III Mini. So it's like running smoothly - lag - running smoothly - lag...

Any ideas what could cause these lags?


texts: How to find the bottleneck in a typical OpenGL game?

texts:
I am working on a little game engine. All major features are implemented yet, despite game logic which I assume not to be such a computational effort. The framerate is at least around 40 FPS, most of the time above 60 FPS.

I would like to speed up my engine now. There are several performance heavy tasks, like physics simulation and collision detection where I use Bullet Physics for, geometry drawing and texturing, deferred lighting, post effects like SSAO. Later on maybe character animation and artificial intelligence may add up.

How to find the bottleneck in such a typical OpenGL game? I am not familiar with profilers, and I have no idea how to use them, especially with asynchronous code like Bullet Physics.


texts: Minecraft - How do I check if someone has a clear inventory

texts:
How do I check if a player has a clear inventory?
I'm making a PvP arena plugin but I need it so when someone types /pvp join, it checks if they have a clear inventory. If they do have a clear inventory, it lets them join, if they don't, it asks them to.

I tried this but it's not reliable as there are more slots:

if(p.getInventory().getArmorContents() == null
    && p.getInventory().getItemInHand() == null
    && p.getInventory().getItemInHand() == null) {

Then I tried this but it did not work:

if (p.getInventory().getContents().length == 0) {


texts: Why does my initial screen disappear quickly in my iOS build, in my Unity game?

texts:
I'm developing a game in Android and iOS platforms. I've an initial screen and I'm trying to get next menu scene after a delay of 4 seconds. It works ok in Android but in iPhone, the initial scene disappear in 1 second or less.

Can anyone help me?

This is my code (in C#) right now:

public class CargaPantallaInicio : MonoBehaviour {

    IEnumerator Start () {
        yield return new WaitForSeconds(4f);
        Application.LoadLevel("Menu");
    }
}


texts: Is there a logic game engine to be used in OS game?

texts:
Ludocore is a paper where a research on a logic game engine is presented.

For game I cooperate on -- Opendungeons -- it would seem fine to have separate abstract layer of code which would deal only with the logic/rules side of the game ( as there are very few now hardcoded in c++ source).

In the big picture in this system you have events, states and consequences. By custom the usage is like:

States are somehow mapped to actual game objects ( or simplier they can be actual states of real game objects )
Events are thrown by code side
Consequences are thrown by events and they modify the states depending on event context.

The actual question: Is there existing software to be used in GPL project? And if not what would be simplest approach using c++ in implementing Ludlum-like system? Using common libraries?

I count this as scripting question as well, because events/state/consequences should be mostly specified in external files to source code.


texts: Get vertices of a terrain mesh affected by a brush or placement shape

texts:
I have the following mesh, it has very simple structure. You can think of it as a terrain from top-down view: each vertex (red and numbered) is a fixed distance away from its four neighbours in the horizontal xz plane (e.g 1 unit); only y (height) is different.

How could I get the vertices affected by a given overlaid shape?

By "Affected" I mean vertices that are inside or on the border of the shape, and any vertices that share a triangle with them.

Here I've drawn a pink rectangle on my mesh, and circled in green the vertices that should be considered "affected" by that shape.

I know:

The constant distance between vertices
The center of the mesh as a Vector3 (mesh is a square)
The mesh's width/height (any corner could be calculated easily)

Some context, for what?

Flatten terrain on when building a structure, road, etc
Edit terrain with a brush (circle and other brushes)
Vertex/texture painting, etc


texts:
I'm soon going to make a game for the iPhone as a school project.

My idea was to make a TLOZ remake, with Tiled Maps.

However, I'm not quite sure how save the data.
In TLOZ you have a lot of sub-quests, treasures, items, and much more.
I want the user to only be able to open a treasure once.

Therefore I have to save this information somehow.
However, I'm not sure how to assign the data to that certain object, for example that treasure that Link has opened.

I thought about making id's for every object, but I'll have multiple maps, and it doesn't seem like the right solution.

Are there any standards for this?

Or does anyone have another idea?


texts: I am usng uiskin.png, default.fnt, uiskin.atlas to create my game UI, but the images is blurred, How do I make it smooth?


texts: How to check if a specific instance of a prefab is pressed?

texts:
This one is hard to explain, so I'll show the code first -

for (var i = 0; i < Input.touchCount; ++i)
{
    if (Input.GetTouch(i).phase == TouchPhase.Began)
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.GetTouch(i).position);
        RaycastHit2D hit = Physics2D.Raycast(ray.origin, ray.direction);

        if (hit)
        {
            clicksNeeded -= 1;
            GetComponentInChildren<TextMesh>().text = "" + clicksNeeded;
            Debug.Log(clicksNeeded);
            print("was a hit");
        }
    }
}

I need to check if hit touches the specific game object that the script is linked to, as at the moment if any of the circles are clicked, clicksneeded -= 1 to all objects currently instantiated.

Thanks for the help!


texts:
I am trying to render a quad with gl render mode GL_TRIANGLES with using element array buffer. Here is some code to explain process. Only the first 3 elements of indices array are drawn as expected. But following indices doesn't drawn at all.

Mesh Creation

glm::vec3 vertices[] = { glm::vec3(-1, 1, 0),
                          glm::vec3(-1, -1, 0),
                          glm::vec3(1, -1, 0),
                          glm::vec3(1, 1, 0)
                        };

glm::vec2 textures[] = { glm::vec2(1, 0),
                          glm::vec2(0, 0),
                          glm::vec2(0, 1),
                          glm::vec2(1, 1)
                        };

unsigned int indices[] = { 0, 1, 3, 3, 1, 2};
Mesh* mesh = new Mesh(vertices, sizeof(vertices) / sizeof(glm::vec3), textures, sizeof(textures) / sizeof(glm::vec2), indices, sizeof(indices) / sizeof(unsigned int), texture);

Mesh Class

Mesh::Mesh(...){
    InitMesh(...);
}

void Mesh::InitMesh(vec3* vertices, unsigned int numVertices, vec2* textureCoords, unsigned int numTextureCoords, unsigned int* indices, unsigned int numIndices) {
     this->numIndices = numIndices;

    // Generate VAO and bind
    glGenVertexArrays(1, &vaoID);
    glBindVertexArray(vaoID);
    // Generate VBOs
    glGenBuffers(3, vboIDs);
    // Bind Position Buffer, Buffer Position Data
    glBindBuffer(GL_ARRAY_BUFFER, vboIDs[0]);
    glBufferData(GL_ARRAY_BUFFER, numVertices * sizeof(vec3), vertices, GL_STATIC_DRAW);
    glEnableVertexAttribArray(0);
    glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0);
    // Buffer TextureCoord Data
    glBindBuffer(GL_ARRAY_BUFFER, vboIDs[1]);
    glBufferData(GL_ARRAY_BUFFER, numTextureCoords * sizeof(vec2), textureCoords, GL_STATIC_DRAW);
    glEnableVertexAttribArray(1);
    glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, 0, 0);
    // Buffer Indices Data
    glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, vboIDs[2]);
    glBufferData(GL_ELEMENT_ARRAY_BUFFER, numIndices * sizeof(unsigned int), indices, GL_STATIC_DRAW);
    // Unbind VAO
    glBindVertexArray(0);
}

void Mesh::Draw() {
    glBindVertexArray(vaoID);
    glEnableVertexAttribArray(0);
    glEnableVertexAttribArray(1);
    glDrawElements(GL_TRIANGLES, numIndices, GL_UNSIGNED_INT, 0);
    glDisableVertexAttribArray(1);
    glDisableVertexAttribArray(0);
    glBindVertexArray(0);
}


texts: Will scaling images at runtime impact my game's speed?

texts:
I have read the android developer guide to working on different screen sizes. My question is, if I only provide one image in the drawable file, and let android scale it for me, will it impact the overall performance of my app?

For example, I am simply displaying a red square, and there aren't any details to the square. Should I provide alternative resources, will android's scaling impact my performance as an app on bigger/smaller screens?


texts:
I tried to create a HUD button with a sprite of dimensions 1200x1200 to decrease it by code, but I could not.

Code:

draw_sprite(spr_btnBig,0,100,100);
image_xscale=0.05;
image_yscale=0.05;

I tried also to modify the scale of the object in the options in the room, but did not obtain the expected result.

Result:

I would not want to have to decrease its size in a program other than the game maker, because the quality of a sprite resized in the game maker gets much higher than a resized in image editors like GIMP or Photoshop:

How could he do that?


texts:
So I learned now about derivatives and fbm, but can not figure out the effect of this code example (credits https://www.iquilezles.org/www/articles/morenoise/morenoise.htm, bottom of page):

const mat2 m = mat2(0.8,-0.6,0.6,0.8);

float terrain( in vec2 p )
{
    float a = 0.0;
    float b = 1.0;
    vec2  d = vec2(0.0);
    for( int i=0; i<15; i++ )
    {
        vec3 n=noised(p);
        d +=n.yz;
        a +=b*n.x/(1.0+dot(d,d));
        b *=0.5;
        p=m*p*2.0;
    }
    return a;
    }

What effect does (1.0+dot(d,d))? As the slope is more / it flattens the fbm sum?


texts: C# Perlin noise - generating “endless” terrain chunks?

texts:
I'm currently writing a little side scroller in C#, to both learn C# and have fun. Right now I have a simple random number generator generating the world but it isn't exactly all that great - so with some research, I've discovered that Perlin Noise generation may help me out quite a bit. Problem is, I want to have an "endless" landscape made up of several chunks.

Basically my questions / concerns are:

Using minecraft as an example (Ignoring the 3rd dimension), how is Notch getting each chunk to connect to each other perfectly? Tunnels, caves, ore veins, mountains, flat lands, biomes, etc. are all connected to each other even though each chunk is generated separately, and sometimes at a much later date. This is key for me, I want the player to be able to walk to the right and as they are walking, generate more landscape that connects to previous landscape, including underground tunnels and cave systems.
Going off of #1, how would this be accomplished under the assumption that each chunk is a square, and the world is 10 squares high, and infinite squares wide? I.e. Each "chunk" is 128x128 tiles and the world is 1,280 tiles tall total. (This is so that I can make an infinitely deep map if I choose to - and also to show that all 4 sides of a chunk / square need to be able to connect and continue on what the previous square/chunk was doing).


texts: How do I make night cycle like Dino Chrome?

texts:
I want to add a day/night system cycling to my runner game like the game Dino Chrome. The condition is when the score reaches 100 it will be night then when it reaches 100 again will be day.
I tried with this code but nothing changed in my game:
if (_GameManager.instance.score % 100 == 0)
{
     fadeToBlack = !fadeFromBlack;

     if (fadeToBlack)
     {
          cam.backgroundColor = new Color(Mathf.MoveTowards(cam.backgroundColor.r, 1f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.g, 1f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.b, 1f, fadeSpeed * Time.deltaTime),
                                          cam.backgroundColor.a);
     }

     if (fadeFromBlack)
     {
          cam.backgroundColor = new Color(Mathf.MoveTowards(cam.backgroundColor.r, 255f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.g, 255f, fadeSpeed * Time.deltaTime),
                                          Mathf.MoveTowards(cam.backgroundColor.b, 255f, fadeSpeed * Time.deltaTime),
                                          cam.backgroundColor.a);
     }
}

Eventually I want to change all game object colors via script with smooth, but for now I just want to apply a change to the camera background.
and this is my whole script

    public static _ObstacleManager instance;

    private void Awake()
    {
        instance = this;
    }

    public float maxTime;
    float timer;

    [Header("CommongObstacle")]
    public GameObject[] Obstacles;

    [Header("BirdObstacle")]
    public GameObject[] buwungObstacle;

    [Header("MeteorObstacle")]
    public GameObject Meteor;
    public Transform[] spawnpoint;

    int choosedSpawnMeteor;
    int choosedObstacle;

    [Header("NightCycle")]
    public float fadeSpeed = 2f;
    public bool fadeToBlack, fadeFromBlack;
    public Camera cam;

    // Start is called before the first frame update
    void Start()
    {
        cam = GetComponent<Camera>();
    }

    // Update is called once per frame
    void Update()
    {
        if (_GameManager.instance.isStarted)
        {
            timer += Time.deltaTime;

            if (timer >= maxTime)
            {
                GenerateObstacle();

                if (_GameManager.instance.score >= 400)
                {
                    GenerateBuwungObstacle();
                }

                timer = 0;
            }

            if (_GameManager.instance.score % 100 == 0 && activeFade == null)
            {
                fadeToBlack = !fadeToBlack;

                Color color = fadeToBlack ? Color.black : Color.white;

                activeFade = StartCoroutine(FadeTo(color));
            }
        }
    }

    //kelipatan 200
    public void GeneratedMeteorObs()
    {
        choosedSpawnMeteor = Random.Range(0, spawnpoint.Length);
        GameObject meteorGo = Instantiate(Meteor, spawnpoint[choosedSpawnMeteor].position, Quaternion.identity);
    }

    public void GenerateObstacle()
    {
        choosedObstacle = Random.Range(0, Obstacles.Length);
        GameObject obstacle = Instantiate(Obstacles[choosedObstacle]);
    }

    public void GenerateBuwungObstacle()
    {
        choosedObstacle = Random.Range(0, buwungObstacle.Length);
        GameObject obstacle = Instantiate(buwungObstacle[choosedObstacle]);
    }

    // Store the fade in progress (so we don't accidentally double-start it)
    Coroutine activeFade;

    // Perform a fade over time, then clear the activeFade variable when done.
    IEnumerator FadeTo(Color destination)
    {
        Color start = cam.backgroundColor;

        for (float t = 0; t < 1f; t += Time.deltaTime / fadeSpeed)
        {
            cam.backgroundColor = Color.Lerp(start, destination, t);
            yield return null;
        }

        cam.backgroundColor = destination;
        activeFade = null;
    }

```


texts: Linking 3D Models together in libgdx (skeletal)

texts:
I'm drawing a 3D stick figure for an Android app using Libgdx and its ModelBuilder's createCylinder() and createBox() methods.  In the render method I animate it by applying translations and rotations to specific limbs (waving hello, kicking, etc).

While I have that all working, when I attempt to translate the whole figure to a new x y z position (by adding the current x's, y's, and z's by the delta of the new ones), the position of any limb that has rotation are off.  It comes out looking like it entered a Star Trek transporter and came out disconnected on the other side.  Look like it's been torn apart.  Quite frightening.

I feel like there is a better way to draw a skeleton.  Is there a way to associate all the body parts together?  Almost like adding joints (knees, elbows, etc).  Something that connects 2 shapes together, so that when one is translated, the other follows without having to manually do all the math on the other one?  Or maybe some way of treating my all the shapes as 1 single model?

Is there a concept for this?  If not, how is this type of thing often done (aside from using 3D modeling applications)?

Thanks


texts: How can I use a char array to store image data?

texts:
I am learning the physics engine Chipmunk. In the source code, the example demo "LogoSmash" uses char array to store image_data, but I don't understand how to do that, it's amazing!

Here is the LogoSmash code in question:

static const unsigned char image_bitmap[] = {
  15, -16, 0, 0, ...
}

Will someone explain how this works and how I could do this?


texts:
I am trying to draw spheres using a billboard, so I have a normal map with a z component that I am sampling in my fragment shader.  I just need to add this z component to the depth of my fragment to get proper 3D spheres...

How do you determine the current fragment's z-depth, add my offset and then set gl_FragDepth?

I've found lots of confusing contradictory hints and partially working bits of code all over the 'net, but no definitive clear answer.

UPDATE

final result (no shadowing) http://www.youtube.com/watch?v=88idbFlvQV0


texts:
I'm working on a puzzle game. I thought of a core mechanic, implemented it, tuned it and now I have something I'm happy with.

I'd really like to build a few levels before I work on stuff like UI and sound, however, I'm not sure if I should sort out some other things first:

Story

The game has a story (as opposed to many other puzzle games). The thing is, I just have a basic idea of what it should be, nothing detailed and nothing's written down.

Should I work out the story in some detail first? Figure out what arc I want to tell in the first 5 levels before I build them? Or is the story somewhat orthogonal in puzzle games and I can just go ahead and build some levels?

Elements

I've thought of a rather minimal set of gameplay elements, i.e. objects you can interact with, to evaluate the core mechanic.

I'd really like to keep things minimal and see how far I get with just those, but is that sane? Should I think long and hard about what elements I need upfront or should I add them when I feel that something's missing in a level I'm building?

Bottom line: What should I do before designing the first few levels?


texts: In Monogame, why is multiple tile drawing slow when rendering in "windowed fullscreen"?

texts:
I have this drawing function (recommended as a solution here).
It draws tiles on the whole window with no problem but my game slows down to ~30fps after maximizing it to "windowed fullscreen", which is 1600x1200 on my PC. (So 1600/16 * 1200/16 = 7500 tiles in the window)

While I want to add more advanced stuff to this simple rendering I wonder if it is possible to draw this tiles in instantiated way in monogames? (Like in OpenGL 3.3)
Or is there any other way to speed it up?

BTW. Lowering the number of tiles is not a way and i need to update whole screen per frame because of incoming transparent GUI.

protected override void Draw(GameTime gameTime)
{
    frameCounter++;

    GraphicsDevice.Clear(Color.CornflowerBlue);

    spriteBatch.Begin();

    for (int x = 0; x < Window.ClientBounds.Width / 16; x++)
    {
        for (int y = 0; y < Window.ClientBounds.Height / 16; y++)
        {
            int offX = x + mainCamera.Position.X;
            int offY = y + mainCamera.Position.Y;

            Tile t = gameMap.GroundTiles[offX, offY, mainCamera.Position.Z];
            spriteBatch.Draw(t.Texture, new Vector2(x * 16, y * 16));

        }
    }

    spriteBatch.End();

    base.Draw(gameTime);
}


texts: How can I kill a libGDX AsyncTask immediately?

texts:
Is there any way of killing a running AsyncTask immediately in libGDX?

The AsyncExecutor that submits it seems to just have one method (dispose()) that kills all the AsyncTasks that it handles after they've all managed to complete their runs.

Currently, to achieve what I want, I use a volatile boolean in the task class, loop on its value in the call() method of the same class, and then set it to false whenever I want to interrupt that specific task immediately.

I wonder though whether there's another, more direct, way of achieving this. Is there any other class or method responsible for this?


texts: What is the difference between an "API," a "framework," an "IDE," and an "engine?"

texts:
I am just starting out trying to learn to develop games. At first I thought C++ and OpenGL were the tools a beginner would start out to make a game, but quickly found out the OpenGL was just a API for graphics. Then I thought C++ and SFML were what I needed to learn to make a game, but found out the SFML was a media framework that could be used to make games but wasn't a game engine.

I don't want to use a software that does all the work for me, I want to code my own game, the way a game programmer would. I don't understand the difference between a IDE, framework, API, and a engine; What separates them from each other? Do some game programmers use the SFML framework, while other programmers use a game engine?


texts:
I have the following three vectors:

posA: (1,2,3)
normal:   (0,1,0)
offset:   (2,3,1)

I want to get the vector representing the position which is offset in the direction of the normal from posA.

I know how to do this by cheating (not using matrix operations):

Vector3 result = new Vector3(posA.x + normal.x*offset.x
                             posA.y + normal.y*offset.y,
                             posA.z + normal.z*offset.z);

I know how to do this mathematically
Note: [] indicates a column vector, {} indicates a row vector

result = [1,2,3] + {2,3,1}*{[0,0,0],[0,1,0],[0,0,0]}

What I don't know is which is better to use and if it's the latter how do I do this in unity? I only know of 4x4 matrices in unity. I don't like the first option because you are instantiating a new vector instead of just modifying the original. Suggestions?

Note: by asking which is better, I am asking for a quantifiable reason, not just a preference.


texts:
I've looked up a lot of tutorials on YouTube and all of them only work for versions of Minecraft prior to 1.7.9.

I first got a Minecraft Coder Pack (MCP) off of this website, but then realized that only decompiles Minecraft 1.6.4. Then I found a more recent MCP (that's not on the website for some reason) and it is version 9.03, downloaded here. This decompiles Minecraft version 1.7.2 (when I followed this video's instructions, I run the decompile.bat file and it says Json file not found in C:\Users\mike\AppData\Roaming\.minecraft\versions\1.7.2\1.7.2.json).

Basically I can't decompile Minecraft 1.7.9, but I can decompile older versions. However, I don't have any older versions downloaded onto my computer. I have only 1.7.9.

Then I tried using Forge, but realized that most videos were using versions of Minecraft prior to 1.6.4, meaning they use the bin folder that does not exist anymore. Even after trying to figure that out as well, the decompiling would never work. I tried to do what this video did, but couldn't replicate it. Then I finally looked at this video about using Forge and I could replicate it, but this didn't decompile Minecraft. It just set up a workspace in Eclipse that I'm not sure how to use.

TL;DR

I can decompile Minecraft 1.6.4 and 1.7.2 but I can't decompile version 1.7.9. Should I download an older version of Minecraft, wait for an MCP for 1.7.9, or something else? Is there something I'm missing, where I actually can decompile and mod Minecraft 1.7.9?


texts: Handling exact collisions on character controller and/or other objects in unity? (eg. head shot, chest , leg,etc)

texts:
Hello all I have been working on games in Unity for a long while (making slow progress as I do it purely on my own , and of course you helpful people here on gamedev.stackexchange!)

I've made lots of capsule characters of my own using Rigidbody and without Rigidbody and on a basic level they work fine.  But i now want to detect exact points of collisions (for example if a bullet hits his head, or hand or knee etc etc)

I've been trying to read as much as I can find about this, but honestly can't find the answer i need. I believe I would achieve it by making several colliders on the character. But I don't know exactly how this would work , also I have seen some guides saying that I should use OverlapSphere but again there wasn't exact instructions and I can't figure out how to do it.

Also, when I add some sphere colliders to my character, they dont stay in the correct position in relation to the model once it is animated (eg. Crouching, or running, the leg spheres pop out of his legs for example).

Could anyone here provide an explanation of how I can do it?


texts: Best Practices for class usage and game architecture

texts:
I'm making a 2D game similar to mario in Java.

I have some questions about class organization and proper method usage.

I have the following classes:

Main: runs the game in a JFrame
GamePanel: JPanel with boundary rules, timer, paintComponent, scoring, keyboard input, collision check
Player: only knows about its own attributes... has getter and setter methods for x, y location, height, width, weight etc...
Item: Same thing as Item class... this class will be used for items in the game, like bullets, cars, etc...
Physics: I was going to use this class to contain all actions for all items in the game (items class, player class, etc)... Like the rules for jumping, or running, etc...

Am I using the classes appropriately? I'm not sure whether each class should contain its own unique methods...

For example, only Player class objects will be able to jump and run... So should Player class have jump() and run() methods? Or should it just have setX(), setY() methods which alter its location based on run() from another class like Physics()?

And for a gun, I have shoot() which creates a new Item

 bullet = new Item(this, player.getX(), player.getY()+40, 25, 10, 10, bulletVelX, 0);

But as you can see below, I'm actually moving the bullet via the timer() class by calling the Item class's autoMove() method to change the bullet Item's location.

I'm also confused on the correct usage of timer():

I'm using it to run methods at a certain interval if a given boolean is set true...

public void timer() {
    timer.scheduleAtFixedRate(new TimerTask() {
        public void run() {
            collisionCheck();
            if (jump) {
                player.jump(velocityX, -velocityY);
                velocityY--;
                checkPlayerBounds(player);
                repaint();
            }
            if (shoot) {
                if (!bulletMag.isEmpty()) {
                    for (Item bullet : bulletMag) {
                        bullet.autoMove(bullet.getVelocityX(), bullet.getVelocityY());
                    }
                    if (bulletMag.size() > 30) {
                        bulletMag.clear();
                    }
                    repaint();
                }
            }
        }
    }, 0, 100);
}

Is is okay to put all that logic inside the timer class? Or should the timer class be kept as clean and empty as possible? Is that where my main Game loop is?

Lastly, paintComponent():

I put a paintComponent in each class (Player, Item, and  GamePanel so far), and paint them by calling them from within the GamePanel's paintComponent. Is that right?

public void paintComponent(Graphics g) {
    g.setColor(Color.white);
    g.fillRect(0, 0, width, height);
    player.paintComponent(g);
    for (Item bullets : bulletMag) {
        bullets.paintComponent(g);
    }
}

So, in summary is my usage of classes, timer, and paintComponent correct?


texts:
I'm using a basic pixel shader here

uniform sampler2D texture;
uniform float pixel_threshold;

void main()
{
    float factor = 1.0 / (pixel_threshold + 0.001);
    vec2 pos = floor(gl_TexCoord[0].xy * factor + 0.5) / factor;
    gl_FragColor = texture2D(texture, pos) * gl_Color;
}

It works great in my game. But on a new enemy it doesn't. This enemy is different because it uses a texture atlas- one big texture holding more frames than just the character. The sampling gets messed up because factorapproaches 0 so does the xy coord therefore sampling some pixels outside of the character's sheet. Likewise when pixel_threshold gets small, the xy coord goes outside of the character's spot in the texture.

Clamping is not the solution because we want it to wrap around. I've tried many ways of wrapping but not seem to offer the desired effect of the original.

I tried using 4 uniforms: left,top,width,height and passing in the masking values used when drawing the sprite from the spritesheet.

vector2 size = mySprite.getSize();
float left = mySprite.getTextureRect().left / size.x;
float top  = mySprite.getTextureRect().top / size.y;
float width= mySprite.getTextureRect().width/ size.x;
float height=mySprite.getTextureRect().height/size.y;

myShader.setUniformf("left", left);
...
myShader.setUniformf("height", height);

How can I have the pixel blur shader stay within the texel ranges provided by the uniform? Thanks.


texts: Is there a way to make it easy to add new content to my game without much effort ?

texts:
Good evening !

Im currently developing an little "mmorpg" on my own. I started some months ago and i noticed that its pretty hard to add new content or features to it due to the complexity of the code, structre and the framework. Let me give your an little example...

In my game, players can build stuff. So theres a base class called "BaseEntity". It will be used for all entity related stuff, buildings, resources, duengongs and so on. Theres also a "BuildingEntity" which extends "BaseEntity" and a "TowerEntity" which extends "BuildingsEntity". So all in all this makes it very easy to add new Buildings to my game without writing the same base class ever and every again.

But there problems too. In many places i need to check if the "GameObject" holds an certain Class as a Component. For example, when my player clicks on the tower, i need to check if theres a building script assigned to it. And when i create new "branches" i need to add those to my existing codes every and ever again. This makes it very complicated at some point.

Are there any structures or tricks to make adding new content to a game much more easier ?


texts: Unity material is missing after compilation

texts:
I have a piece of code that signals the player that a projectile has hit its target. Everything works fine during the playmode, however after I compile it, it acts as if there was a missing material.

I did some trouble shooting, made 3 different builds with different settings, and I tried running the game with different quality, ranging from Fastest to Fantastic. Yet I can't find a cause of this problem.

IEnumerator flash() {
        rend.material.shader = specularShader;
        yield return new WaitForSeconds(flashTime);
        rend.material.shader = defaultShader;


texts: Unity C#: Change speed when all Targets are destroyed

texts:
I have a game where a Gunner moves on a pre-set path towards a final destination. You play as a Magic Bullet that auto-fires from the Gunner's current position and can be controlled with WASD. When the bullet collides with a Target, it's destroyed.

My question: How do I change the speed of the Gunner after all of the Targets are destroyed? The idea if for the Gunner to hurry to the end, instead of skilled players waiting around.

Any help would be greatly appreciated. Here's what I have so far:

using UnityEngine;
using System.Collections;

public class MovementPathScript : MonoBehaviour {

    public GunnerPathScript PathToFollow;
    public int CurrentWayPointID = 0;

    private float speedVariable;
    public float gunnerSpeed;
    public float hurrySpeed;

    private float reachDistance = 1.0f;
    public float rotatationSpeed = 5.0f;

    public string pathName;

    public static Quaternion gunnerRotation;

    private Vector3 last_position;
    private Vector3 current_position;

    void Start () {
        last_position = transform.position;
    }

    void Update () {

        float distance = Vector3.Distance (PathToFollow.path_objs [CurrentWayPointID].position, transform.position);
        GunnerMove ();

        PointTowards ();

        if (distance <= reachDistance) {
            CurrentWayPointID++;
        }

        if (CurrentWayPointID >= PathToFollow.path_objs.Count) {
            CurrentWayPointID = 13;
        }
    }

        void GunnerMove(){
            transform.position = Vector3.MoveTowards (transform.position, PathToFollow.path_objs [CurrentWayPointID].position, Time.deltaTime * speedVariable);
            speedVariable = gunnerSpeed;

        if (GameObject.FindGameObjectsWithTag ("Target") == null) {
            speedVariable = hurrySpeed;
            //Unity doesn't recognize this, and maintains gunnerSpeed

        }
    }

    void OnTriggerEnter(Collider other){
        if (other.gameObject.CompareTag ("Target"))
            Destroy (this.gameObject);
    }

    public void PointTowards(){
        var gunnerRotation = Quaternion.LookRotation (PathToFollow.path_objs [CurrentWayPointID].position - transform.position);
        transform.rotation = Quaternion.Lerp(transform.rotation, gunnerRotation, Time.deltaTime * rotatationSpeed);
    }
}


texts: NavMesh.CalculatePath returns invalid path Unity3D

texts:
I am trying to get coordinates for path from source to destination object using NavMesh. NavMesh.CalculatePath() is only working for one level surprisingly. For all others, it returns false. Also NavMeshPathStatus is invalid. This is working Level, while this is not working fine with navmesh.

Code:

private NavMeshPath path;

    void Start () {
        path = new NavMeshPath();
    }

//Following function is called on button press
public void giveHint() {

        NavMesh.CalculatePath(source.transform.position, destination.transform.position, NavMesh.AllAreas, path);

    if (path.status == NavMeshPathStatus.PathComplete)
        print ("Path complete");
    else if (path.status == NavMeshPathStatus.PathInvalid)
        print ("Path invalid");
    else if (path.status == NavMeshPathStatus.PathPartial)
        print ("Path partial");

    for (int i = 0; i < path.corners.Length-1; i++) {
            Debug.Log(path.corners[i]);
        }
   }

// Update is called once per frame
    void Update () {
    if (path.corners != null) {
            if(path.corners.Length > 0) {
                for (int i = 0; i < path.corners.Length-1; i++) {
                Debug.DrawLine (path.corners [i], path.corners [i + 1], Color.red);
                }
            }
        }

    }

Please tell me way to debug/solve this issue. How unity calculates path between source and destination? Can there be possibly blockage in path? If yes then how? How path is invalid? Is there any bottleneck with the usage of CalculatePath function? Need guide from you guys... Thanks!


texts: What are the cons of using DrawableGameComponent for every instance of a game object?

texts:
I've read in many places that DrawableGameComponents should be saved for things like "levels" or some kind of managers instead of using them, for example, for characters or tiles (Like this guy says here). But I don't understand why this is so. I read this post and it made a lot of sense to me, but these are the minority.

I usually wouldn't pay too much attention to things like these, but in this case I would like to know why the apparent majority believes this is not the way to go. Maybe I'm missing something.


texts: Ways to include relativity in multiplayer

texts:
Im currently working on a game concept including flying Space Ships in the solar system and maybe beyond.
As the ships are using similar engines than in "The Expance" Epstein Drive. relativistic speeds may be possible.

As i dwelled deeper into the topic, i realized that including relativistic speeds may bring some problems, if you want to acknowledge this in any game.

First of all time dilation when moving with higher speeds relativ to some other ship means, you can basicly do less things in the same time frame compared to a stationary observer. Including producing goods, shooting and whatever. For the traveler, this does look like everyone else is just faster.
Another Problem is the lenght contraction. Basicly distances in the direction of movement shorten. Distance between objects get shorter, the objects themself seem squished, while from a stationary observer, the traveling ship seems longer and stretcht.

In a singleplayer game, all these concept may be doable, as the player is either the one who travels or the one observing. There are some interesting games working with relatitivy in interesting games, like  reducing the speed of light to walking speed.

In multiplayer this seems to make problems, as the game has to compensate for these relativitic effects. Yes, i can let the game run asymetricly for different players, that would work for the time dilatation. But then the twin paradox comes along and basicly breaks the concept of continuity. The stationary player needs to have much more time than the traveling one.

My Question is, is there any way to do it right or at least ways to compensate in regards to the time dilation. Are there any games that did have a good implementation of relativistic in multiplayer?


texts:
A friend of mine and I were discussing different idea for allow materials in a world to be destroyed in a very piecemeal fashion and he proposed the idea of representing solids as very viscious fluids. My intuition is that this would be either: A) very difficult, or B) very resource intensive, but I am unsure.

Is such a model feasible for an RPG/adventure rpg/fps?

edit:clarification: The idea is for collisions and objects breaking to be handled by this system. To basically allow any object handled this way to be destructable instead of having scripted destroyable objects.


texts: How can I measure the weight in Farseer?

texts:
I have two different objects(star and rectangle) and I want to measure the entire weight that lies on the balance. How can I do that? Is it possible to know the entire weight that presses on the balance?

The rectangle is lying on the star, it is not possible to lie the rectangle on the balance.
You can see the balance in this picture:


texts:
I've had problems building on libtcod on OsX but i'm not the only one (see http://doryen.eptalys.net/forum/index.php?topic=621.0) but the beautiful RL Brogue uses Tcod and even builds on a Mac (https://sites.google.com/site/broguegame/).

anyone else get to developing on OsX with libtcod?  hopefully with Make, not XCode tho...


texts: Unity3d Transfer of value from one script to another

texts:
Script 1

public class enemy : MonoBehaviour {
    private Vector3 Player;
    private Vector2 PlayerDirection;
    public float Xdif;
    public float Ydif;
    private float speed;
    private float distance;
    private bool stun;
    private float stuntime;
    GameObject playerObj;
    private Rigidbody2D myRigidbody2D;
    private bool isEnemyFear;

    // Use this for initialization
    void Start () {
  stuntime = 0;
  stun = false;
  speed = 6;
  playerObj = GameObject.Find ("Player");
  myRigidbody2D = GetComponent<Rigidbody2D>();
    }

    // Update is called once per frame
    public void Update () {
  distance = Vector2.Distance (Player, transform.position);
  Player = playerObj.transform.position;
  if (stuntime > 0) {
   stuntime -=Time.deltaTime;
  } else {
   stun = false;
  }
  if(isEnemyFear){  //here to pass a value from script 2
   EnemyFear();
  }
  else{
   EnemyAttack();
  }

    }
    void EnemyAttack(){

  if (distance < 25 & !stun) {
   Xdif = Player.x - transform.position.x;
   Ydif = Player.y - transform.position.y;
   PlayerDirection = new Vector2 (Xdif, Ydif);
   myRigidbody2D.AddForce (PlayerDirection.normalized * speed);
   Debug.Log("Attack");
  }
    }

    void EnemyFear(){

  if (distance < 25 & !stun) {
   Xdif = Player.x + transform.position.x;
   Ydif = Player.y + transform.position.y;
   PlayerDirection = new Vector2 (Xdif, Ydif);
   myRigidbody2D.AddForce (PlayerDirection.normalized * speed);
   Debug.Log("Fear");
  }
  StartCoroutine(Timer());
    }

    void OnCollisionEnter2D(Collision2D Playerhit){
  if (Playerhit.gameObject.CompareTag("Player")) {
   stun = true;
   stuntime = 1;
  }
    }
    IEnumerator Timer() {
  yield return new WaitForSeconds(10);
  isEnemyFear = false;
  StopCoroutine ("Timer");
    }

}

Script 2

public class randomizer : MonoBehaviour {

    private bool isEnemyFear;

    public void CheckFear(){
  int rand = Random.Range(0, 100);
  if(rand > 35)
   isEnemyFear = true; //this value should be passed to the script 1
    }

}

How to pass a value isEnemyFear = true from Script 2 in Script 1?


texts: How to make sure an object NEVER passes through an edge collider (2D)?

texts:
In my top down perspective game, I have a ball that bounces off of walls. The ball should behave in a way where it will always bounce off in a 90 degree angle. The ball can only move up, down, left and right and the walls are slanted so that they should always (theoretically) bounce a ball up, down, left or right.

On the ball object, I have a small circle collider 2D and a Rigidbody 2D attached, the walls have a single edge collider 2D attached. Approximately one time out of twelve times, the ball will simply pass through the edge collider, so it's not consistent.

How can I make sure that the ball always registers the collision?

Here's my setup:

The script I use to move the ball:

void Update () {
    switch (direction)
    {
        case 'u':
            transform.Translate(0f, ballSpeed * Time.deltaTime, 0f);
            break;
        case 'd':
            transform.Translate(0f, ballSpeed * -1 * Time.deltaTime, 0f);
            break;
        case 'l':
            transform.Translate(ballSpeed * -1 * Time.deltaTime, 0f, 0f);
            break;
        case 'r':
            transform.Translate(ballSpeed * Time.deltaTime, 0f, 0f);
            break;
    }
}

Additional info:
 - every wall is it's own object with it's own edge collider.
 - the ball always hits the center of the wall because I center the ball object using the center of the wall it touches. Note: I had issues with the ball passing through walls even before I implemented the centering.


texts: Unity 2D: Dealing damage when character is crushed between two solid objects

texts:
Whats the best approach to dealing damage to a player when they get stuck between two solid objects? For instance, I'm trying to make moving platforms that the player can ordinarily touch. It's only when the player is caught in-between the moving platform and the ceiling, for example, that damage is dealt or the player dies.

So, what would be the best way to approach this? Thanks in advance!


texts: Can I sample audio sources from others without asking?

texts:
As the title says, would it be considered legal if I take a part of an audio source (any media like music, dialog, video, etc.) to use in a project, whether it is for commercial or non-commercial purposes, without contacting the owner/creator of the asset?

As an example, Earthbound used this technique to create unique and memorable soundtracks.


texts: Attach component of other Object to a variable within Unity Inspector

texts:
This question might sound a bit stupid and I'm sure there is a simple solution for this .. I'm just not finding it:

Actually all I want to do is attach the MeshRenderer Component of this Object

to a variable of a script on another Object like

Problem: As soon as you click on the Capsule Object ofcourse the Inspector changes to this Object and I cannot drag in a component to the previous selected Object anymore.

I know there are a lot alternatives like linkin only the GameObject e.g. as MeshObject and later in code refer to MeshObject.GetComponent<MeshRenderer> but I wondered if this can be done directly, too.


texts: Generate screen space distance field from depth buffer

texts:
I've been wanting to try out raymarching on real 3D scenes to implement effects like AO, soft-shadows and such.

I pretty much know how to use signed distance functions (as described by Inigo Quilez) to approximate a model and raymarch it, but I want to have way more precision and have the distance field of my scene.

How would you go about generating a (un)signed distance field from the depth buffer in screen space ? Or would the usual depth buffer be usable as a distance field (I don't think so) ? Or there might be better ways that don't use the depth buffer ?


texts:
How can one rotate a quaternion so that the rotation is around a plane normal?
A graphic/diagram I made below gives more detail about what exactly I am implying.  Note that the tip of the quaternions in the diagram are that of the quaternions local, upwards direction, symbolizing roll (the quaternion's w component).

English describing the diagram:
The rotation is around plane normal (vector) N with amount θ.  The global axes are X, Y, and Z (Y is up).  The plane normal and quaternion are both in global space.  Notice how the beginning and end of the operation does not use any reference to the global axes, only the plane.
The angle between the start quaternion (q) and end quaternion (q') and the plane is equal (a = a').  If you were to draw lines from the tips of the quaternions to the plane, the angles of intersection would be equal.  In other words, the roll of the quaternions are preserved in relation to that of the plane.

EDIT 6/21/2020:  Thanks to Theraot, this is possible simply by doing this in your favorite engine with quaternions:
quaternion qPrime = quaternion.AxisAngle(normal, θ) * q;

As Theraot states in his answer, order of multiplication does matter, and some engines may do the opposite operation compared to other engines.  For Unity's Mathematics package, the above pseudo-code holds true.  The formula for AxisAngle can be found by a simple google search.  The following Gif shows it working while proving that all angle requirements I stated above are satisfied.


texts: Is there a way to get native resolution of device window/display on android?

texts:
When change the framebuffer resolution by calling

Screen.setResolution(1920,1080)

Screen.currentResolution, Screen.width, Screen.height reports back the new resolution 1920x1080.

Screen.resolutions gave me empty array (tested on real android device).

I am unable to get back the original resolution which was a native resolution of the device. Do I have to remember the native resolution or is there a way to get that through unity API ?


texts: "RuntimeError: Validation failure (0)" using shaders

texts:
I'm trying to move away from using glVertex() in my game code because it doesn't seem to work well with a large quantity of vertices. At the moment I'm trying to make code that uses Shaders, but when compiling with shaders.compileProgram, it gives me the error shown in the title, with no explanation as to what is wrong.

Code so far:

import OpenGL
from OpenGL.GL import *
from OpenGL.GL import shaders
from OpenGL.arrays import vbo

import math
import pygame
from pygame.locals import *

VERTEX_SHADER = shaders.compileShader("""
#version 120
 void main() {
    gl_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
 }
""", GL_VERTEX_SHADER)

FRAGMENT_SHADER = shaders.compileShader("""
#version 120
void main() {
    gl_FragColor = vec4( 0, 1, 0, 1 );
}
""", GL_FRAGMENT_SHADER)

self.shader = shaders.compileProgram(VERTEX_SHADER,FRAGMENT_SHADER)

The full error message:

Traceback (most recent call last):
  File "PyOpenGl shader test from scratch.py", line 24, in <module>
    self.shader = shaders.compileProgram(VERTEX_SHADER,FRAGMENT_SHADER)
  File "/home/[my name]/.local/lib/python2.7/site-packages/OpenGL    /GL/shaders.py", line 196, in compileProgram
    program.check_validate()
  File "/home/[my name]/.local/lib/python2.7/site-packages/OpenGL/GL/shaders.py", line 108, in check_validate
    glGetProgramInfoLog( self ),
RuntimeError: Validation failure (0):

Is there a line I need to add for it to tell me what is wrong?


texts:
I think this question should have been posted on Stack Overflow, but as I am using all of this stuff to make a video game, I decided to post it here.

So, suppose you have an integer value called 'firstgid' declared:

int firstgid;

And I'm not telling the program what value firstgid equals to, like I'm not saying that int firstgid = 5; or something.

And then somewhere else in the program, I say:

SDL_Texture* tex(graphics, &firstgid);

Notice the &firstgid here. I am not telling the program what firstgid is, and still I am making a reference to it using the ampersand
(&) symbol.

So, if I do that, will the program crash and display this breakpoint error on the output screen?:

Unhandled exception thrown. Read access violation:
  **this** was nullptr

A good folk just told me that the **this** was nullptr breakpoint error is triggered when we are calling a function on an unknown value or stuff.

What do you guys think about it?
 Thank you for your kind assistance.


texts: dynamic body jumping out of water object

texts:
In my game I have my main object, a jetski, which will dive down into water, when the screen is touched. I managed to code the jetski diving down, with Box2d and some buoyancy forces. But when the jetski is under water, it just rises to the water surface and stays there. Short: the jetski isn't jumping. I thought about applying forces as soon, as the jetski is on the surface. The problem with it is that the force would be a constant force ignoring how deep the jetski was (the deeper the jetski was, the faster it should rise and jump out).
Is there any other way of doing this?
This is the kind of thing I want: https://www.youtube.com/watch?v=b2t_zMOy5SM


texts: How can I make a proxy server between a client and a server to analyise my packets

texts:
Otherhand how can i manipulate where the game client want to connect?
I've built a python proxy server that can handle this proxy server, it is a basic thing that just: bind a server, wait till the client connect, and connect to the server, and send all data that have got from the client via this proxy, and send forward to the main server.
And here is the problem that i not able to solve, the client don't want to connect to my proxy server. I modified my etc/hosts before, and i failed as well.
Any idea to solve this problem?


texts: Can instantiated objects have different material/texture?

texts:
While I have some experience with simple 2D games, I am new to more process-demanding 3D games. One basic question that has been concerning me recently and for which I am having difficulties to find a proper detailed answer, is the following.

I understand that when we instantiate an object, we are saving memory because the instantiated copy does not have to save mesh memory (like vertices' position, UV cood and normals). So, the instantiated copy only needs to save a transformation matrix in order to properly position, scale and rotate the mesh structure they share with the original mesh.

But can the instantiated copies have different texture or material from the original mesh from which they were instantiated? If so, then it means the instantiated objects actually save with themselves more than transformation matrices. I would love to read more on that, so suggestions are welcome.


texts:
I am making my first small mobile game in C# XNA. Lets say I have 3 screens, the main menu, options and game screen. A single game session usually lasts for 1 min, so the user will alternate frequently between the main menu and game screen. Therefore, once I load the textures for either screen, I want to keep them in memory to avoid frequent reloading. Both screens share some assets like their background textures, but differ in others.
The first solution I came up with is making 2 texture factory classes, MainScreenAssetFactory and GameScreenAssetFactory, each with their own content manager, and ill store them in a globally accessible point so that they persist after either screen is destroyed. There is also a OptionsScreenAssetFactory, but that I dont want to cache it since the options screen is rarely visited.

A typical Factory would look something like this

public class MainScreenAssetFactory
{
    private readonly ContentManager contentManager;

    public MainScreenAssetFactory(IServiceProvider serviceProvider, string rootDirectory)
    {
        contentManager = new ContentManager(serviceProvider) { RootDirectory = rootDirectory };
    }

    public Texture2D ListElementBackground
    {
        get { return contentManager.Load<Texture2D>("UserTab"); }
    }

    public Texture2D ListElementBulletPoint
    {
        get { return contentManager.Load<Texture2D>("TabIcon"); }
    }

    public Texture2D LoggedOutUser
    {
        get { return contentManager.Load<Texture2D>("LoggedOutUser"); }
    }
}

Since both Main, Options and Game Screen share some common resources, instead of loading them more than once, I created another class CommonAssetTexFactory which holds the common stuff and stays in-memory during the app lifetime. For example, this class gets passed to the options screen when it is created.

However, given my small game with its few assets, I am already finding this solution cumbersome and inflexible. Changing anything would require looking to see if its already in the common factory, and if not, modifying existing factories and so on. And this is just considering textures currently, i didnt add sound files yet. I cant imagine bigger games with thousands of resources using this approach. A better idea must exist. Would someone please enlighten me?


texts: API agnostic bridges (ie. OpenGL/D3D/Whatever). Do you use them, how you make them. Pro's and Con's

texts:
You are making a 3d engine. You want best of multiplatform worlds. Suddenly you realize that if you want to use Direct3D on Windows machines and OpenGL on OSX/Linux, you'll have to sacrifice supported features of both to least common denominator.

Some may use OpenGL across three OS', since it appears to be least common denominator by itself. All is good. Then, you have to port your graphics API backend to Nintendo's GX, you also have to make a PS3 and Xbox360 path.

What do you do? Do you design your own API which is least common denominator in itself and write backend implementations for it for each platform or do you write for each platform it's own branch?

If you opt to design your own API, do you use bridge pattern or your own voodoo? Where does madness stop where you realize everything and kitchen sink approach must stop and you basically have separate engine for each platform as a branch. Or you stick to everything and kitchen sink and keep platform specifics in backend module specializations for each platform.


texts:
I want to have text that flashes from green to white and back to green over and over until the window is closed? Below is what I have tried but i cant seem to get it to work, please help me.

int main()
{
    sf::RenderWindow window(sf::VideoMode(LAYOUT_WINDOW_WIDTH, LAYOUT_WINDOW_HEIGHT),
        "Tetris 2019 - A New Beginning");

    sf::Font myFont;
    if (!myFont.loadFromFile("cartoon relief.ttf")) {

    }

    window.setFramerateLimit(30);

    sf::Text gameOver;
    gameOver.setFont(myFont);
    gameOver.setFillColor(sf::Color::Green);
    gameOver.setStyle(sf::Text::Regular);
    gameOver.setString("GAME OVER!");
    gameOver.setCharacterSize(65);
    gameOver.setPosition(30, 60);

    //everything below gets copied into the "processSplash" function
    while (window.isOpen())
    {
        sf::Time elapsed_time;
        sf::Clock r;

        sf::Time delta_time = sf::seconds(1);

        sf::Text playAgian;
        playAgian.setFont(myFont);
        playAgian.setFillColor(sf::Color::Green);
        while (window.isOpen && elapsed_time >= delta_time)
        {
            if (elapsed_time == delta_time)
            {
                playAgian.setFillColor(sf::Color::Green);
                elapsed_time == r.restart();
            }
            else
                playAgian.setFillColor(sf::Color::White);
                elapsed_time += r.restart();
        }
        playAgian.setStyle(sf::Text::Regular);
        playAgian.setString("Press ENTER to play agian!");
        playAgian.setCharacterSize(25);
        playAgian.setPosition(80, 235);

        sf::Event event;

        while (window.pollEvent(event))
        {
            if (event.type == sf::Event::Closed)
                window.close();

            if (event.type == sf::Event::KeyPressed
                && event.key.code == sf::Keyboard::Space)

                //close splash screen and start game
            {
                /*processSplash();*/
            }
        }

        window.draw(gameOver);
        window.draw(playAgian);

        window.display();
    }

    return 0;
}


texts:
I have 2 objects each with a 3x3 Matrix (Orientation) and a Vector3 (Translation). Both are relative to world coordinates.

How do I calculate the position and orientation of object B in relation to object A?

I'm using the JVector, JMatrix that are a part of the Jitter3D physics library. (http://code.google.com/p/jitterphysics/)

Any help would be greatly appreciated!


texts:
I am working on a RPG using the JMonkey engine. While I was conceptualizing the map, I realized I would have a problem with the terrain.

My problem is this: I want to have a click to move interface, and have the player move in increments of 1 world unit (wu). This is actually rather reminiscent of a tile based engine, but in 3d. While making the world map, do I need to make an object made of the world geometries, and load the one object, or would it be better to build a map out of the necessary tiles, using a file to tell the engine how to build the map (similar to 2d tile games)?

I might also add, the game isn't going to use heavy collision detection or real time physics, which is why I thought a tile based "pass-abilty" system might work.

Would loading that many objects for a tile be too much as far as memory goes? What if I make a single object, constructed of tiles by a definition file, and just make the player move in 1 wu increments, giving the illusion of "tile-based"?

I'm assuming that a combination of any of these might work, it's just that I don't have any prior experience making a system like this and would like some opinions on the most efficient method of doing what I'm trying to do.


texts: how to save data in a visual novel with shared object

texts:
I've been looking for ways to save data in a visual novel, I have seen that the best way to do  is with shared object but the tutorials are usually saved scores and I want to save the history progression

how can I do it?

Which variable should be used?

What should contain the variable?

shared object works for android and ios?

Thanks  for reading


texts: OpenGL memory optimization and batching technique pitfalls

texts:
I'm studying OpenGL optimization techniques. What I'd like to achieve is to emulate as closely as possible Mantle/DirectX12 programming patterns (aggressive batching, flexible memory handling, complex pipelines) with current OpenGL API. The assumption I'm making here is that hardware behavior is almost the same, with the OpenGL layer being a bit restrictive and not matching accurately the underlying architecture.

I'm considering the optimization technique proposed here:

http://www.openglsuperbible.com/2013/10/16/the-road-to-one-million-draws/

The article suggests allocating a giant buffer and writing a custom allocator to fill it with vertex, instance and texture data, then drawing it with glMultiDrawElementsIndirect. Immutable storage, triple buffering and persistent mapping can also be used for best streaming performance (see http://www.bfilipek.com/2015/01/persistent-mapped-buffers-in-opengl.html).

That seems pretty close to my goal, however I have some doubts:

I read that it's better not to overuse GPU memory on PC because it's also needed by other applications. However, when using this technique with dynamically loaded, continuously changing scenes (e.g. very large tiled worlds) we end up using much more memory than actually needed because we can't predict how much data we'll need to store. Is this a real concern? If yes, how can I address the problem?
View frustum and occlusion culling force you to continuously rewrite instancing and command data. Is this really good? Does decreased CPU load reward time spent copying around memory chunks? Does memory bandwidth significantly impact performance in this case?
Is the "one shader for all materials" method based on subroutines more efficient (higher frame rate with same input data) than modifying the program pipeline? What's the cost of binding a different pipeline or switching a shader in the current pipeline?


texts:
This is a rather complex question and I'm more hoping for general algorithms anyone might have heard of.

I wish to generate randomly sized rooms. Each of these rooms has a type and a corresponding list of furniture to be placed inside it (ie: kitchens can have fridges, both kitchens and living rooms can have TVs, etc). Each piece of furniture has it's own collider (cylinder, cube, mesh...). Are there any good algorithms to randomly lay them out?

The best idea I've managed so far is to subdivide the room into a grid the size of the smallest piece available. Then I would randomly place the furniture until every grid square is at least partially filled. However, this is hardly ideal and the rooms would more or less look like warehouses.

[Optional]How do I randomly place the furniture in such a way as to make it at least look slightly realistic?


texts: Simplyfing/dissolving octree to simple boxes by adjacent octants with similar traits

texts:
I am looking forward to create a navigation volume to be utilized by AI actors.

The approach I am trying to tackle here is to first generate an octree and associate with respectable flags/data (type, what's contained for now). The octree is going to be fairly deep (up to 0.1 units).

This is the scene I am using for testing purposes:

results in 1947817 nodes in 9 levels. (22 x 9 x 22)

I am looking for an algorithm/concept/pseudo-code that would transform this octree into non-uniform, axis-aligned boxes derived from octants that match certain flags/data, that would, for instance, help me determine the navigation volume similar to what can be seen here (Havok):

With "I am looking for" - I have a feeling of such an algorithm/concept already existing, though, I am not sure. The feeling drives me towards this being a fairly mathematical problem that resides behind a common name.

The other approach would be to utilize a non-uniform grid (creates 4356000 cells) for the detailed shape to then be expanded (simplified) down to some boxes. Which my feeling tells, would utilize the same algorithm.

As for the "what have you tried part" - well... I have googled for some time with various combinations from keywords grid, merge, cell, flags, occupied, gamedev, octant, grow, largest space, adjacent and maybe some others to no avail.
Well, before pushing the Post button, I did try some more keywords and ended up with this answer: https://gis.stackexchange.com/questions/23365/how-to-combine-adjacent-polygons-sharing-similar-trait-into-single-polygon which appears to be close to what I am looking for, except that it's 2D (though, I gave the keyword "polygon" for this query). Having learned that the process is called "dissolve", I made some more attempts with various combos with added word "dissolve". And through my findings some more searches and so on... Well... nothing.

If the answer wont yield any results, I know that I could attempt this by raying the hell out of the graph by starting at either corner and flooding through it all, basically, brute forcing my way.

So...

Is the common algorithm/concept already out there, that I could be pointed towards?;
or - what guidelines should I follow to produce such a product?


texts: Using Minimum Translation Vector in SAT algorithm

texts:
I am working on a simple rigid-body physics engine ,I've already implemented SAT algorithm for collision detection and everything works fine, Now i get to step to use MTV to calculate the distance which objects might move to,
In my case the two objects are cubes ,Actually i am a little confused about the distance and how to use it

Here is the two cubes

Both of them are on the same y-axis and z-axis, Only differs in x-axis

I am calculating MTV and i get:

samllest which refers to the smallest axis, So it looks like (x,y,z).

overlapDistance which refers to the smallest overlap distance as a double variable.

I know that overlapDistance is the distance that one of two cubes should move till no collision

But how to use it , How cubes should respond to this distance ?

Sorry if i am not clear, but for summary i know the smallest overlap distance but i don't know how to get use of it


texts: How to structure a simple game server for a multiplayer game?

texts:
I would like to create a simple multiplayer game server for a simple game:

The game is supposed to be similar to Command & Conquer, you have a few tanks and a few soldiers. You can select one soldier and than click on the map, to where the soldier should go. If the soldier comes to an area where he could not go, he walks around. And soldiers can be shot down by enemies.

How should I structure the game server, and what should be done at the client?

I.e if a soldier moves from X to Y but around building Z, I guess the server has to be able to calculate exactly where the soldier is located (in case an enemy shot at him), and the client also has to know the position for painting the soldier.

What should be done at the server and I think I have to desing a protocol for this. I think the server has to keep track of the game state and the time. Is anyone having suggestions on how to do this? or could recommend some reading?


texts:
I am trying to implement Box2D into my top down tile game in LibGDX. Each world consists of a set of chunks, and each chunk is 16 tiles wide/long. The maximum/minimum chunks loaded at one time is 9 (a 3x3 set of chunks with the player in the middle). This means that there are 2304 tiles active at all times.

I have tried creating a Static box shape for each of these tiles but performance was understandably terrible. I then tried creating a box shape for each of these tiles that are solid. Performance was still terrible because at one time there was 500-1000 individual boxes.

One partial solution I found to this is reducing the chunk size. At chunk size 8 with boxes around only solid tiles performance was 60 fps on mobile devices, however this was only sustained when the chunks that were loaded did not contain many solid tiles so this isn't really a solution.

I then came across a potential solution which would join all solid adjacent tiles within a chunk, so that instead of having a box for each individual solid tile, there would be a irregular polygon for each set of connected solid tiles. This solution appears to be the best, however what would happen when I want to destroy a solid tile. I would then have to recalculate all of the tile connections within that chunk and recreate another irregular polygon. To get around this, I then thought of dividing the chunk up into 4x4 sections. Each of these sections would handle their own irregular polygon so that when a tile was destroyed only that section would need to be updated and recalcuated. This however increases the number of bodies in the box2d world compared to the previous solution where there is just 1 body for each group of solid tiles.

I am looking for any other ideas that might help.

On a side note: The only reason I am using box2D is so I can achieve a nice lighting effect with shadows and everything with box2DLights. If there are any substitutes of this library that you know of please let me know!


texts: What is the best methodology in mounting customizables to a 3d avatar in Unity?

texts:
Someone I know suggested just making every customizable on the model then just hide the non active ones. But that doesn't sound very efficient for me.

So my question is what is the best method to use for making customizable 3d avatars in general? And specifically what would be best used in Unity3d?


texts: How do game makers (without coding) work?

texts:
How do game makers/engines like Buildbox, GameSalad, Construct, GameMaker, etc work? What technologies (programming languages, APIs, etc) are used to build the and how does the program convert the user's interactions into exportable code?

I realize this is a very broad question. What I'm looking for is how the software creates code/source files from the user interactions with the software. While details would be awesome, a high level overview would be great too.

I'm a second year CS major and have some experience with Java/C/C++ as well as some web languages and framework. It's hard to find information on how a game creation software works because there's more content on how to make games in general.

If there is a more appropriate forum/site to ask this, please point me in that direction!


texts:
Let's say I have an account on an MMORTS and I send my 10,000 strong army to a location on the map. I then shut off my computer.

Another player gives orders to his 10,000 strong army to walk to the same location and attack anyone located there. He then turn off his computer.

After 30 minutes when his 10,000 guys arrive at the scene the battle begins. Now killing 10,000 guys where both armies are using the same skill and weapon might take several hours.

Let's say I turn my computer on again and find the raging battle and that I only have 4500 soldiers left, so I decide to pull my army back.

This type of ongoing battle happens on the server. How could this be accomplished? I'm thinking JavaScript / PHP technologies. I'm thinking that there should be some sort of dice system to each attack so it could end with one side winning with 1500 men left even if they started with equal amount. Is there some sort of clever logic that would not require 20,000 calculations per frame to calculate each hit and and parry for every unit?


texts: Same noise generator for C# and Javascript

texts: I'm writing a 2D web racing game with procedural generated maps using perlin noise(as a university project). The server is written using C# and the client using Javascript. I've developed procedural generating of maps on the server but I've realized that's so time consuming. I've thought that players can generate maps and the server can validate some key points so server doesn't have to do both. The problem is that I don't know how to generate same map on the client (in JS) and the same map on the server (in C#). I've read some about deterministic random number generators which are platform independent. But I'm not sure how to search noise generators with them. Do you know where can I find some, especially in programming languages I'm using? Do I have to write own noise generator?


texts:
I'm new to libgdx and I'm currently working on TableLayout and wondering how could I draw borders for each cells.

I've done some research on this but it seems that I could come up with this solution only:
https://stackoverflow.com/questions/13828423/drawing-table-borders-in-libgdx-0-9-7

However, turning on the debug option would be a bit dumb and it's not what I want. I'd like to control the color, thickness of the cell border. Is there anyway to achieve this?

Thanks!


texts: I have lots of triangles in 3D space. How do I determine the slope/angle of these triangles with respect to a fixed ground plane? I need pseudo code examples at the very least.


texts: How to achieve persistence of objects between game states?

texts:
What are the possible ways of sharing different objects between game states?

Lets say a game has a couple of states (a menu state and a game state for example), at first the engine calls the menu state's load function which loads menu textures, music et cetera.

After returning from the load function the engine enters a loop which calls update and render over and over. At this point the menu state makes a TCP connection to a IP (joining a lobby for a 1v1?) which simply creates a object of a connection class and then signals the engine to switch to the game state, the menu state then unloads all the stuff it loaded up.

Now the engine calls game state's load function, the game state loads models, textures et cetera and then enters the update-render loop.

The question now is, how will the game state know about the connection class object that the menu state created? How do the states share objects between themselves? And not only connections, different object types too, even templates maybe, imagine a template class called container which can hold anything such as textures, models, integers, strings, settings under the form of strings that are shared between the menu state and game state such as what game save the player chose when in menu state, or the difficulty...

There are two questions that look like this one but neither of them answered my question:

Game states affecting each other's objects
Game state sharing data


texts: Circle to Circle Collision of moving Sprites

texts:
i needed help attaching circle1 Sprite to circle2 Sprite on collision onto the same point where they are getting collided, and both circles are moving with Action.
Like this,

Attaching means, when circle1 and circle2 sprites get collided, i am removing circle1 Sprite from scene and creating new sprite at that same position of circle1.

I have implemented following code for collision
....
float dx = circle1.x - circle2.x;
float dy = circle1.y - circle2.y;
float distance = Math.sqrt(dx * dx + dy * dy);

if (distance < circle1.radius + circle2.radius) {
    // collision detected
   // removing older sprite
   // creating of new sprite
}

Its working perfectly when one circle sprite in motion and another is static.

But when both are in motion, at some points ( collision point like bottom-left/ up-right of circle2 ) its get attached little over circle2 sprite and it happens at random times so i couldn't able to detect the error.

I want to attach new Sprite at exact point where collision occurred like this,

Anybody have done it before..


texts: Rotating an object in OpenGL about it's centre

texts:
Im writing a game for which, one of the models are loaded from an .obj file.

It's a model of a plane, and I want to rotate the propeller. The object file is broken into groups, and the propeller is identified, so that's all good.
I'm writing the game in C++ with OpenGl/GLFW
The drawing function is:

int win_width;
int win_height;
glfwGetWindowSize(&win_width, &win_height);
float win_aspect = (float)win_width / (float)win_height;
glViewport(0, 0, win_width, win_height);

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(90, win_aspect, 1, 100.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(0, 0, 30.0, 0, 0, 0, 0.0, 1.0, 0.0);

glEnable(GL_DEPTH);
glEnable(GL_DEPTH_TEST);
glEnable(GL_COLOR_MATERIAL);
glEnable(GL_NORMALIZE);
glEnable(GL_LIGHTING);
glEnable(GL_LIGHT0);
glEnable(GL_LIGHT1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glColor3f(0.0f, 0.0f, 0.0f);
int vertexIndex = 0, normalIndex;
glRotatef(90, 0, 1, 0);
glPushMatrix();
for(int a = 0; a < (int)groups.size(); a++)
{
    if(groups[a].type == "prop")
    {
//Code for rotation
        glPopMatrix();
        glPushMatrix();
        float x,y,z;
        x = y = z = 0;
        int Count = 0;
        for(int k = 0; k < groups[a].faces.size(); k++)
        {
            for(int p = 0; p < groups[a].faces[k].vertices.size(); p++)
            {
                int _index = groups[a].faces[k].vertices[p];
                y += vertices[_index].Dimensions[_y] ;
                z += vertices[_index].Dimensions[_z];
                Count++;
            }
        }
        z /= Count;
        y /= Count;
        glTranslatef(0, -y, -z);
        glRotatef(angle, 1, 0, 0);
        glTranslatef(0, y, z);
    }
    for(int b = 0; b < (int)groups[a].faces.size(); b++)
    {
        glBegin(GL_POLYGON);
        for(int c = 0; c < (int)groups[a].faces[b].vertices.size(); c++)
        {
            vertexIndex = groups[a].faces[b].vertices[c];
            glVertex3d(vertices[vertexIndex].Dimensions[_x], vertices[vertexIndex].Dimensions[_y], vertices[vertexIndex].Dimensions[_z]);
        }
        glEnd();
    }
}
glPopMatrix();
glfwSwapBuffers();

Since I don't know the exact centre of the propeller, that's what the for loop before the rotation is for. It finds the average of the y and z co-ordinates.

After I find it, I translate to -y,-z , rotate it, and then translate back. This makes the propeller spin as I want it to, but it also rotates along the origin >.<
http://people.sc.fsu.edu/~jburkardt/data/obj/cessna.obj <- This is the object file.

groups is a vector of objects and each object has a vector of faces. I'm sure that the vertices and faces are being loaded correctly, since the whole model renders correctly.


texts:
If I have one enemy that should chase the player, I can use a path-finding algorithm such as BFS to find the shortest path from the enemy to the player (taking into account obstacles along the way), and advance the enemy along the path.

But if there are two enemies, this is not necessarily the most efficient strategy. For example, if there is a large obstacle, instead of both enemies chasing the player from the east, it may be more efficient for tnem to cooperate, one of them should go chase the player from the east while the other blocks the player's escape route from the west.

My question is: what is an algorithm for efficiently coordinating the chase behavior of two enemies?


texts:
I've been working on a semi-professionnal project for more than one year.
The game is in 3D with a TopView camera.
In this game, the player will be in very vertical spaces, with lots of ladder and stairs.

The actual problem is that I need to show only what is at the actual height of the player.

I have made a shader that 'cut' the objects above a given height.

The problem is that my mesh are open above this height, and we just see nothing inside.

If you have any idea on how to make something to fill an open mesh or any other system that will do the job, i'll be very pleased to read you :)

This is what I have

This is what I aim to (black above top of walls)


texts: Unity3D + Kinect V2 | How to detect people when they are standing side to device

texts:
I can't detect people when they are standing/walking side to device.

I have used Miscrosoft's library for Unity3D to kinect and it works perfect when somebody stands direct front to Kinect device - the problem is my app should track people when they are walking side to device (Like - Kinect is standing in shop exhibition and people are walking on the street).

Kinect doesn't see anybody until that person turn (and show front of his body) to device.


texts:
I am developing an car game for android  with an UI steering wheel to control the car. I'm following Answer example for the wheel rotation. This is the code to rotate the wheel.

rectT.localEulerAngles = Vector3.back * wheelAngle;

This code working completely fine in unity and in the portrait mode of actual device.

But in the landscape modeof actual devices , the rotation get inverted.
Please help me to solve this problem.
Thank you


texts: How do I properly import an fbx 3D model into Unity3D?

texts:
I am trying to properly import a 3D model that was made for my game in Unity3D. I was able to import the model, and I put the texture on it, but there are several other files that go unused. I think I'm not importing the files properly, or I'm not using the files properly.

The files provided for me are as followed: (You can see these in this link as well)

Cheese.FBX
Cheese.obj
Cheese.png
Cheese_D.png (What does the "_D" indicate?)
Cheese_N.png (What does the "_N" indicate?)

Perhaps I am overthinking it, but i feel like I should be attaching cheese_d and cheese_n to the prefab I'm making somehow, but I don't understand their function. I am fairly new to 3D modeling, so I think I'm missing some conventions.


texts:
I have a simple fragment shader to simulate "falling water". I'm using Ogre3D and opengles2, this is my code:

#version 130

uniform sampler2D valveTex;
uniform sampler2D noiseTex;
uniform float time;

uniform vec3 sprayColor;

varying vec2 uv;
varying float rand;

    void main()
    {
        gl_FragColor.w = texture2D(valveTex, uv).w;
        float noiseW = texture2D(noiseTex, uv + vec2(rand, -time)).x;
        gl_FragColor.w *= noiseW + noiseW;
        gl_FragColor.xyz = sprayColor;
    }

The shader works well and I see the animation happening, but after some time running the animation stops like if the variable time stopped updating, and the water stream looks still. What can be causing this?

Edit1: variable time is derived from Ogre's time_0_1.


texts: I know about SDL_RenderSetScale, but I need also horizontal/vertical shift of the renderer's origin. At the moment, I manually modify positions of all screen objects with the shift. Is there a way to set this shift/offset globally?