texts: Is it possible that elements in the StreamingAssets folder are not read in build?

texts:
I'm making a 2D game. In my StreamingAssets folder I have a JSON file with some info about inventory items (id, description, rarity, name, is stackable or not) and a png file which contains a pixel map (128x32) of the level I want to load after a first scene (this is from Quill18's tutorial: https://www.youtube.com/watch?v=5RzziXSwSsg , basically a specific color corresponds to a specific prefab. An object reads through all the pixels and then spawns the level). The fact is that I have issues with both these elements when the game is built (everything works perfectly in the game window in Unity): the inventory items don't collide with the player and the level is not loaded.

This is the code that gets the image name

public string levelFileName;
string filePath = Application.dataPath + "/StreamingAssets/" + levelFileName;
byte[] bytes = System.IO.File.ReadAllBytes (filePath);
Texture2D levelMap = new Texture2D (2, 2);
levelMap.LoadImage (bytes);

And the pickable objects basically have a collision detection script and have a specific ID, so that when they collide with the player, the inventory adds in a free slot an image with the specs correspondant to that ID (i.e. ID=1 then it's an health potion, is stackable, it's not rare and so on). Everything else works fine in the game.
Do you think that the issue is linked to the StreamingAssets folder (first time using it) or is it just a coincidence? And also could you help me solve the problem?
Thank you in advance for any kind of help.

Edit: my Player logs:


texts: Help Understanding libgdx create animations example game

texts:
I am trying to understand the example game, cuboc. GitHub is https://github.com/libgdx/libgdx-demo-cuboc. I have generated my texture atlas but I do not understand the code that uses this texture atlas.  Here's the code (you can see on github too here:

package com.badlogic.cubocy;

import com.badlogic.gdx.Gdx;
import com.badlogic.gdx.graphics.FPSLogger;
import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.Animation;
import com.badlogic.gdx.graphics.g2d.SpriteBatch;
import com.badlogic.gdx.graphics.g2d.SpriteCache;
import com.badlogic.gdx.graphics.g2d.TextureRegion;
import com.badlogic.gdx.graphics.glutils.ImmediateModeRenderer20;
import com.badlogic.gdx.math.Vector3;

public class MapRenderer {
...
    private void createAnimations () {
        this.tile = new TextureRegion(new Texture(Gdx.files.internal("data/tile.png")), 0, 0, 20, 20);
        Texture bobTexture = new Texture(Gdx.files.internal("data/bob.png"));
        TextureRegion[] split = new TextureRegion(bobTexture).split(20, 20)[0];
        TextureRegion[] mirror = new TextureRegion(bobTexture).split(20, 20)[0];
        for (TextureRegion region : mirror)
            region.flip(true, false);
        spikes = split[5];
        bobRight = new Animation(0.1f, split[0], split[1]);
        bobLeft = new Animation(0.1f, mirror[0], mirror[1]);
        bobJumpRight = new Animation(0.1f, split[2], split[3]);
        bobJumpLeft = new Animation(0.1f, mirror[2], mirror[3]);
        bobIdleRight = new Animation(0.5f, split[0], split[4]);
        bobIdleLeft = new Animation(0.5f, mirror[0], mirror[4]);
        bobDead = new Animation(0.2f, split[0]);
        split = new TextureRegion(bobTexture).split(20, 20)[1];
        cube = split[0];
        cubeFixed = new Animation(1, split[1], split[2], split[3], split[4], split[5]);
        split = new TextureRegion(bobTexture).split(20, 20)[2];
        cubeControlled = split[0];
        spawn = new Animation(0.1f, split[4], split[3], split[2], split[1]);
        dying = new Animation(0.1f, split[1], split[2], split[3], split[4]);
        dispenser = split[5];
        split = new TextureRegion(bobTexture).split(20, 20)[3];
        rocket = new Animation(0.1f, split[0], split[1], split[2], split[3]);
        rocketPad = split[4];
        split = new TextureRegion(bobTexture).split(20, 20)[4];
        rocketExplosion = new Animation(0.1f, split[0], split[1], split[2], split[3], split[4], split[4]);
        split = new TextureRegion(bobTexture).split(20, 20)[5];
        endDoor = split[2];
        movingSpikes = split[0];
        laser = split[1];
    }

What I do not understand is what is split used for? Like, what is going on here:

split = new TextureRegion(bobTexture).split(20, 20)[1];

And sometimes it looks like split is a method that takes two int's, 20 and 20? Why 20?
Othertimes split is used as an Array like in ...

rocketExplosion = new Animation(0.1f, split[0], split[1], split[2], split[3], split[4], split[4]);

... and I just can't follow what's going on here.  Thanks!


texts: Imposters in Unity - How to set which color is used as 'transparent' in the RenderTexture?

texts:
I'm still working at making imposters for my Unity scenes. Here I am attempting to make a large block of stadium seating, using the one seat mesh as shown.
I'll try to explain in full what Ive done so far:

Imported 3d mesh of seat
Created RenderTexture 'seat' (default format R8G8B8A8_UNORM)
Added new Orthographic camera in front of seat. (settings: Clear Flags=Solid Color; TargetTexture='seat'
Created some quads and aligned them so I can see the textured side.
Gave the quads a new material 'seat'.

I've gone through many of the settings in the Material and other places changed many things here and there such as 'transparent' or 'cutout' and lots of the other settings but cannot get rid of the magenta color in the seating textures I created.
Also tried making that color alpha 0 but it had no effect. And tried various colors as transparent (magenta, white, black).
Am I doing this completely wrong? Hopefully I am just missing some small setting. Ideally somewhere I can just set the magenta color to mean transparent pixels.
Really do need help here honestly have been trying very hard to achieve this alone but not getting anywhere fast.


texts: Cubemaps turn black OpenGL GLSL Java LWJGL

texts:
Recently I tried to add cubemaps to my 3D-rendering engine. The objects with a cubemap now turn completely black.
This is how I load my cubemap:

public static int loadCubeMap(String filename)
{
    int id = GL11.glGenTextures();

    GL13.glActiveTexture(GL13.GL_TEXTURE0);
    GL11.glBindTexture(GL13.GL_TEXTURE_CUBE_MAP, id);

    for(int i = 0; i < CUBEMAP_NAMES.length; i++)
    {
        TextureData data = decodeTextureFile(CUBEMAPS_LOCATION + filename + "/" + CUBEMAP_NAMES[i]);
        GL11.glTexImage2D(GL13.GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, GL11.GL_RGBA, data.getWidth(), data.getHeight(), 0, GL11.GL_RGBA, GL11.GL_UNSIGNED_BYTE, data.getBuffer());
    }
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MAG_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_MIN_FILTER, GL11.GL_LINEAR);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_S, GL12.GL_CLAMP_TO_EDGE);
    GL11.glTexParameteri(GL13.GL_TEXTURE_CUBE_MAP, GL11.GL_TEXTURE_WRAP_T, GL12.GL_CLAMP_TO_EDGE);
    return id;
}

TextureData class only contains: int width, height and a ByteBuffer buffer

private static TextureData decodeTextureFile(String fileName)
{
    int width = 0;
    int height = 0;
    ByteBuffer buffer = null;
    try
    {
        FileInputStream in = new FileInputStream(TEXTURES_LOCATION + fileName + ".png");
        PNGDecoder decoder = new PNGDecoder(in);
        width = decoder.getWidth();
        height = decoder.getHeight();
        buffer = ByteBuffer.allocateDirect(4 * width * height);
        decoder.decode(buffer, width * 4, Format.RGBA);
        buffer.flip();
        in.close();
    } catch (Exception e)
    {
        e.printStackTrace();
    }
    return new TextureData(width, height, buffer);
}

This is how I load the cubemap to the samplerCube cubemap[i] in the fragment shader:

public void loadCubeMap(int id, CubeMap cubemap, int cubemapid)
{
    if(cubemap != null)
    {
        super.loadTexture(location_cubemaps[cubemapid], cubemap.id, id, GL13.GL_TEXTURE_CUBE_MAP);
        super.loadFloat(location_cubemap_intensity[id], cubemap.intensity);
    }else
    {
        super.loadFloat(location_cubemap_intensity[id], 0.0f);
    }
}

in super class:

protected void loadTexture(int location, int texture, int i, int texturetype)
{
    loadInt(location, i+1);
    GL13.glActiveTexture(GL13.GL_TEXTURE0 + i);
    GL11.glBindTexture(texturetype, texture);
}

And this is my fragment shader:

#version 400 core

  in vec4 color;
  in vec2 texCoord0;
  in vec3 surface_normal;
  in vec3 to_light_vector;
  in vec3 world_position_out;
  out vec4 out_Color;

  uniform sampler2D sampler0;

  uniform samplerCube cubemap[3];

  uniform vec3 lightColor;

  uniform float cubemap_intensity[3];

  uniform int hasTexture;

  void main(void)
   {
      vec3 unitNormal = normalize(surface_normal);
   vec3 unitLight  = normalize(to_light_vector);

   float nDot1 = dot(unitNormal, unitLight);
   float brightness = max(nDot1, 0.02);

   vec3 diffuse = color.xyz * brightness * lightColor * color.xyz;
   vec4 textureColor = texture(sampler0, texCoord0.xy);
   if(textureColor.a < 0.5)
       discard;
   vec4 shadedTextureColor = brightness * vec4(lightColor, 1) * textureColor;
    vec4 coloredShadedTexture = mix(vec4(diffuse, 1), shadedTextureColor, textureColor.a * hasTexture);

   vec4 reflectionColor = texture(cubemap[0], world_position_out);
   vec4 refractionColor;
   vec4 cubemapColor;

   out_Color = reflectionColor;
  }


texts: Terrain Generation - Diamond Square Algorithm

texts:
I'm trying to implement a Map Generator in Java. Since it´s said to be simple I wanted to use the Diamond Square Algorithm [2D] for that purpose.

However, I can´t find any complete understandable description of the algorithm, so I am using ~4 different sites (eg. this one from grubz) to build it, and on some sites things are described differently than on others.

As far as I understand it, the algorithm works as follows:

generate a map with random values (just setting every x,y of the map)
make square step
make diamond step
begin with square again

The map size is defined by a "step". That step will be

step =Math.pow(2,step)+1

which denotes the width and height of the map. This means if I want a map with ~300 tiles I will have to provide step = 9 - but on other sites it´s written that the step is only changing the "smoothness". What is it?

-square step
I begin at halfStep (x/y), take the surrounding "square" Points and average those.

-diamond step: Same as above but I begin halfStep earlier.

Here is what I did so far. Not working due to an ArrayError.

Question:

How do I control how big the map is gonna be? (I assume step?).

How do I control here what the output map looks like? eg.: to generate island/continents/deserts/half-islands/ how would I get one big Continent at the center/thick jungles etc. (I have seen something like scale, scaleMod, etc)

Is my Code correct according to the algorithm? I just don´t get it exactly.


texts:
I am about to launch a Kickstarter project as, after 14 months of full time development on my first iOS game, I run out of money. I developed an iOS game that needs few more months to be ready (the game structure is there but haven't yet worked on balancing the difficulty of the various levels).

I have a feeling that most of the computer games founded on Kickstarter are for console, PC or Mac and not for smartphones. The category that many people seem to like is RPG style games.

I have done tons of work over a year and collaborated with musicians and illustrators to get top quality graphics and music. The game looks cool to be an iOS 2D game but, compared to what I've seen on Kickstarter, I feel so little and humbled.

I have searched for smartphone game projects on Kickstarter but haven't found many. I believe that the reason is that people are not keen in backing an APP that is normally sold for 0.99$ as they perceive is not something big. Am I the only one having this feeling?

Could anyone please share a list of references to some successfully backed kickstarter smartphone game projects? (In this way the question will not become a "chat" and will fulfill the requirements to be a gamedev question).

Any other article or authoritative answer will be welcome.


texts: Unity standaolne Exe crashes dxgi.pdn not loaded?

texts:
I couldn't find this exact issue so I apologize if I missed it and created a duplicate question. The only possibilities I could find said that it might be Unity or a DLL.

I'm using Unity 2018.2.21f1 and Visual Studio 2017.

I'm trying to create a desktop duplication app and I've managed to get it to run perfectly in the Unity editor as seen below. It's a bare-bones project at the moment with nothing but a couple of C# scripts, a shader, an Empty object, 2D texture, and a DesktopCapture.dll.

However when I build it as a standalone application, it will run just fine for a moment, but then freeze and crash.

I ran it through Visual Studio during the crash to at least see what it says.

Afterward, when using the Task Manager to manually kill the application, it was still running in the background and I had to fully shutdown and restart my computer just so my system would properly function without having various GUI issues regardless of whatever software I had open. As in, it took a bit to actually get the screenshots because my system wasn't fully responding as it should have.

Below is an image showing the error of "Unhandled exception at 0x00007FF9FD8E1C8E (dxgi.dll) in VR Desktop Mirror.exe 0xC0000005: Access violation reading location 0x0000000000000000."

This is a first for me so I am genuinely clueless. Any help is greatly appreciated and thank you in advance.


texts: Creating a letterbox screen for Android devices

texts:
I want that the screen looks the same on every Android device without distorting the sprites.

One player should not see more of the map than another player just because they have a bigger screen or different resolution on their device.

I use (1334, 750) as my virtual resolution and only landscape mode is supported. But at the moment, you can see more of the map on top and on the bottom if you have a device with different aspect ratio.

How would I create a letterbox on top and on the bottom so that the visible game window keeps the same aspect ratio and portion of the game world visible on every device?

Do I need to modify my 2D camera when I create a letterbox screen?

At the moment it looks like this:

But it should look like this so that everyone can see the same map on the screen:

 public class Game1 : Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;
        Camera camera;
        Vector2 vp, gameWorldSize = new Vector2(1334, 750);
        float ScaleX, ScaleY, Scale;
        Vector2 Newcameraposition;
        Texture2D Background;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            graphics.IsFullScreen = true;
            graphics.SupportedOrientations = DisplayOrientation.LandscapeLeft | DisplayOrientation.LandscapeRight;
        }

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

        protected override void LoadContent()
        {
            spriteBatch = new SpriteBatch(GraphicsDevice);
            Background = Content.Load<Texture2D>("background");
            vp = new Vector2(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
            ScaleX = vp.X / gameWorldSize.X;
            ScaleY = vp.Y / gameWorldSize.Y;
            Scale = Math.Min(ScaleX, ScaleY);
            camera = new Camera(new Vector2(gameWorldSize.X / 2, gameWorldSize.Y / 2), Scale, vp);
        }

        protected override void Update(GameTime gameTime)
        {
            Newcameraposition = new Vector2(gameWorldSize.X / 2, gameWorldSize.Y / 2);
            camera.Update(gameTime, Newcameraposition, Scale, vp);

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.CornflowerBlue);

            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.AlphaBlend, null, null, null, null, camera.GetMatrix());
            spriteBatch.Draw(Background, new Rectangle((int)gameWorldSize.X / 2, (int)gameWorldSize.Y / 2, Background.Width, Background.Height), null, Color.White, 0, new Vector2(Background.Width / 2, Background.Height / 2), SpriteEffects.None, 0.0f);
            spriteBatch.End();

            base.Draw(gameTime);
        }
    }

My 2D camera:

 public class Camera
    {
        public Vector2 PlayerPosition;
        private Vector2 Viewport;
        private float Scale;

        public Camera(Vector2 playerposition, float scale, Vector2 viewport)
        {
            PlayerPosition = playerposition;
            Scale = scale;
            Viewport = viewport;
        }

        public void Update(GameTime gameTime, Vector2 playerposition, float scale, Vector2 viewport)
        {
            PlayerPosition = playerposition;
            Scale = scale;
            Viewport = viewport;
        }

        public Matrix GetMatrix()
        {
            return Matrix.CreateTranslation(new Vector3(-PlayerPosition.X, -PlayerPosition.Y, 0))
         * Matrix.CreateScale(Scale, Scale, 1)
         * Matrix.CreateTranslation(Viewport.X / 2, Viewport.Y / 2, 0);
        }
    }


texts:
I am attempting to have animated dialog text for my libGDX game. I found a useful resource on github called Typing Label and i am having some troubled getting it working. Could someone help me with this. Also in the examples it says stage.add and i dont have a stage object declared. what type of object should that be.

 TypingLabel label = new TypingLabel("Hello world!", skin);


texts:
I have two surfaces. One is the back-buffer, the other is a surface with some user-interface overlay graphics already rendered onto it. Both surfaces have identical properties (size, format...etc).

I want to copy one surface onto the other and create the UI overlay.

Is this possible to do?


texts: Why doesn't this movement script work, while the other one does?

texts:
Im trying to get a rigidbody2D to move around and got it working with this script:
public class RubyController : MonoBehaviour
{
public Rigidbody2D rigidbody2d;
public float speed = 5.0f;
Vector2 movement;

void Start()
{
    rigidbody2d = GetComponent<Rigidbody2D>();
}

void Update()
{
    movement.x = Input.GetAxis("Horizontal");
    movement.y = Input.GetAxis("Vertical");
}

private void FixedUpdate()
{
    rigidbody2d.MovePosition(rigidbody2d.position + movement * speed * Time.deltaTime);
}

but not with this, and I can't understand why:
public class RubyController : MonoBehaviour
{
public Rigidbody2D rb2d;
float horizontal;
float vertical;
public float speed = 5f;

private void Start()
{
    rb2d = GetComponent<Rigidbody2D>();
}

private void Update()
{
    horizontal = Input.GetAxis("Horizontal");
    vertical = Input.GetAxis("Vertical");
}

private void FixedUpdate()
{
    Vector2 position = this.rb2d.position;
    position.x = position.x * speed * horizontal * Time.deltaTime;
    position.y = position.y * speed * vertical * Time.deltaTime;

    rb2d.MovePosition(position);
}
}


texts: How to procedurally create an extruded cube mesh's indicies?

texts:
I'm working on a tool that allows the user to create rails(basically an extruded cube) by placing 3d points where the  vertices of rail would be.
The picture below shows what I'm talking about. The orange points being  the user placed points and the black points being the vertices created around it.

I can create the vertices just fine the problem comes from creating the indices for the rail.

I tried using a for loop that goes through the user place points and creating  the triangle indices by using i as an offset for each indices, but it using vertices that didn't exist for indices.
Here's the code for the vertex and indices creation.

    List<Vector3> vertices = new List<Vector3>();
    List<int> triangles = new List<int>();
    for (int i = 0; i < points.Count - 1; i++)
    {
        Vector3 forward = -(points[i] - points[i + 1]).normalized;
        Quaternion rotation = Quaternion.LookRotation(forward);

        //bottom left
        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (-transform.up - transform.right)));
        //top left
        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (transform.up - transform.right)));
        //top right
        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (transform.up + transform.right)));
        //bottom right

        vertices.Add(transform.InverseTransformPoint(points[i] + rotation * (-transform.up + transform.right)));
    }

    for(int i=0; i<points.Count-1; i++){
        //left face
        triangles.Add((i*4)+4);
        triangles.Add((i*4)+1);
        triangles.Add((i*4));

        triangles.Add((i*4)+1);
        triangles.Add((i*4)+4);
        triangles.Add((i*4)+5);

        //top face
        triangles.Add((i*4)+5);
        triangles.Add((i*4)+2);
        triangles.Add((i*4)+1);

        triangles.Add((i*4)+2);
        triangles.Add((i*4)+5);
        triangles.Add((i*4)+6);

        //right face
        triangles.Add((i*4)+2);
        triangles.Add((i*4)+6);
        triangles.Add((i*4)+7);

        triangles.Add((i*4)+7);
        triangles.Add((i*4)+3);
        triangles.Add((i*4)+2);

        //bottom face
        triangles.Add((i*4)+0);
        triangles.Add((i*4)+3);
        triangles.Add((i*4)+4);

        triangles.Add((i*4)+4);
        triangles.Add((i*4)+3);
        triangles.Add((i*4)+7);

    }


texts: Issue with creating a view in a tilemap environment (SFML)


texts: Can't edit specific variables from the inspector panel, while variable is static

texts:
In order to make the variable accessible from other classes, I have to make it static.

When I make it static, I can't edit it from the Unity's Inspector panel.

No way to be able to do both: accessible and editable from the panel?

EDIT:

This is the code so far (by following Savlon's idea)

BouncingBall.js

#pragma strict

public static BouncingBall instance;
public var velocityX : float = 1;
public var velocityZ : float = -1;

function Awake(){
    instance = this;
}

function Update () {

    transform.Translate(new Vector3(velocityX, 0, velocityZ) * Time.deltaTime);

    if (this.transform.position.x > 4.5){
        velocityX = -velocityX;
        this.transform.position.x = 4.49;
    }
    if (this.transform.position.x < -4.5){
        velocityX = -velocityX;
        this.transform.position.x = -4.49;
    }
    if (this.transform.position.z > 4.5){
        velocityZ = -velocityZ;
        this.transform.position.z = 4.49;
    }
    if (this.transform.position.z < -4.5){
        velocityZ = -velocityZ;
        this.transform.position.z= -4.49;
    }
}

function OnCollisionEnter(col : Collision){
    if(col.gameObject.name == "PlayerPad"){
        velocityZ = -velocityZ;
    }
}

brick.js (where I call the variable from)

#pragma strict

function OnCollisionEnter(col : Collision){

    if(col.gameObject.name == "Ball"){
        BouncingBall.instance.velocityZ = -BouncingBall.instance.velocityZ;
        Destroy(this.gameObject);
    }
}


texts: UNIT_SPELLCAST_START event, spell names, localization issues?

texts:
I have created a small addon for myself, SheepWhisperer which listens for me casting Polymorph on my mage or Shackle Undead on my priest.

When it detects this, and I'm in a party, it will check if I'm targetting a mob that one of the other party members are also targetting. If so then it will send them a whisper telling them about my incoming spell.

So far the addon works for me, but I'd like to publish this addon for others to use.

The event gets called with the spell names, not the spell id's, which means that my code currently looks for the following two spells by their names:

Polymorph
Shackle Undead

The question is this: If someone is running the German client (or any of the other clients, other than the English one), will they get different names or will this event still be called with "Polymorph"?

I have checked Wowhead: Polymorph but it doesn't tell me the German (as an example) name for that spell. Perhaps there is none? Perhaps all the clients use Polymorph so this is a non-starter?


texts: C# Minesweeper - When cells with no mines nearby gets clicked

texts:
I'm currently making a Minesweeper in C#. I've already done the basics (generating minefield, rules and ui) but I don't know how I should implement when the user clicks a cell and the cell has no mines nearby and clicks nearby cells with also no mines nearby, like this:

And after click

This is my current code on this:

if (MineField(x,y) == false) // If the clicked cell isn't a mine
{
    if (GetNeighbours(x,y) == 0) // GetNeighbours returns the amount of mines in the closest 8 cells
    {
        // To be honest, no idea...
    }
}


texts: How do I perform an Iris Wipe transition, using C++ in SDL 2.0?

texts:
How do I perform image masking/clipping using an arbitrary shape like a circle?

I want to do an Iris Wipe transition, similar to in the movies. By Iris transition, I mean the circle transition effect where it starts with a small circle, and zoomed in to reveal the scene.

How do I accomplish it in SDL 2.0 with C++?


texts: 2D XNA Tile Based Lighting. Ideas and Methods

texts:
I am currently working on developing a 2D tile based game, similar to the game 'Terraria'. We have the base tile and chunk engine working and are now looking to implement lighting. Instead of the tile based lighting that terraria uses, I want to implement point lights for torches, etc.

I have seen Catalin Zima’s shader based shadows, and this would be perfect for the torches (point lights). My problem here is that the tiles on the surface of the world need to be illuminated, doing this by a big point light is firstly extremely expensive, but also doesn't look right.

What I need help with (overall) is...

To have a surface that is illuminated regardless of torches, etc.
To also have point lights, or smooth tile lighting similar to Catalin Zima’s shader based shadows.

Looking forward to your replies. Any ideas are appreciated.


texts:
I've been struggling with Cocos2d-x (C++) and finally I got to the point I feel more or less comfortable with that.

My game is a 2D car-based one, with a straight infinite map where I've finally been able to add some random obstacles. There are only 3 positions the car can be at, and everything is working fine.

The point is that I've recently noticed that it is not responsive, and tried to make it responsive by adding a line like these one to the AppDelegate.cpp:

glview->setDesignResolutionSize(1024.0, 600.0, kResolutionFixedWidth);

I've tried to use kResolutionFixedWidth, kResolutionFixedHeight and all others 5 variables you can put there, but I only got black lines along the screen and every single screen breakdown you can imagine -.-'

I can figure out I need to resize my TMXTiledMap manually because of the nature of tiles (I did it with Tiled), but I don't know how to face this problem.

Note that I'm currently developing for a 1024x600 Android device but I would want to support at least the most common resolutions for both tablets and smartphones.

Thanks in advance to anyone who can help me in some way.


texts:
I'm developing a sort of ’social mmmo’ where people build an avatar and chat with people around them, carryout tasks together, and play team games.

At the moment I have a product I want to release to beta testers but I only have 2 locations ready and they are quite far apart.

I have a fast travel system in place where people can pay to ride the bus making any journey take a short period of time.

If people run out of money they either have to earn more or make the walk themselves.

In the beta would it be better to make the bus free, or have people walk the empty land to get to the other town if they run out of money?

At the moment the land is just plain grass, hills, a river, and the odd tree with nothing of interest.

The journey currently takes around 10-15 minutes to walk if you know the way.


texts:
In XNA 3.1 is there any other way to disable depth in 3D Worlds using DirectX models other than

GraphicsDevice.RenderState.DepthBufferEnable = false;

?

The reason for my question is I have quite a huge program which offers a 3D World with a couple of 3D DirectX models inside. Depth was never an issue since it ever worked fine but since a few days after doing some modifications my models are all depth-translucent i.e. depth-buffering and/or culling seems to be disabled.

But in my whole source code I never touch any of the options related to Depth or Culling which means I never turn these settings on explicitly nor turn it off somewhere.

So I am searching for some other statement maybe related to the GraphicsDevice that implicitly turns depth off - but I can't find it.

(Sorry that I don't post any source code but I have too much source code and I simply don't know where to search)

UPDATE:

These are a couple of simple objects seen with correct depth.

These are the same objects in their current state.


texts:
I have a class which "collects" line mesh transformations throughout the update and then draws them in one place by drawing one line over and over again. I'll post the code below. I'm just wondering if this is instanced or if the idea is to join them all into one mega-mesh and send that through?

Or if I'm missing some key-part altogether....

void BatchLineRenderer::RenderLines(D3DXMATRIX matView, D3DXMATRIX matProjection)
{
    device->IASetInputLayout(pVertexLayout);

    device->IASetPrimitiveTopology(D3D10_PRIMITIVE_TOPOLOGY_LINESTRIP);

    // select which vertex buffer and index buffer to display
    UINT stride = sizeof(LINE);
    UINT offset = 0;
    device->IASetVertexBuffers(0, 1, &pBuffer, &stride, &offset);
    device->IASetIndexBuffer(iBuffer, DXGI_FORMAT_R32_UINT, 0);

    std::vector<LINE>::size_type allLines = permanentLines.size();

    for(int i = 0; i < allLines; i++)
    {
        pColour->SetFloatVector(permanentLines[i].colour); // in the line loop too?

        // combine the matrices and render
        D3DXMATRIX matFinal =
        permanentLines[i].scale     *
        permanentLines[i].rotation  *
        permanentLines[i].position  *
        matView * matProjection;

        pTransform->SetMatrix(&matFinal._11);
        pRotation->SetMatrix(&permanentLines[i].rotation._11);    // set the rotation matrix in the effect

        pPass->Apply(0);

        device->DrawIndexed(2, 0, 0);
    }

    allLines = temporaryLines.size();

    for(int i = 0; i < allLines; i++)
    {
        pColour->SetFloatVector(temporaryLines[i].colour); // in the line loop too?

        // combine the matrices and render
        D3DXMATRIX matFinal =
        temporaryLines[i].scale *
        temporaryLines[i].rotation *
        temporaryLines[i].position *
        matView * matProjection;

        pTransform->SetMatrix(&matFinal._11);
        pRotation->SetMatrix(&temporaryLines[i].rotation._11);    // set the rotation matrix in the effect

        pPass->Apply(0);

        device->DrawIndexed(2, 0, 0);
    }

    temporaryLines.clear();
}


texts: How much logic should be in an individual behaviour tree node?

texts:
Let's say I have a condition node which has to spend a lot of time calculating something to finally return a bool to the behavior tree.
But in the following action, we need this information again.
I now have a few options:

I could just calculate the information again. That could unnecessarily take a lot of time and may result in redundant code.
I could save the information into some kind of state data dictionary but now the action depends on calling the condition first.
I could make it a single action that would just fail if the resulting calculation would end up being False. I would possibly end up with a bunch of very similar, very complex actions. Again possibly a lot of unnecessary redundancy.

How do I tackle something like that?
Is there a pattern that I could apply to the action/condition design (or whatever) or inside the behavior tree implementation that solves this?
Or am I using behavior trees wrong entirely?


texts:
I'm building a top-down strategy 2D game, and i'm stuck animating clouds that will float above the arena, hiding other elements. The effect i want to achieve is something exactly like this:

How would i go about implementing it in Unity3D?


texts: Why are my objects becoming permanently stuck to walls using Box2D?

texts:
I setup a simple simulation environment something like billiards. There are four circle balls (dynamic) and four box walls (static).

Simulation works... except one thing. Sometimes when a ball rest against a wall, it sticks to the wall eternally. The other balls hits the stuck ball so many times, but the ball never wants to separated with the wall. The only situation where the ball will become unstuck from the wall is another if another ball is rests against the same wall such that it hits the already-stuck ball.

Why does this situation occur? How can I avoid it?


texts: Should I put a soundtrack behind my strategy game? Which games need music and sound

texts: Shuffling cards and impact noises are cool (it is a card based game), but should I invest the time/effort in hooking up background music?  I have found Play Audio from Stream Using C# which could be used to allow hooking to DI if online or similar code could be used to play local MP3s, but is it worth the effort?  Which game generes need it and which can do without?  Release it without it and add it as a .5 feature?


texts: Most efficient implementation for a Sokoban board?

texts:
I am making a Sokoban solver in C++ and I was wondering what would be the most efficient implementation for the board, as to say the least memory consuming possible and the quickest operations possible.

I have heard about bit boards but I'm not sure it would be better than a classic 2D array. This is what a Sokoban grid look like :

The player is the greend sqaure, walls are red and static, boxes are blue and goals are the empty blue squares.

EDIT : The purpose is too be as efficient as possible when creating/storing the tree of possibilites for a sokoban level.

EDIT 2 : What I am looking to store is sokoban boards, as to say a grid that has multiple elements : one player, multiple static walls, moveable boxes, static goals (cell to put the box in). I run out of RAM - I have 8Go - on reasonable size levels (+50 moves). The sequence of moves the player has made is also stored with basic integers, like 1 for up, 2 for right etc.


texts: How do I get AI Agents to move along a curve?

texts:
Currently my very basic AI framework has agents that move along a a jagged path made up of a series of points.

They do this by simply moving their position from one point to the next. When they reach the next point they move towards the next and so on. How can I change this so that they move smoothly along a curved version of the path, and how do I generate the curve?


texts:
I have the following spritesheet for types of terrain, with a transparent background.

To draw it on my map, I thought of doing one mesh per type, and then combine them. This is the code.

This gave me at first quite good results.

But then I started trying maps of bigger dimensions, and after a certain point (I think it was 49x49), I got suddenly different results.

As you can see, at this point only seems to render 2 kinds of terrain, and the others have disappeared completely. Size is the only factor that was changed. Materials, Sprites, settings... everything else is completely the same.

Why could this be happening?


texts:
From what I've read, with a simple directional light, the color of a point, if you only take diffuse reflection into account (intensity = 1), should be

color = color_of_point * color_of_light * dot(normal, -light_direction);

However, this is confusing for me. For example, if the light direction is parallel to the normal, and if the color of the point is pure red (1,0,0) and the color of the light is pure blue (0,0,1) I'd expect the point to have a color of violet - yet the result will be black.

Similarly, if I have a completely white point, or a completely black point, I wouldn't intuitively assume that the result is completely white (regardless of light color) or completely black either.

I guess I'm fundamentally misunderstanding something here. Can someone explain?


texts: Why does unity give me an error : NullRefreceException Object refrence not set to an instance of an object, Not duplicate, Read last line in question

texts:
I was making a simple car parking game, the situation is as follows :

Script oncollision :
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class oncollision : MonoBehaviour
{
   public int pscene;
   public Rigidbody rb;
   public string ascene;

   // Start is called before the first frame update
   void Start()
   {
       gettingscene();
       Debug.Log(ascene);
   }

   // Update is called once per frame
   void Update()
   {
       if(rb.position.y < -0.75f)
       {
           rb.transform.position = new Vector3(-1, 0.5f, -9);
       }
   }

    void OnCollisionEnter(Collision collision)
   {
      if(collision.collider.tag == "obstacle")
       {
           Debug.Log("will this work?");
           SceneManager.LoadSceneAsync("GameLost");
           SceneManager.LoadScene("GameLost");
       }
   }
   public void gettingscene()
   {
      ascene = SceneManager.GetActiveScene().name;
   }
}

script tryagain :
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;

public class tryagain : MonoBehaviour
{

    // Start is called before the first frame update
    void Start()
    {
        FindObjectOfType<oncollision>();
    }

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

    }

    public void tryagainlol()
    {
        SceneManager.LoadScene(FindObjectOfType<oncollision>().ascene);
    }
}

As you can see, I made a string in the script oncollision named as ascene, and I stored the active scene name and made the string public. In the function OnCollisionEnter, I loaded the GameLost scene. In that scene I made 3 buttons, namely "try again", "Quit" and "Main menu". I still need to make the main menu, o don't focus on that. I made a script known as tryagain, which I added to the button "Try again". On the script I made a function named "tryagainlol" and I called the ascene string to load the previous scene, but when I test it in game, I get this error. Could anyone explain why do I get this, and how do I resolve it?
My complete error says :-
NullReferenceException: Object reference not set to an instance of an object
                           tryagain.tryagainlol () (at Assets/tryagain.cs:23)

Any help would be appreciated, thanks in advance
Also, I found a similar question here, but I was unable to apply and understand it in my situation.


texts: Android Canvas 2D Game: Supporting multiple screen sizes/resolutions

texts:
I'm planning to develop a 2D game for android devices by using simple Canvas Surfaces (I know that OpenGL might be more efficient - but Canvas should definitely be enough for my type of game).

I'm currently researching on how I should handle different screen sizes/resolutions/ratios of the different android devices. I don't think it's a big deal to scale a bitmap if the screen size is just 920x512 instead of 1920x1024 (for example) - but what about completely different ratios? Like 1200x800px screens? I would have to stretch these bitmaps, or just make more objects visible from my game, which would normally be hidden in shorter screens.

I didn't really find anything useful on my research (mainly some discussions about Canvas VS OpenGL...) - so I'm giving it a try here.
What's the best/most common used technique to adjust a game to different screen sizes? Other than just putting black borders along my game, if the width/height is too large.


texts:
I have a simple Blender-Model (just a few faces). I want to add 2 Textures. (a special face should get Texture 1, the other faces Texture 2). This model I want to use in XNA.

The first Texture should be replaceable at Runtime by Code (the new image is generated based on user input).

So how do I best solve this: Using UV-Maps or Normal-based Maps in Blender? How can I access the Blender UV-Mapping in XNA? Or do I completely perform the Texturing in XNA (using Code or shaders)? And how (I´m new to this)?


texts: Depth of overlap between circle and rectangle

texts:
I have a circle and a rectangle one of the two objects is moving the other is static. How can I prevent them from overlapping each other? For now there is only one thing that I don't know how to calculate - the depth between the two objects. Could you tell me how to do that? I am using monogame

public void CircleVsRectangle(CircleBody circle, RectangleBody rect)
{
  float circleDistanceX = Math.Abs(circle.CenterX - rect.CenterX);
  float circleDistanceY = Math.Abs(circle.CenterY - rect.CenterY);

  Vector2 circleDistance = new Vector2(circleDistanceX, circleDistanceY);

  if (circleDistance.X > (rect.Width / 2 + circle.Radius)) { return false; }
  if (circleDistance.Y > (rect.Height / 2 + circle.Radius)) { return false; }

  if (circleDistance.X <= (rect.Width / 2)) { return true; }
  if (circleDistance.Y <= (rect.Height / 2)) { return true; }

  float cornerDistance_sq = ((circleDistance.X - rect.Width / 2) * (circleDistance.X - rect.Width / 2)) + ((circleDistance.Y - rect.Height / 2) * (circleDistance.Y - rect.Height / 2));

  if( (cornerDistance_sq <= (circle.Radius * circle.Radius)))
  {
  float dept = CalcDept() // ??????
  if(circle.IsMoving) circle.position += dept;
  else if(rectangle.IsMoving) rect.position += dept;
  }
}


texts:
I'm having problems with quitting a Pygame application (6502 based computer emulator).

The part regarding exit looks like this:

while True:
  do_something_200_times()

  for event in pygame.event.get()
    if event.type == pygame.QUIT:
      pygame.quit()
      sys.exit()

I'm also using pygame.mixer to play sounds as they appear, but I'm not sure that's related. I'm also using pygame.time.set_timer to update screen in regular intervals and play sound if buffer has filled enough. Is it possible the event queue overfills? How would I determine if this is the case?

It simply freezes in 40-50% cases, and attaching strace -p to the python interpreter gives:

Process 21326 attached
futex(0x7f5a32f839d0, FUTEX_WAIT, 21329, NULL

Also, I'm getting occasional pulseaudio related crashes, is this combination known to be buggy?

Any ideas and suggestions are more than welcome! Thanks!

EDIT: it freezes when I click the window's close button (x)


texts:
So I've been scouring the interwebs for a couple of days with regards to how to implement sprite masking in XNA 4 and C#. Coming from a pet project I did in Flash, this was pretty easy as masks are part of the AS3 library, so implementing one was as simple as giving it a shape, size, and moving the X and Y co-ordinates of the mask to follow my character sprite.

Now I'm looking to do something similar in XNA. Think the Flash move in Pokemon lighting up caves, or, a better contextual example, the torch light effect in Terraria (alas, I can't find suitable pictures, but hopefully the gist is there).

So, essentially, I want to surround my sprite character with a circle - anything within that circle on the map is visible, and everything outside the circle is black.

The ways I've seen people similarly implement masks is via the StencilBuffer, Pixel Shading and via sprite overlay (You have a sprite of your "viewable area", you draw that on top of your player sprite and fill the rest of the viewport with black). Considering the latter two don't really have many directly applicable example projects that I can learn from on the internet (The one applicable StencilBuffer example I found is for WP7 dev, and no Pixel Shader stuff directly solves my problem), I've been leaning more towards the third idea of having a "viewpoint restriction" sprite that you place on top of the character sprite, then fill the rest of the map with black.

Is it possible to do this? And if so, could someone please help and link me to something relevant/give me some sample code/pseudo-code to work from. Again, I don't know if even this is the most effective way or if it's just easier to implement a proper mask with a Pixel Shader or StencilBuffer, but I have no idea how to go about that.

What do you guys think the best solution here would be?


texts: Implementing mirrored coloured glass VFX like in Ant Man

texts:
This might seem like a strange question but I've been wanting to implement VFX in one of my games similar to what we see in the first Ant Man movie. Specifically only this:

Link to the gif above

What do you call a VFX/Object like this? Is there a term for this?
I'm assuming this is a job for a 3D artist. If so what is the best approach to building this? We are of course looking for a lower level of detail than the movie.


texts:
Im having problems with area light and spotlight. When adjusting parameters the change is not consistent and sometimes the light grows tstronger and then dissapears and then reappears very strong, when increasong the strength.

Also i have a spotlight that only affects the 3d meshes that is the environemnt but not the ground, which is textured plane.

Wehn playing the game some area lights switch on or off depending on what angle and distance from it i am at the moment. Are the lights supposed to be able to be used dynamically ?

Im using the free version of Unity. Could this be affecting?


texts:
I was thinking about creating a snake game with C#, so I ran ideas in my head, and some problems came up.

How can I track and output in the correct location the blocks that run after the snake's head?

If the snake is built of five blocks, and the user starts going in a circle, how can I print the snake body in the right location?

Also, how can I create an action that will run on the background, which will move the snake forward, no matter what the user does?

What structure should my code have? (code design structure)

This should be a console application, since it's the only framework I am familiar with.

I am not looking for finished code, since I want to really understand how it should work.


texts: Physics engine deltaTime and force acceleration

texts:
I am working on a physics engine that uses basic Euler integration to compute forces. So, here is the thing:

function applyForce (rigidbody, force) {
    rigidbody.forces.add(force);
}

function computeAcceleration (rigidbody) {
    rigidbody.acceleration = rigidbody.forces / mass;
    rigidbody.velocity = rigidbody.velocity + rigidbody.acceleration * time.deltaTime;
}

// The forces are reset after each gameloop

So now imagine I want to apply a force to jump, I will use applyForce at the moment the player presses the jump button.

But: What happens is that the amount of movement depends on the gameloop speed, since the force is applied for a single frame. I feel like I missed something about how you should use forces, but I don't see how I should manage it properly.

In which cases should we use a force, considering this deltaTime issue? And also, what should I use instead?


texts: How to track position on a map vs position on screen with XNA 4.0?

texts:
I'm working on my first XNA 2D game (overhead view), and I'm pondering how to manage the difference in position on screen vs. the position of a sprite on a global map.

The solution I'm currently thinking about is having the map keep track of everything on it, the player, other sprites, etc. The sprites will know where they are on the map, and when .Draw() is called on the map it will delegate drawing items to the items themselves, but pass a position to draw on the screen. For instance, something akin to the following:

class Map {
    Vector2D ScreenCenter;
    List<DrawableItem> Content;

    void Draw(GameTime gameTime) {
        foreach (var i in Content) {
            i.Draw(spriteBatch, i.Position - ScreenCenter);
        }
    }
}

class DrawableItem {
    Vector2D Position;

    void Draw(SpriteBatch spriteBatch, Vector2D screenPosition) {
        // Draw ourselves at screenPosition
    }
}

Is there some better way of doing this? Or am I on the right sort of track here?


texts: How to stitch terrains together in Unity

texts: I'm building a world that consists of multiple terrains and I was wondering, how do I go about stitching them together so that features of my map will "fit" together?  I know Unity has the SetNeighbors() method, but it appears as though that simply tells each terrain which terrain is next to the other.  What I'm trying to accomplish is having multiple terrains and being able to have something like a mountain range move from one terrain to another and make it appear as though it's all one terrain.


texts:
So I made a hexagonal tilemap of ocean tiles and then picked a few tiles to be land. When I pick all adjacent tiles to the hexagon it usually works, but for tiles that are on certain columns it does not. Also, on these columns the tops and bottoms of tiles are missing.

It's hard to explain but here's a screenshot that should clear it up:

As you can see, on every other column the top and bottom of hexagons are missing, when all adjacent tiles are filled in to the centre tile it works fine for those columns without a bottom and top on hex, but when it's on the other column one of the adjacent tiles is displaced.

Any suggestions?

Code:

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x + 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y - 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y, landCell);

    baseLayer.setCell((int)islands[currentTile].x , (int)islands[currentTile].y + 1, landCell);

    baseLayer.setCell((int)islands[currentTile].x - 1, (int)islands[currentTile].y + 1, landCell);


texts: Suitable Client Server setup for Network Game testing

texts:
I want to test my Client/Server game for which, currently, I am using localhost for both Client and Server.

Obviously I'm not getting any fluctuation in data and measure idea of performance, and in other parameters, what I wanted to ask how I would test a real world scenario:

if i create a little network with two computers or

if check that on LAN on which i am or

Are these cases (localhost included) equivalent?

or do I really need to test my game on different LANs to have reliable and realistic testing data?

How these different network setups influence the testing process?

Can somebody please suggest methods for testing the effect of network latency and packet loss on my game?

which above setup will give me more up and downs in number with LEAST setup/implementing efforts.

The game is supposed to be played on a LAN but it IS capable of more.


texts:
While looking for a cross platform library for game development, I came across both SDL and Allegro. After extensive research on fora, it seems SDL it way more widely used than Allegro is. I got the impression SDL is like 'the standard library' for developing graphical applications.

Now, I was wondering why this is the case. From a purely technical perspective, Allegro supports (almost) the same platforms as SDL. Moreover some functions in Allegro seems more intuitive than the SDL counterparts. On the other hand, the support of SDL for iOS and Android is better.

My question therefore is:

What is the cause of the widespread use of SDL over Allegro? Is it only due to personal preference or are there technical reasons for this?

To put my search into context, I'm looking for a low level library preferably written in C++. My goal is to develop a game engine from the lowest level possible just for the learning experience.


texts: Why doesn't my animation stop when I press a key?

texts:
I wrote a program that animates two squares diagonally across the screen, from opposite sides. Used Timer object to do so. The squares collide with each other and also with the frame boundary to change directions. The problem is that I added a key listener to stop the animation when you press a particular key, and again restart the animation when you press the same key, but that does not seem to work. The animation is not stopping.

problematic part:-

 public Drawing(){

    t=new Timer(10,this);
    t.start();
    addKeyListener(this);
    setFocusable(true);
    if(flag==-1){
        t.stop();
    }
    if(flag==1){
        t.start();
    }
}

and this is the keyListener part that changes flag to 1 / -1 :-

public void keyPressed(KeyEvent arg0) {
    if(arg0.getKeyCode()==KeyEvent.VK_ENTER || arg0.getKeyCode()==KeyEvent.VK_ESCAPE){
        flag=-(flag);
    }
}

i also found out that the value of flag variable is changing perfectly with each keyPressed, but it is not stopping the timer.


texts:
I want to make it so that either the pitch yaw or roll rotates around the world axis and not the local axis, but I'm not sure how, I've got.

Vector2 mouse_change = new Vector2(mouse_previous.X - mouse_new.X, mouse_previous.Y - mouse_new.Y);
camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), mouse_change.X / 800f);
camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), mouse_change.Y / 800f);

Updating every frame, then I've got.

view_matrix = Matrix.Invert(Matrix.CreateFromQuaternion(camera_angles) * Matrix.CreateTranslation(camera_position));
projection_matrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 0.2f, 500f);

The problem is that if I e.g. change the pitch then change the yaw then the yaw changes through the local axis, I need it to turn around the world axis so that it doesn't matter what the yaw is :/.


texts: How can I stop the player from drifting due to local input prediction when they stop?

texts:
I'm working on a 2D server-client multiplayer game engine (which you can try here). It uses WebRTC DataChannels. (The connections are peer-to-peer, but the host peer still acts as a server.)

The biggest problem (apart from connectivity) is the local input prediction. We do the usual: On key press, players move instantly, tell the host what keys are pressed, receive data back from the host and compare it to the historical position. The position is corrected over time if there is a difference. This works well with low packet loss or PDV, even if the ping is high.

If there is loss or PDV, the deviation can be larger. I think this is because if the first packet indicating a change of input is delayed or dropped, the host finds out later, and starts changing that player later than their local input prediciton shows.

If the player is moving, we crank up the amount of applied correction, since it's less noticable. This seems to cover up gaps when starting to move and while moving. However, any correction is more noticable if they come to an abrupt stop. Then if the PDV or loss means the host thinks they stopped later, the host overshoots, sends back data saying they're a bit further ahead, and the correction makes the player drift a little. On flaky connections, players often noticably drift after coming to a stop.

I've not noticed this in other games. How can this be mitigated?


texts: Can ARToolkit be used with Unity on the Android platform?

texts: Does anyone know if ARToolkit can be integrated with Unity and work on Android phones? It would be helpful if you could share any examples or resources.


texts: Do I really need an engine to make a great game?

texts:
I made one simple game, and now I'm working on a second version. I make games in Java, but everyone around me uses tools and engines. I do not understand some of the stuff that is in Unity.

In Java, I write all the code. I understand how it works, and I know how to make the code do what I want.

Is it true that I cannot make a great game without a tool?


texts:
I'm planning on implementing A* in my game for pathfinding, I understand the basics of how the algorithm works but I was wondering, other than finding the start and end nodes Are there any benefits to placing the navigation graph into a tree? It seems to me that it wouldn't really benefit any as each node has a list of connections to other nodes. But I recall reading an article about pathfinding a while back and it suggested using a space partition tree, I believe it suggested an AABB tree to be exact.

If A* wouldn't benefit would any of the algorithms benefit from such a thing?

And no, sadly I can't find the article again.


texts: How do I make something I flash/blink more frequently as it gets closer to disappearing?

texts: In my game when you kill an enemy they may drop something like a health pack or gold.  I want this to have a time limit so that it eventually disappears if you don't pick it up.  I want the item to flash more frequently the closer the drop gets to "death".  How do you do the "more frequently flashing" algorithm?


texts: Centering a textbutton in a table libGDX

texts:
I have a few Tables spread across a Stage, now I have a problem.
In one table, all the TextButtons are centered, while in a different one they aren't, like this:

Table 1           Table 2
XXXtextXXX        text
XXmoretxXX        moretext
XXXXtxXXXX        MoreTextHere

The problem is that as much as I try I can't seem to center them.
In the first table I have only textbuttons in each row, while in the second one I have two rows with 3 textbuttons, which the rest are only one text button.
this is the code:

        settingNames.bottom().left();
    settingNames.add(new TextButton("Resolution:", style));
    settingNames.row();
    settingNames.add(new TextButton("VSync:", style));
    settingNames.row();
    settingNames.add(new TextButton("FullScreen:", style));
    settingNames.row();
    settingNames.add(new TextButton("Borderless:", style));
    settingNames.row();
    settingNames.add(new TextButton("Force FPS:", style));
    settingNames.row();
    settingNames.add(new TextButton("Target FPS:", style));
    settingNames.setBounds(0, 0, Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight());
    settingNames.debug();

    resPrevious = new TextButton("<", style);
    resText = new DynamicLabel(resHandler.getResolution(), labelStyleSkin);
    resNext = new TextButton(">", style);
    vsyncToggle = new TextButton("Off", style);
    fullscreenToggle = new TextButton("Off", style);
    borderlessToggle = new TextButton("Off", style);
    forceFPSToggle = new TextButton("Off", style);
    targetFPSPrevious = new TextButton("<", style);
    targetFPSText = new DynamicLabel("60", labelStyleSkin);
    targetFPSNext = new TextButton(">", style);
    fullscreenToggle
            .setColor(fullscreenToggle.getColor().r,
                    fullscreenToggle.getColor().g,
                    fullscreenToggle.getColor().b, 0); ---> Used this line to check how the textbutton looks.
    changeOptions.center().bottom();
    changeOptions.add(resPrevious);
    changeOptions.add(resText);
    changeOptions.add(resNext);
    changeOptions.row();
    changeOptions.add(vsyncToggle).fill(true, false);
    changeOptions.row();
    changeOptions.add(fullscreenToggle);
    changeOptions.row();
    changeOptions.add(borderlessToggle).fill(true, false);
    changeOptions.row();
    changeOptions.add(forceFPSToggle).fill(true, false);
    changeOptions.row();
    changeOptions.add(targetFPSPrevious);
    changeOptions.add(targetFPSText).center();
    changeOptions.add(targetFPSNext);
    changeOptions.setBounds(0, 0, Gdx.graphics.getWidth(),
            Gdx.graphics.getHeight());
    changeOptions.debug();

I added all the tables to a stage and display them, but can't figure what's wrong, I could really use help here...


texts: Pointer to member function of another class

texts:
I have two classes, CEffect and CEffectPool. A third class CLevel, is doing most of the stuff in my code.

In every frame, it checks each CEffect in CEffectPool, and if it is currently inactive, it disables it.

What I would like to do is to give CEffect the pointer to the CEffectPool member function called Destroy(), so I don't have to check every single CEffect by another class whether it shall be destroyed or not.

With this function pointer, CEffect would simply call a function, which would destroy it.

Also, I am not talking about destroying in the C++ way (I don't want memory to be freed or to call the destructor).

Here is some code, that i have, but it unfortunately don't work and I am not sure why:

CEffect.h

class CEffectPool;
class CEffect {
    public:
        CEffect();
        CEffect(const CEffect& eff);
        CEffect& operator=(const CEffect& eff);
        void Initialize(CEffectPool* pool,
                        ushort id,
                        real x,
                        real y,
                        ushort timer);
        void Frame();
        void Draw();
        bool IsActive() const;
    private:
        CEffectPool* _pool;
        ushort _id;
        CSprite _sprite;
        ushort _anmfrm;
        ushort _timer;
};
void DestroyEffect(CEffectPool* pool,
                   ushort id);

CEffect.cpp

void CEffect::Frame() {
    if(_timer) {
        --_timer;
        return;
    }
    ++_anmfrm;
    if(_anmfrm == 24) {
        DestroyEffect(_pool,_id);
    }
}

CEffectPool.cpp

void CEffectPool::Destroy(ushort index) {
    if(index >= _size) {
        return;
    }
    CEffect temporary = _pool[index];
    _pool[index] = _pool[_size-1];
    _pool[_size-1] = temporary;
    --_size;
}
void DestroyEffect(CEffectPool* pool,
                   ushort id) {
    pool->Destroy(id);
}

Could you help me with this? What is the best approach to do this?


texts: Why is it possible to encounter a texture coordinate greater than 1 or less than 0

texts:
I'm studying a text about texture mapping and in the preparing to draw session, I read:

Define the texture wrapping parameters. This will control what happens when a texture
coordinate greater than 1.0 or less than 0.0 is encountered:

glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S,wrap);
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T,wrap);

where wrap is:
GL_REPEAT : specifies that this pattern will repeat (i.e., wrap-around) if transformed texture coordinates less than 0.0 or greater than 1.0 are encountered.

GL_CLAMP : specifies that the pattern will “stick” to the value at 0.0 or 1.0.

But there's no explanation what is the reason of encountering such texture coordinates?
For example suppose that I have just drawen a rectangle and I want to apply an image as a texture on it, is it possible to encounter such coordinates?


texts: How does one generate mountains out of a Fourier transform?

texts:
I am watching this IGN video of No Man's Sky in which the founder/programmer of this game talks about how different is his game from other games. Here he talks about how mathematical equations instead of art is used to render graphic of planets and animals and even their behavior.

Then he says that instead of seeing mountains he sees only equation like Fourier transform. I have no knowledge about game development and its intricacies, but I'm curious how one might use a Fourier transform or similar mathematical operation to generate terrain without art?


texts:
I have been following the tutorials at http://lazyfoo.net/tutorials/SDL/index.php and although they are all very well written and I have learned more than I would have on my own, I am not sure how to go about building a basic main menu that has the normal "new game," "settings" and "exit" options.

How would I handle such a menu inside of a normal game loop?


texts:
I'm trying to work on spaceinvader. I have problem that missiles or the bullets skip frames due to its fast speed. I tried to use the previous position of the bullet in the collision check, but still, the collision does not work. it's pretty working on bullets with slow speed. Kindly see the attached video.
https://www.youtube.com/watch?v=jOVc-HGNI9Q&feature=youtu.be

  void Bullet::Update(float dt)
{
    Position.y -= 0.50 * dt;

    Vel = (Position - prevPosition).GetNormalised();

    if (Position.y < 0)
    {
        IsDestroyed = true;
    }
    else
        IsDestroyed = false;

    prevPosition = Position;

}

and for collision check:

// if there is intersection
        if (IntersectsWith((*it)->BoundingRect, barrierRect))
        {

            // subtract (*it) bullet position from barrrier's rect
            int normX = (*it)->prevPosition.x + (*it)->Vel.x - barrierRect.x;
            int normY = (*it)->prevPosition.y + (*it)->Vel.y - barrierRect.y;

            // barrier image pixels
            uint32* ptr = (uint32*)pixels;
            // height of the barrier

            int pixelOffset = normY*51 + normX;
            unsigned int color = ptr[pixelOffset];
            // look up the color if its not black, it should be green
            if (color != 0xFF000000)
            {
                // delete the bullet
                Bullet *bullet = *it;
                it = ship->Bullets->erase(it);
                delete bullet;
                ship->Canfire = true;
                isCollision = true;

                // blast a circle around that bullet hit position
                int radius = 9;
                for (int y = -radius; y <= radius; y++)
                {
                    for (int x = -radius; x <= radius; x++)
                    {
                        if (x*x + y*y <= radius*radius)
                        {
                            int j = x + normX;
                            int i = y + normY;
                            int pixelOffset = i*51  + j;
                            ptr[pixelOffset] = 0xff000000;
                        }
                    }
                }

            }


texts: As far as I know the DirectX12 SDK that comes with the Windows 10 SDK can only be used on a Windows 10 machine. Although I'm not entirely sure about the runtime and the use of future levels (which came with DX11). Considering the radical API changes in DX12, is it possible to initiate a level 11_0 device that will operate on the DX11 runtime on Windows 7 for instance? Or am I getting the feature levels idea wrong?


texts: How do I detect collision between an ellipse and a rhombus?

texts:
I'm building a game in C/C++ (been alternating between the two), but one of the biggest problems I've run into is collision detection. The game is isometric and exists on a 2x1 grid (e.g. the base tile is 32x16px).

Most creatures in the game use ellipses as collision masks (similarly 2x1 sized, default size is 32x16), whereas static objects use rhombuses for masks (again, 2x1, 32x16 default). How do I detect the collision of these two distinct shapes? Also, how do I detect collisions between two ellipses and/or two rombuses?

I've looked at the Separating Axis Theorem, Voronoi diagrams, and all kinds of other things, but I am having trouble understanding them (which is a pretty essential step for C/C++). Can anyone help me to understand these techniques?


texts: How should I load/change/activate scenes?

texts:
Scenes are confusing the hell out of me and I'm pretty sure they should be simple to understand.

When the game loads, only the current scene has a buildIndex != -1. In order give it a 'real' build index I need to load it by path or name (because there's no build index).

The scenes are ten game scenes, one title scene and one persistent scene (which has the player and the status bar with the score etc.).

Should I load a scene every time I change scene and then load additive afterwards or should I be using Set Active Scene?

All the scenes are ticked in the Build Settings.

I'm looking at the index with this:

private void Start()
{
    var sceneName = "Persistent";
    var sceneBeforeLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneBeforeLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
    SceneManager.LoadScene(sceneName);
    var sceneAfterLoading = SceneManager.GetSceneByName(sceneName);
    Debug.Log($"Scene {sceneAfterLoading.name}, BI = {sceneBeforeLoading.buildIndex}");
}

Which outputs:

----------------------------------------------
Scene , BI = -1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:10)
----------------------------------------------
Scene Persistent, BI = 1
UnityEngine.Debug:Log(Object)
Title:Start() (at Assets/Scripts/Title.cs:13)
----------------------------------------------


texts:
I would like to start developing my own shaders within unity.

For starters I would like to do a screen spaced blur.

Are there any good tutorials to learn shader development besides the official unity documentation, which i find a bit hard to understand?


texts:
Last time I used image effects in Unity it was back when 3.0 was released and for bloom you used the object's alpha to indicate whether it should glow or not. Now in 4.2 I couldn't grasp how to apply the image effect properly. It seemed to put the whole scene to glow and alpha did not affect it.

There was no help from the Unity docs which are pretty much just spec sheets for the effects and no proper tutorials around. This leads to couple of questions:

How do you create something like the screenshots in the Bloom page in the docs? Only the car windows and metal parts glow, but no glow on the concrete.
How do you make a light source like the second image on the above link? I tried different shaders and lights on a gameobject but none of them produced anything like that.
What does the HDR checkbox in the camera actually do?


texts: SetActive true/false only once when game install first time unity?

texts: In my unity game I try to give player instruction how to play but it only in first level and first time when game install so how i can do this?


texts: Spawning 5 bullets at once and checking if alive, gives an error

texts:
I am developing a game for my University project and came across a problem with pointers. I have a vector of bullets that has every bullet checked for collisions. But, when I try to spawn 5 bullets at once (shotgun shot), it spawns everything correctly, then I go through the vector and check if the bullet is alive. For some reason it finds a NULL pointer or a corrupted data of a pointer. Would be really appreciated if someone knew how to fix this. Thanks!

Bullet check:

void Bullet::checkOutOfRange()
{
    if(type == "enemy_bullet")
    {
        if(body->GetPosition().x <= -10.0f)
        {
            alive = false;
        }
    }
    // checks if the body is out of the window size
    else if (body->GetPosition().x > 510.0f || body->GetPosition().x < -10.0f || body->GetPosition().y > 291.0f || body->GetPosition().y < -10)
    {
        alive = false;
    }
}

Bullet collision detection:

class MyContactListener : public b2ContactListener
{
    void BeginContact(b2Contact* contact) override
    {
        if (contact && contact->IsTouching())
        {
            Entity* A = static_cast<Entity*>(contact->GetFixtureA()->GetBody()->GetUserData());
            Entity* B = static_cast<Entity*>(contact->GetFixtureB()->GetBody()->GetUserData());

            //------
            if((A->type == "player_bullet" && B->type == "enemy") || (A->type == "enemy" && B->type == "player_bullet"))
            {
                Bullet *bullet = nullptr;
                Enemy *other = nullptr;
                if (A->type == "player_bullet" && B->type == "enemy")
                {
                    bullet = dynamic_cast<Bullet*>(A);
                    other = dynamic_cast<Enemy*>(B);
                }
                else if (A->type == "enemy" && B->type == "player_bullet")
                {
                    bullet = dynamic_cast<Bullet*>(B);
                    other = dynamic_cast<Enemy*>(A);
                }
                if ((A && B) || (B&&A))
                {
                    other->bodySprite.set_animation("death");
                    bullet->alive = false;
                    other->alive = false;
                }
            }
        }
    }
}

Bullet check in game:

    for (auto itr = player_bullets.begin(), itrEnd = player_bullets.end(); itr != itrEnd; ++itr)
    {
        (*itr)->checkOutOfRange(); // go to declaration to see where the bullets stop
        (*itr)->bodySprite.set_position((*itr)->body->GetPosition().x, (*itr)->body->GetPosition().y);
        (*itr)->bodySprite.set_rotation((*itr)->bulletDir * 180 / PI);
        (*itr)->moveBullet(20.0f);
        if ((*itr)->alive == false)
        {
            input_world->DestroyBody((*itr)->body);
            delete *itr;
            itr = player_bullets.erase(itr);
        }
    }

Shotgun shot spawn:

void spawnShotgunShot(float x, float y, float dir, b2World *world)
{
    // maybe bad pointer management?
    Bullet *bullet_ptr1 = new Bullet(x, y, dir, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr1);
    Bullet *bullet_ptr2 = new Bullet(x, y, dir + 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr2);
    Bullet *bullet_ptr3 = new Bullet(x, y, dir + 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr3);
    Bullet *bullet_ptr4 = new Bullet(x, y, dir - 0.5, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr4);
    Bullet *bullet_ptr5 = new Bullet(x, y, dir - 0.25, world, "player_bullet", PLAYER_BULLET, ENEMY);
    player_bullets.push_back(bullet_ptr5);
}

And here is a testbuild with the sln in it:
Link to testbuild


texts:
I'm having a problem with my .fx file in my D3D 11 application.

I can run the application just fine from Visual Studio, but when I run the .exe it fails when trying to load the .fx file.

I've checked the file name in the code and tried all sorts of paths but I can't figure this out, why is this happening?


texts: Simple state pattern and circular dependancies

texts:
I'm creating a game engine which utilizes a state machine following this GameDevGeek tutorial.  My concern is the use of circular dependency which I've heard is bad.  The game engine has the game state but the game state needs access to the game engine for a state to be able to transition to a new state.  Is this a proper way of doing it?  Namely my implementation, includes, and forward declarations.  On another note, why does syntax highlighting randomly turn off after two files have #included each other?  Here's my code:

// Game.h
#ifndef GAME_H
#define GAME_H

#include "GameState.h"
#include "SFML\Graphics.hpp"

class GameState;

class Game
{
public:
    Game();
    ~Game();

    void setState(GameState* state);
    void handleEvents();
    void update();
    void render();

private:
    sf::RenderWindow window_;
    GameState* state_;
};

#endif

// Game.cpp
#include "Game.h"

Game::Game()
    : window_(sf::VideoMode(500, 500), "Test Game", sf::Style::Default) ,
{
    window_.setKeyRepeatEnabled(false);
    state_ = nullptr;
}

Game::~Game()
{
    if (state_ != nullptr)
    {
        state_->destroy();
        delete state_;
    }
}

void Game::setState(GameState* state)
{
    if (state_ != nullptr)
    {
        state_->destroy();
        delete state_;
    }
    state_ = state;
    if (state_ != nullptr)
    {
        state_->init();
    }
}

// more code...

// GameState.h

#ifndef GAME_STATE_H
#define GAME_STATE_H

#include "Game.h"
#include "SFML\Graphics.hpp"

class Game;

class GameState
{
public:
    virtual void init() = 0;
    virtual void update(Game* game) = 0;
    virtual void render(sf::RenderWindow &window) = 0;
    virtual void destroy() = 0;

    void changeState(Game* game, GameState* state);
};

#endif GAME_STATE_H

// GameState.cpp
#include "GameState.h"

void GameState::changeState(Game* game, GameState* state)
{
    game->setState(state);
}


texts: How to make my sun appear far away in VR

texts:
I am attempting to add VR compatibility to my game, please could you help me figure out how to better control the multiple cameras in my scene regarding the head tracking and movement from VR devices?
I’m using Unity v2019.4, and not using the new VR Plugin system.
In my XR Settings I have Virtual Reality Supported ticked and have the Oculus and OpenVR virtual reality SDKs.
I have three cameras in my scene, at the following Depth levels:
2 = Main Camera (Depth only) which shows everything except my sun and skybox
1 = A Sun Camera (Depth only) showing only my sun layer
0 = A Background Camera (SkyBox) showing my custom skybox
The reason I render the sun on a separate camera is to give the effect of a very distant object. The sun camera is sat close to the sun, but when I move in the scene the sun never gets any closer giving the illusion of it being far out there in space.
This works great in non-VR, but in VR if I move my head forward or to the side, the sun camera also moves and so breaks the illusion of the distant sun.
I have tried playing around with settings and done a lot of searching, but I cannot figure out how to stop the "local" movement in my sun camera. Any ideas?


texts: Tilesets - how to make the pink color appear transparent

texts:
recently I searched for some free to use Tilesets on the internet. And wherever I found a sheet of sprites there is this pink color in the background. i know that all the spots having that color should be transparent later on but how do I do that? And has it any other special use or effect on the tile data?
An example of those sheets can be found here:
http://opengameart.org/content/rpg-indoor-tileset-expansion-1


texts: Unity ScrollView not scrolling with Clamped or Elastic

texts:
I have a ScrollView object in my project. It is set to Clamped.
Inside the ViewPort, I have Content and what I actually want to scroll, a TextViewMesh. The Content has a Content Size Fitter, with its Vertical fit set to Preferred Size.
The problem is, when I run it, and try to scroll, it does not scroll at all, in ScrollView to the current setting. If I set the ScrollView mode to Unrestricted, it scrolls to the infinity. What I am doing wrong? How can I set my ScrollView to scroll the text (which can vary in lenght)?


texts: If an AI is sure it is going to lose, what can it do to make the game fun for the player?

texts:
For context, I am contributing to a sequential turn based strategy game. I have an idea how to improve it but I feel I need some input to help me evaluate and improve it. We currently have a really dumb AI that just follows a rough set of rules each turn. I'm considering to upgrade it to a basic search based AI to not be guaranteed to win every time I play it.
There are many reason why an AI could be behind the curve. These include that is wasn't able to grow its economy well due to bad luck with map generation, that its economy was disrupted early by an enemy raid while the defending army was out of reach, that the starter army was defeated early and resources had to be invested to replace it instead of economic upgrades or more importantly there being a big awesome deciding battle with all units involved and it lost. A search based AI will be able to know when it is obvious that it is growing slower than it should, can't recover and it is now impossible to win due to runaway success. Such a runaway success is often boring to play especially if it happened 3 times in a row.
Assume there is no meta game where multiple players can gang up on the strongest one. I am open to nudge the game rules in the AI's favor if this happens. However rubber banding can give the player the impression that they are punished for playing well, the AI drags out a game into an almost stalemate or even wins unfairly.
The problem I'm trying to solve is not that the AI is losing but that the AI rolling over and dying is not fun or interesting.
It is even worse. If the player is sufficiently good he will experience that every time.
In some theories of literature, after the conclusion seems forgone and the tension is falling a new small conflict that is relevant enough or something else that justifies further elaboration and excitement.

My idea is to have a library of endgame scenarios, a handful of which end up with player loosing unless he plays really well, most pose a small challenge that the player is entirely able to deal with and some are a "I roll over, just kill me already, please".
Are you aware of anyone trying something like this before?
If someone tried this in a strategy game or even outside of strategy games before I would like to learn from them.
Can you spot some obvious problems with this idea? I already considered the AI misjudging the impossibility of winning. However, I might be to enamored with my idea to spot different problems.
How can I make sure that this still feels fair? It is easy for the AI to get some extra resources however if a player is losing I am afraid that he would feel cheapened if he got some extra money and units.
How do I help the player having fun or at-least variety when they are losing? I really have no ideas for this.


texts:
I have been looking at shaders found here  shadertoy.com and most of the cool ones have noise and raymarch in common. I do not understand the source code at all but I really want to. How do these shaders work and how does the raymarch algorithm work? I've searched all over and can't find anything on the topic.

Thanks


texts:
So, as the title says, I want to be able to play NSF files using FMOD, because my project already uses FMOD and I'd rather not replace it. This will involve figuring out how existing players and emulators work and porting it. I haven't yet found an existing player that uses FMOD.

My starting point is the MyNes source from http://sourceforge.net/projects/mynes/. There are two big steps between here and what I'm looking for.

MyNes plays from a ROM, not NSF. So, I have to rip out the APU and get it to play NSF files.
The MyNes APU uses SlimDX, so I have to convert that to FMOD.NET.

I am really stuck about how to go about either of these, because I'm not that familiar with audio formats and it's hard finding resources online. So here are a few questions:

From what I can tell from the NSF spec at http://kevtris.org/nes/nsfspec.txt, it's just contains the relevant memory section of the ROM, plus the header. If anyone can verify or correct this that would be great.
The emulator APU uses data from the rest of the emulator to play, including things like cycle counts. I'm not sure what replaces this in a standalone player. Can't I just load all the music data at once into a stream and play it?
Joining #1 and #2, does the header data from the NSF substitute for some of the ROM data in the emulator code?
Using FMOD, will I be following the usercreatedsound example for loading a stream? And does this format count as PCM? Specifically MyNes says PCM8. Any tips on loading / playing the stream in FMOD are appreciated.

As an aside, I don't really understand the loading / playing sections of the spec I linked at all. It seems to apply to 6502 systems / emulators only and not to my situation.

I know it's a long shot for anyone here to have enough experience in this area to help, but anything you can provide is definitely appreciated. A link to an existing .NET library that does this would be even better, but I don't believe one exists.


texts: Future of Julia in game development industry

texts: I read in many posts that Julia is faster than many languages especially C++, What's the future of Julia in game development industry ? Will it replace all legacy C++ ?


texts:
I'm trying to make a RPG game (without the typical leveling and such. Just a roleplaying game) based on Wasted Youth Part 1 (which is an old flash game where you take control  of a teenage kid sent to a boarding school for troubled children who keep getting kicked out of schools).

Here's an example of a cutscene in Wasted Youth Part 1:
https://imgur.com/a/VTyGWlm

I've decided to go about creating a custom cutscene system due to the fact I find the timeline too limited for what I want to do.

I've also already made the basics of a cutscene system (it's very hacked-together and more servers as a proof-of-concept) shown here: https://twitter.com/SkullAberration/status/1079132052761518082.

One idea(along with pros and cons) I've already come up with is to store the cutscene in a separate scene with hardcoded(right word?) movement/animations/etc. This seems good since it helps me store cutscenes in an easy way and easily be able to customize what happens in the scene. An issue, however, is persistence. If a cutscene happens in a school cafeteria(as one does in WYP1) how, when I load the player back into the main scene, do I easily make sure they're in a cafeteria filled with people still?

If anyone has any information/suggestions on how I could go about creating a cutscene system like I've described(hopefully good enough), that'd be great!


texts:
The Separating Axis Theorem (SAT) makes it simple to determine the Minimum Translation Vector, i.e., the shortest vector that can separate two colliding objects. However, what I need is the vector that separates the objects along the vector that the penetrating object is moving (i.e. the contact point).

I drew a picture to help clarify. There is one box, moving from the before to the after position. In its after position, it intersects the grey polygon. SAT can easily return the MTV, which is the red vector. I am looking to calculate the blue vector.

My current solution performs a binary search between the before and after positions until the length of the blue vector is known to a certain threshold. It works but it's a very expensive calculation since the collision between shapes needs to be recalculated every loop.

Is there a simpler and/or more efficient way to find the contact point vector?


texts: How to implement pathfinding in this situation

texts:
So I'm creating a game for android using the libgdx library. I render the map from a tmx file and in it all the water tiles have the property of blocked. My player(a sprite) moves to where I clicked/tapped.

My problem is that I am unsure as to how to implement pathfinding. I can get in the layer with the tiles that which have the blocked property but I'm not sure as to how to stop my player from moving through them. I am using the tweenengine to move the player.

I was thinking that perhaps the code would create waypoints for the tween movement from a path finding code but again I'm not sure as to how to implement it.

I looked at A* and all the examples I was looking at were using rectangles and my player doesnt move in a uniform way(1 tile per move). So I cant really assign it values (10 for vertical/horizontal, 14 for diagonal).

If I have said anything that is not true then please correct me


texts: Move vector A to vector B but stop X distance before reaching vector B and always be in front

texts:
I believe this is basic vector math, but I'm struggling with it.
I have 2 objects (3D space, x, y, z), A (weapon) and B (camera).  I want to move A to B's location, but then offset A from B so that it is always in view of the camera.
endPosition = objA.worldPosition
startPosition = objB.worldPosition
distance = endPosition - startPosition

objA.worldPosition = distance

How do I offset object A so that it will always be an certain distance away from B so it will be in view?
To give you an idea of what I am doing...  I have a weapon in the world that the player can click on and inspect to modify from anywhere (no fixed rotation or position).  I want to move this weapon closer to the camera so they can turn it around, add attachments etc.  Right now the weapon clips into the camera so I need to apply an offset.


texts:
am making a simple in which you drag a player on screen and when a ball hits you you lose ,so you have to move the player away from the balls.level zero:no balls, level one:there is one ball on screen, level two: two balls on screen,the level increases when you reach certain scores. the problem here when player loses the game restart at level 2 and not at level 0.here is my code:

public class MyGdxGame extends ApplicationAdapter implements InputProcessor{

// variables
public int[] x={0,0};
public int[] y={0,300};
public int[] size={100,50};
public Ball ball1,ball2;
public Player player;
// Checker: Checks if Ball Hits Player
public Checker checker;
public Texture background;
public Stage stage;

// creation of application
@Override
public void create () {
    checker=new Checker();
    player =new Player();
    background=new Texture(Gdx.files.internal("background.png"));
    stage = new Stage();
    // Ball(x, y, size , speedX, speedY)
    ball1=new Ball(x[0],y[0],size[0],10,10);
    ball2=new Ball(x[1],y[1],size[1],20,10);
}

// changement of application
@Override
public void render () {
    Gdx.gl.glClearColor(1,1,1,1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);

    stage.getBatch().begin();
    stage.getBatch().draw(background,0,0,Gdx.graphics.getWidth(),Gdx.graphics.getHeight());
    stage.addActor(player);
    if(checker.level>0)stage.addActor(ball1);
    if(checker.level>1)stage.addActor(ball2);
    stage.getBatch().end();

    // Checks if Ball Hits Player
    if(checker.check1(player,ball1)){lost();}
    if(checker.check1(player,ball2)){lost();}

    // score increases
    checker.score();

    stage.act(Gdx.graphics.getDeltaTime());
    stage.draw();

    Gdx.input.setInputProcessor(this);
}
// Moethod Called When you lose
public void lost(){
    checker.level=0;
    checker.score=0;
}

// Drag Listener
@Override
public boolean touchDragged(int screenX, int screenY, int pointer) {
    player.updatePosition(screenX,screenY);
    return true;
}

// releasing memory of the app
@Override
public void dispose () {
    stage.dispose();
}


texts: How do I generate mipmap .png and model .obj files for LibGDX?

texts:
I'm playing a bit with LibGDX (OpenGL ES 2.0 wrapper for Android).

I found some sample code which used prepared files to load models and mipmap textures for them, e.g., at https://github.com/libgdx/libgdx/blob/master/demos/invaders/gdx-invaders/src/com/badlogic/gdxinvaders/RendererGL20.java it reads .obj file for the model and RGB565 format .png file to apply a mipmapped texture to it.

What is the best / easiest way for me to create these files?

I understand .obj files are generated by a bunch of tools (I installed Blender, Wings3D and Kerkythea so far), but which ones will be the most user friendly for someone unfamiliar with 3D modelling?

But more importantly, how do I produce a .png file with the mipmapped texture? The .png I looked at ( https://github.com/libgdx/libgdx/blob/master/demos/invaders/gdx-invaders/data/ship.png ) seems to include different textures for each of the faces, probably created with some tool. I browsed through the menus for the 3 tools I have installed but didn't find an option to export such a .png file. What am I missing?


texts: Struggling to get AI to repeat infinitely

texts:
I am following this as a guideline to help me figure out a simple AI for an enemy as I am new to java.

https://www.javacodegeeks.com/2014/08/game-ai-an-introduction-to-behaviour-trees.html

https://github.com/obviam/behavior-trees/tree/master/src/net/obviam/bt

I am calling this function:

AI goombaBrain = Routines.selector(Routines.repeatInfinite(Routines.wander(Board.board, InitObject.goomba)));

InitObject.goomba.setRoutine(goombaBrain);

But once it finishes wandering to a random location once it doesn't automatically reset. Any ideas? if you need any more information let me know. (InitObject.goomba is the enemy)


texts: Building TMX in the MonoGame Pipeline using MonoGame Extended

texts:
I updated MonoGame to the latest development build and noticed the Tiled Map Importer and Processor wasn't in the content pipeline anymore (even after adding both MonoGame Extended Content DLL and MonoGame Extended Tiled Content DLL).

Am I supposed to build TMX maps into .xnb files using the MonoGame XML Importer and No Processing or am I doing something wrong?


texts:
I'm new to scripting and combining languages with each other, so I have a question about something that confuses me. If you want to script a game engine, do you embed the script in the engine, or the engine in the script?

If you embedded the script in the engine, I can't really wrap my head around how that would work. Would you have this big script function you called every time you went through the game loop, passing along the inputs and etc.?

If you embedded the engine in the script, I could see how it would be convenient to just treat the whole engine just like a object in the script, and call a simple function each time you wanted to create something. On the other hand, how would the game loop inside the engine work? Having an extra thread for that seems like it could complicate things.

I haven't really found any good information that deals with scripting game engines. My engine is written in C++, and I am planning to script in Python 2.7.


texts: Adding Libxml2 to an Android project under Cocos2D-X

texts:
I am having problems porting Libxml2. I like it because it works under windows like a charm with <libxml/parser.h>. When I reference the libraries I just cannot find the right path to them, their own references are broken and I don't know how to fiddle with Android.mk

What is the procedure?


texts: php multiplayer game - server&client model

texts:
I'm working on a simple round&web-based multiplayer game. The idea of the game is very simple: The players get an array of audio files which they listen to and write the transcripts for in 5 minutes. the player who sends in the most right transcripts gets the most points. its fairly simple and i was able to implement it locally. at the moment i have the .php file which lets me do all this but only in single player. what i'm trying to say is that whenever a player logs him/herself in, the page is loaded anew. what i want to do is to start the game from the server everytime 3-5 players log themselves in, so that the players can play at the same time and their results can be compared at the end of the round.

the thing is, i don't know how to start with this session or server/client model for a multiplayer game. i have read that php isn't ideal for web based multiplayer games because real time data exchange could be problematic, but since that is not really the case here i don't think that should be a major problem. i googled my problem but i have failed to find a solution. any help or advice would be much appreciated. cheers.

edit: is a node.js server what i'm looking for here?


texts:
I'm trying to get a cross at the center of the screen (Two lines will do as well).

I have a 2048x2048 Texture which I have thrown into a canvas. Filtering is set to point. The image is set to be in the middle of the screen no matter the resolution. The image is set to 2048x2048 no matter the screen resolution which works as well.

However when I change the Screen Resolution I get results like the following, no matter what I do, the line refuses to stay at the same thickness. When I enable Bilinear filtering the lines constantly fade and thicken.

This is what I get when I use a 16x16 image:

EDIT: i tried using a black square and setting its width to 1 and height to 2048, and another one with width to 2048 and height to 1. The result i got is not what i expected:

Can someone help me to fix this please?


texts: Pygame.display.set_icon unable to show transparecy

texts: On Python 3.2.5 32 bit, I installed pygame. I made some code with it. It included pygame.display.set_icon(image). The image file is .png and I loaded it by using image = pygame.image.load("clockico.png").convert_alpha() The transparent pixels on the .png file showed up as black. I tried using a .ico file instead of a .png file, but the output was the same. Is there a way to fix this?


texts: I wonder if there's a way to get an autotile just like a single tile using a get_autotile() GDScript function or something like that.


texts:
I'm currently developing a GOAP system in Java. An explanation of GOAP can be found at http://web.media.mit.edu/~jorkin/goap.html. Essentially, it's using A* to plot between Actions that mutate the world state.

To provide a fair chance for all Actions and Goals to execute, I'm using a heuristic function to estimate the cost of doing something. What is the best way to estimate this cost so that it is comparable to all the other costs?

As an example, estimating the cost of running away from an enemy versus attacking it - how should the cost be calculated to be comparable?


texts: OSX Based Equivalents for Stacking Normal Maps?

texts:
I've been looking for an OSX based alternative to the Windows based xNormal and NVIDIA textures tools for stacking normal maps in photoshop.

Can anyone recommend something, whether it's a standalone package or photoshop plugin?