texts:
I'm relatively new to unity, started a couple weeks ago and so far I managed to setup a character with multiple parts, like hair, head, and body. Here's how it looks like:

I also managed to import some animation thanks to https://www.mixamo.com/ and everything works perfectly well; for now...
Now, I'm struggling with the "change" part mecanism. I'd like to swap the "nude" body mesh part, to an "armor" mesh or any other body mesh. Problem is, when I change the model in the SkinnedMeshRenderer it tells me the following:

with this result:

I did some reseach about this error message, and it actually makes sense, the given mesh doesn't have any bone setup, bone weights or such.
I would like to know if it's possible to use "common" skeleton for every models and assign it throught code?


texts:
i have a question on designing a HTML5 2D game renderer.

I've read that it's better to not let entities draw themselves but instead put all the drawing functions in the renderer. After coding for a bit, I realise that this does have its advantages. For instance, I can have a list of helper functions in my renderer system, like drawRotatedImage(), getSprite(), setFontSize(), plus the context variable etc.

However, wouldn't this lead to a very bloated renderer class, with functions like drawTree(), drawMonster(), drawPlayer(), drawBall() or whatever entity?

Also, how would i easily map the entity objects to their corresponding draw functions? Would i have to do an if (entity.type == 'monster') this.drawMonster(); else if (entity.type == 'tree') this.drawTree(); kind of thing?


texts: Need an example of a HLSL Compute Shader

texts:
I'm finding Compute shaders very confusing. I was wondering, if I were to provide an example, and maybe one more later, if someone could demonstrate how to convert it into a Compute shader for D3D11?

Here is the example, it's just a function:

void tonemap( out float4 low, out float4 high, float3 rgb, float scale)
{
    rgb = rgb*scale;
    low = rgb.xyzz;
    high = rgb.xyzz-saturate(rgb.xyzz);
}

Where would I start with this?


texts: LWJGL - Continuous key press event without delay

texts:
I am checking for key presses and then based on the keys pressed I am moving a square around the screen. I am setting booleans for the keys WASD. But , Whenever I try to keep the key down , it takes a while till it moves continuously (Just a half second stop after a single move.) Any way to get rid of that and make it be "smooth"?
Code:

 up = false;
 down = false;
 left = false;
 right = false;
 reset = false;

 while(Keyboard.next()){
     if (Keyboard.getEventKeyState()) {
        if(Keyboard.isKeyDown(Keyboard.KEY_SPACE)){
             reset = false;
        }
         if(Keyboard.isKeyDown(Keyboard.KEY_W)){
            up = true;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_S)){
            down = true;
         }
         if(Keyboard.isKeyDown(Keyboard.KEY_A)){
            left = true;
        }
        if(Keyboard.isKeyDown(Keyboard.KEY_D)){
            right = true;
        }
     }
}


texts: Multithreading/Optimisation for Random Generation in Gamemaker

texts:
I have a FurGeneration() script in my game; when run, it randomly generates individual oFur objects in specified areas in the game's single Room. Each has a random depth and one of three sprites, and the script produces the impression of dense, layered fur. I've attached a screenshot.

At the moment, the script is working well, as I am using it on relatively small areas. However, my next challenge is to apply this across the single, 20,000 x 20,000 room of my game to produce a consistent field of fur.

My first attempt at this was to create a background sprite, a simple 1000x1000 grey square with its image_alpha set to 0. These would be generated in rows across the entire space of the room, and then each one would have the FurGeneration() script run on it to generate individual squares of fur flush with each other. I've applied this to one 'row' of my games' Room, and the game really slows down; it doesn't crash, but evidently there are just t0o many calculations going on at once.

My question is: is there a way to multi-thread in Gamemaker? Or does it already multi-thread, meaning that this plan is a foolish one? It would be interesting to hear your thoughts.


texts: How should I prepare for migration from D3D9 to D3D10 or D3D11?

texts:
I'm considering a Direct3D9 texture streaming solution, but my company will eventually be going to D3D11 in the future.

I wanted to make my solution as forward compatible as possible, so I was hoping that someone could give me some feedback on exactly what D3D11's capabilities were and what I should be looking for when preparing such a migration?

For reference, here's what I'm considering on D3D9:

Load low res mip maps for all meshes at load time
Create bounding boxes around each of my objects and detect when I'm inside any given bounding box
For any bounding box that I'm inside of I will load the high res portion of the mip map
Any bounding box that I've left I'll unload the texture from
I've also got to cook up some scheme to manage fragmentation of the GPU memory, initially I'll probably just cycle the GPU memory whenever the camera and my objects are still


texts: RTS Networking in Unity: Client-Server vs. Lockstep

texts:
I am trying to make a RTS game in Unity, and I've got a few non-networked features working and so I want to start working on the multiplayer aspect so I don't dig myself into too deep a hole with mechanics I have to recreate to make it online.

I've done a bunch of research into using either a lockstep model (http://www.gamasutra.com/view/feature/131503/1500_archers_on_a_288_network_.php?page=1), or a more typical client-server model where all of the units' positions, velocities, and other traits are synced every fraction of a second.

From what it seems, using the client-server model used to require way too much bandwidth, hence the development of lockstep, but nowadays internet has improved to the point where people actually have enough bandwidth to do this practically. The client-server method seems like it would be easier to implement in Unity also, although UNET seems to be designed for games where the player controls one character, as opposed to the syncing of possibly hundreds of units required in an RTS. The lockstep model would most likely require going somewhat underneath Unity's high level API and implementing a whole slew of time step stabilizers and checks to make sure all the commands are received and executed in the exact same way.

What I'm curious about, however, is something in between the two, where most of the time, I send simple commands to the other clients, saying something like "at xx:xx game time, the player told this unit to move here." The other clients then receive that, and discover that two ticks have passed since that game time, run the two ticks on that object, and then let it continue running in that state until it receives that next update. Every second or so, I could then sync up all of the positions and other data to iron out any inconsistencies. I feel like this could be the best of both worlds in terms of not requiring the insane amount of synchronicity for lockstep but also not requiring as much bandwidth guzzling. I'm probably missing something big or understating the simplicity of implementing such a system, because to me it seems this would be simpler than implementing pure lockstep.

What networking model should I use?

Thanks!


texts: Why does adding a value to list makes list not editable in unity inspector

texts:
I am adding elements from the first list to another similar list, but it makes first not editable in the Unity Inspector. Whenever I try to change values from the inspector it makes them again 0. While If I comment list.Add() I can change values in the inspector.

[Serializable]
public class Characterz
{
  public string Name;
  public int Age;
  public float Gold;
}

public class Actor: MonoBehaviour
{
     public List<Characterz> kings=  new List<Characterz>();

    public List<Characterz> Actors = new List<Characterz>();

     void Start()
     {
        for (int y = 0; y < 30; y++)
         {
             Actors.Add(new Characterz());
             if (y < 4)
             {

                 //I need to comment following line to change Actors
                // list value in editor
                 kings.Add(Actors[y]);
             }

         }
      }

}


texts: How should I apply Ambient Occlusion from greyscale AO maps?

texts:
I've seen many tutorials on SSAO, but none for simple ambient occlusion maps.

I can see myself working things out alone, as AO maps are simple greyscale maps that indicate where there should be more lighting and where less, right? Something like

float ao = texture(ambientOcclusionMap, uvCoords);
vec3 lighting = ambient + (diffuse + specular) * ao;

Is there something more to it?


texts:
I'm trying out the new Version of Unity 3D (5.0.0.4f) and figure out whats new, whats possible now. My experience with Unity 4 free is also just a little. Anyway I work with the "new" cloth component and have some general questions to different funkctions. The documentation brought no knowledge to me. So I would be thankful if one of you could explain me the different points in an accessible way.

First question touchs the constraints. When I edit the contraints (of a plane for example), there are two options to activate. What are the differents between "Max Distance" and "Surface penetration". "max Distance" is clear to me but i don't know what the second option does.

Seceond question: I have an tablecloth positioned over a sphere. In playmode when i move the sphere up and the tablecloth react correctly. But the sphere ist temporaliry visible trough the cloth. Its look like a graphicbug then, but ist there a way to prevent this?

So I hope my questions a clear enough to understand. Thanks a lot for your educational effort.


texts: Getting the Ray position from View and Projection Matrix

texts:
I'm having some trouble calculating the direction and position of the ray from my matrices. I have tried some things such as:

private Vec3 getPick(Mat4 projection, Mat4 view) {
     Mat4 inverseProject = projection.copy().inverse();
     Mat4 pick = inverseProject.mul(view.copy());
     Vec3 pos = new Vec3(pick.m10, pick.m11, pick.m12);
     return pos;
}

I am using custom math classes and I'm pretty sure they work. Also, would it be better to perform this math in my shader? For better performance etc..?

I contacted Notch (creator of Minecraft) on this issue and he told me  to inverse the view Matrix and multiply by the projection, then multiply by the mouse coordinates. I tried that, it didn't do much.

EDIT: Tried normalising the screen space. It seems to do the job except in negative directions. Plus its a little off.

Vec3 getPick(double w, double h, double ar) {
    double sx = ((Mouse.getX() / w / 2.0) - 1.0) * ar;
    double sw = 1.0 - (2 * ((h - Mouse.getY()) / h));

    Mat4 viewProjInv = view.copy().mul(projection).inverse();
    Vec3 mouseNormal = new Vec3(sx, sw, 1.0);
    Vec3 dir = viewProjInv.mul(mouseNormal);
    return dir.mul(1);
}


texts:
I'm trying to implement a simple collision detection for my player but it is not detecting the layer mask as my Player comes into contact with it. I have a move point that moves slightly ahead of the player, and if it comes in contact with the StopMovement layermask then it should NOT move any further. Unfortunately, the layer is never detected and therefore the player just moves right through the object.
Script:
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PlayerController : MonoBehaviour
{
    public float moveSpeed = 5f;
    private float moveHorizontal;
    private float moveVertical;

    public Transform movePoint;

    public LayerMask whatStopsMovement;

    // Start is called before the first frame update
    void Start()
    {
        movePoint.parent = null;
    }

    // Update is called once per frame
    void Update()
    {
        moveHorizontal = Input.GetAxisRaw("Horizontal");
        moveVertical = Input.GetAxisRaw("Vertical");
    }

    private void FixedUpdate()
    {
        transform.position = Vector3.MoveTowards(transform.position, movePoint.position, moveSpeed * Time.fixedDeltaTime);

        // stops the movePoint from going too far
        if (Vector3.Distance(transform.position, movePoint.position) == 0f)
        {
            if (Mathf.Abs(moveHorizontal) == 1f) // makes it so we can check if 1f OR -1f without == 1f || -1f
            {
                if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(moveHorizontal, 0f, 0f), 0.2f, whatStopsMovement))
                {
                    Debug.Log("No collision");
                    movePoint.position += new Vector3(moveHorizontal, 0f);
                }
                else
                {
                    Debug.Log("Collision");
                }
            }

            else if (Mathf.Abs(moveVertical) == 1f) // makes it so we can check if 1f OR -1f without == 1f || -1f
            {
                if (!Physics2D.OverlapCircle(movePoint.position + new Vector3(moveVertical, 0f, 0f), 0.4f, whatStopsMovement))
                {
                    Debug.Log("No collision");
                    movePoint.position += new Vector3(0f, moveVertical);
                }
                else
                {
                    Debug.Log("Collision");
                }
            }
        }
    }
}

Any help at all is appreciated.


texts: How to apply Data Oriented Design with Object Oriented Programming?

texts:
I've read lots of articles about Data Oriented Design (DOD) and I understand it but I can't design an Object Oriented Programming (OOP) system with DOD in mind, I think my OOP education is blocking me. How should I think to mix the two? The objective is to have a nice OOP interface while using DOD behind the scenes.

I saw this too but didn't help much: https://stackoverflow.com/questions/3872354/how-to-apply-dop-and-keep-a-nice-user-interface


texts: Determining desktop bounds by D3D9 adapter

texts:
I've got a Direct3D 9 application which normally runs full-screen. The user is able to select a display adapter to determine which screen it is shown on.

I also offer a Windowed mode which launches on the Primary display - but the user can move it if they wish.

I want to offer a Windowed maximised no border (slight performance hit but it avoids alt-tab issues). The problem is, since the user can't drag the window now, I need to make sure it opens on the appropriate display.

How can I determine the desktop bounds managed by a given adapter index?

Device = New Direct3D9.Device(D3D9,
             Settings.Display.Adapter, //Only applies if PresentParams.Windowed = False
             Direct3D9.DeviceType.Hardware,
             Window.Handle,
             Direct3D9.CreateFlags.HardwareVertexProcessing,
             PresentParams);


texts: Coroutine different behaviour when called from another script

texts:
I am quite new with game dev, specially with unity. In order to understand how it works, I decided to start small with a pong game.

I have a Ball script, which in the Update() method move the ball depending to the speed, and if a player score, it increment a score field and reset the ball to the center (and stop the ball for 2 seconds) trough a coroutine function.

Ball script:

public class Ball : MonoBehaviour
{
    [SerializeField]
    float speed;
    int isMoving = 1;
    float radius;
    Vector2 direction;
    Vector2 startPosition;

    // Start is called before the first frame update
    void Start()
    {
        direction = Vector2.one.normalized;
        radius = transform.localScale.x / 2; // half the width
        startPosition = new Vector2(transform.position.x, transform.position.y);
    }

    // Update is called once per frame
    void Update()
    {
        transform.Translate(direction * speed * isMoving * Time.deltaTime);

        if (transform.position.y < GameManager.bottomLeft.y + radius && direction.y < 0) {
            direction.y = -direction.y;
        }
        if (transform.position.y > GameManager.topRight.y - radius && direction.y > 0) {
            direction.y = -direction.y;
        }

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
            StartCoroutine( Reset() );
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
            StartCoroutine( Reset() );
        }
    }

    IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }
}

This works as expected! The score is incremented, the ball go back to the center, wait for 2 seconds and start to move again.
However, now I want to call the Ball Reset() method trough my GameManager (because I want to code some logics inside the GameManager).

So here are my modifications:

Ball script: (remove Reset() calls and update Reset() method to public)

public class Ball : MonoBehaviour
{
    ...

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

        // Ball go in any goal
        if (transform.position.x < GameManager.bottomLeft.x + radius && direction.x < 0) {
            GameManager.instance.addScorePlayer("p2");
        }
        if (transform.position.x > GameManager.topRight.x - radius && direction.x > 0) {
            GameManager.instance.addScorePlayer("p1");
        }
    }

    public IEnumerator Reset() {
        isMoving = 0;
        transform.position = startPosition;

        yield return new WaitForSeconds(2);

        isMoving = 1;
    }

GameManager script:

public class GameManager : MonoBehaviour
{

    public Ball ball;

    ...

    void Start()
    {
        ...

        // Create ball
        Instantiate (ball);

    }

    public void addScorePlayer(string player) {

        if (player == "p1") {
            score1 += 1;
            score1Text.text = score1.ToString();
        }
        else if (player == "p2") {
            score2 += 1;
            score2Text.text = score2.ToString();
        }

        StartCoroutine( ball.Reset() );
    }

This doesn't work for some reason. The ball don't come back to the center, and the score increment infinitely.

I have tried many things and I have figured out that the behaviour is the same as running the Reset() method trough the Ball script without the StartCoroutine.

So it seems that the Coroutine don't work properly if called trough the GameManager ?
I have also printed some logs into my console in the Ball.Reset() method, and the method is being called, so I don't understand why the ball don't go back to the center.

(Link to my public github repository https://github.com/Sewake/Unity2D-Pong)


texts: Enemy AI with Rigidbody - Floating in the air

texts:
I'm working on my enemy AI scripts and I'm using a rigidbody to have the enemies chase the player when the player gets into its aggro distance.

Two of the main problems I'm having:

When the game starts, all the enemies are floating in the air
Even when the player is outside the enemie's aggro distance, the enemy still chases the player

Code:

using UnityEngine;
using System.Collections;

public class EnemyAI : MonoBehaviour {
    public Transform target;
    public int moveSpeed;
    public int rotationSpeed;
    public int attackSpeed;
    public int maxDistance;
    public int aggroDistance;

    private Transform myTransform;
    public Rigidbody rb;
    private Vector3 dir;

    void Awake() {
        myTransform = transform;
        rb = GetComponent<Rigidbody>();
    }

    void Start () {
        character = GetComponent<CharacterController>();
        //Find playerS
        GameObject go = GameObject.FindGameObjectWithTag("Player");
        //Set player as target
        target = go.transform;

        maxDistance = 2;
        aggroDistance = 10;
    }

    void Update() {
        dir = target.position - rb.position;
        dir.Normalize();
        transform.rotation = Quaternion.Slerp(transform.rotation, Quaternion.LookRotation(dir), rotationSpeed * Time.deltaTime);

        if (Vector3.Distance(target.position, myTransform.position) < aggroDistance) {
            if (Vector3.Distance(target.position, myTransform.position) > maxDistance) {
                rb.MovePosition(transform.position + transform.forward * moveSpeed * Time.deltaTime);
            }
        }
    }

    void FixedUpdate () {
        rb.AddForce (dir * rotationSpeed);
    }
}

Enemy Properties:


texts: How to create a custom installer for my game for PC/Linux/Macs?

texts:
How can I create a custom installer that integrates a product key unlocking feature or tells the distributor that the customer was able to access the product like the BMT Mirco payment processor. Or possible how can I connect my BMT Micro management to unlock products to install them in a custom installer.

I want it to have an easy setup like Inno Setup or Clickteam Install Creator and incorporate customized head/side banner.


texts: How to change the player character size in monogame?

texts:
So I made a new project,
Loaded up the player sprite(16x16)
but the player is too small(as compared to the level)
How should I fix this?
Here the code which loads the sprites and the levels(I am using monogame extended)
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using MonoGame.Extended;
using MonoGame.Extended.Tiled;
using MonoGame.Extended.Tiled.Renderers;
using MonoGame.Extended.ViewportAdapters;

namespace Dungeon
{
    public class Game1 : Game
    {
        private GraphicsDeviceManager _graphics;
        private SpriteBatch _spriteBatch;
        private TiledMap map;
        private TiledMapRenderer mapRenderer;
        private OrthographicCamera cam;
        private Texture2D player;
        private Vector2 playerPos;
        private InputManager manager;
        public Game1()
        {
            _graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";
            IsMouseVisible = true;
        }

        protected override void Initialize()
        {
            // TODO: Add your initialization logic here
            manager = new InputManager();
            playerPos = new Vector2(0,0);
            mapRenderer = new TiledMapRenderer(GraphicsDevice);
            var viewportAdapter = new BoxingViewportAdapter(Window,GraphicsDevice,800,400);
            cam = new OrthographicCamera(viewportAdapter);
            base.Initialize();
        }

        protected override void LoadContent()
        {
            _spriteBatch = new SpriteBatch(GraphicsDevice);
            map = Content.Load<TiledMap>("Dungeon");
            mapRenderer.LoadMap(map);
            player = Content.Load<Texture2D>("player");
            // TODO: use this.Content to load your game content here
        }

        protected override void Update(GameTime gameTime)
        {

            if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape))
                Exit();
            mapRenderer.Update(gameTime);
            // TODO: Add your update logic here

            float move = 2;

                playerPos =manager.moveVertical(playerPos,move);
            playerPos = manager.moveHorizontal(playerPos,move);

            base.Update(gameTime);
        }

        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
            mapRenderer.Draw();
            var transformMatrix = cam.GetViewMatrix();

            _spriteBatch.Begin(transformMatrix:transformMatrix);
            _spriteBatch.Draw(player,playerPos,Color.White);
            _spriteBatch.End();
            // TODO: Add your drawing code here

            base.Draw(gameTime);
        }
    }
}

and the InputManager(You won't need it probably but just in case)
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Input;
using System;

public class InputManager
{
    Vector2 position;
    public InputManager()
    {
        position = new Vector2(0,0);
    }

    public Vector2 moveVertical(Vector2 pos,float move)
    {
        var keyboardState = Keyboard.GetState();
        if(keyboardState.IsKeyDown(Keys.D))
        {
            position.X += move;
        }
        if (keyboardState.IsKeyDown(Keys.A))
        {
            position.X -= move;
        }
        return position;
    }
    public Vector2 moveHorizontal(Vector2 pos, float move)
    {
        var keyboardState = Keyboard.GetState();
        if (keyboardState.IsKeyDown(Keys.S))
        {
            position.Y += move;
        }
        if (keyboardState.IsKeyDown(Keys.W))
        {
            position.Y -= move;
        }
        return position;
    }
}


texts: Unity: Is there a way to edit a Skin file?

texts:
My project has multiple skins and sometimes we have to deal with skins with many custom styles. Editing them in the editor is difficult, for instance, I cannot delete one style that is not the last one without deleting the ones after it.

Would there be a way to edit a file that represents this skin?

Could I edit a skin file if I use Text in the Asset Serialization Mode (Unity Pro)?

If not, is there something in the Unity Store to help me better edit skins?


texts:
I have different Shaders and for each Shader a instance of the ShaderClass class, which initializes the Shaders, Renders the Shaders, etc.

I use most of the Shaderclasses without Geometry Shader, but in one Shader Class i also use a Geometry Shader.

The problem is, that when I render one object with the Shaderclass that uses the Geometry shader, all other object are rendered with the same geometry that I create in the Geometry Shader.  Can you help me?

Is it possible that I have to use a Geometry Shader for each object, when I use one for one object?

I use DirectX 11 with C++.


texts:
I am trying to get a donut-shaped mask in Phaser (essentially the inverse of a regular mask). The mask shape is dynamic so it needs to be a Phaser.Graphics polygon object.

Desired result:

The blue shape is the sprite I want to mask, the hole in it is the mask itself.

I've searched the Phaser and Pixi v2 documentation and forums - found nothing though. Anybody who knows how I can do this?

If it is not possible, I am thinking of dividing the mask up into eight polygons:

How sound is that idea? Is that going to be expensive or would it be ok? Or any other ways to achieve this?


texts: Creating random nebulae for scrolling space background

texts:
If you've ever seen a picture of space, you'll most likely see that there is some kind of pretty nebula in the background. I would like to find out how I could create random, semi-realistic looking nebula, so my current background (gif below) looks less boring. The reason I want it to be random is because it wouldn't make much sense for the same nebula to appear over and over again. I've heard that shaders might be what I'm looking for, but I've never even touched a shader, so I wouldn't know.

What I currently have:


texts:
How can I modify the GUI of a default Unity window?
E.g. I am trying to modify the Animation window. Here is what I am trying to do for the beginning:
using UnityEditor;
using UnityEngine;

[CustomEditor(typeof(Animation))]
public class AnimationExtended : Editor
{
    public override void OnInspectorGUI()
    {

    }
}

I would expect the code above to hide the content of the Animation window completely, but it does not. Why?
Here is what I mean by the Animation window.

Question which made me want to add a custom feature to the Animation tab.


texts: Unity. Input in function for UI button OnClick

texts:
I am trying to create multiple selections for some items on my UI. To perform multiple selections of items I want a user to hold left control button. But then I add

if (Input.GetKeyDown(KeyCode.LeftControl)){
/* Logic */
}

It registers in debugger what LeftControl is pressed but it skips all logic in brackets. This function is public and created for UI button.
Is Input and Button.OnClick compatible at all?


texts:
I'm trying to play background music and the music keeps on starting. I tried to use music.busy, but I can't figure it out. I want it to check if sound/music is playing, then I want it to print "music is playing". If a sound/music isn't playing I want it to start up a new song and loop it.

def musica():
    if pygame.mixer.music.get_busy() == True:
        print("music is playing")
    if pygame.mixer.music.get_busy() == False:
        music.play(loops=-1)


texts: How do I find the parametric UV and du and dv of a primitive on a sphere ? Assuming that is all the information you have on the sphere. I want to find the partial derivatives for a primitive if I the only value I supply is either X,Y,Z ?


texts: Farseer: Shooting a ball in a certain angle?

texts: How can I shoot a ball in a certain angle? When I press the Space key, the ball should be shot in a 45 degree angle. How can I do that?


texts: Why would you use a negative value for Bounding Box?

texts:
I have the following code I'm working with in XNA from the book Professional XNA Programming.

It's just pong on a 2d screen plane.  We use bounding boxes for collision detection.  I'm just having trouble understanding why we would use a negative paddle size for the RedPaddleBox.  I read bounding boxes define the minimum and maximum corners of the box, but I'm not sure what that means--minimum in terms of coordinate values?  If so, why use a negative value when the paddle isn't partly off screen?

This is the code line that gave me trouble:

            new Vector3(-paddleSize.X/2,

in context of:

        BoundingBox leftPaddleBox = new BoundingBox(
            new Vector3(-paddleSize.X/2,
                leftPaddlePosition-paddleSize.Y/2, 0),
            new Vector3(+paddleSize.X/2,
                leftPaddlePosition+paddleSize.Y/2, 0));

in the following code:

        // Check for collisions with the paddles.
        // Construct bounding boxes to use the intersection helper method.
        Vector2 ballSize = new Vector2(
            GameBallRect.Width / 1024.0f, GameBallRect.Height / 768.0f);
        BoundingBox ballBox = new BoundingBox(
            new Vector3(ballPosition.X - ballSize.X / 2,
                ballPosition.Y - ballSize.Y / 2, 0),
            new Vector3(ballPosition.X + ballSize.X / 2,
                ballPosition.Y + ballSize.Y / 2, 0));
        Vector2 paddleSize = new Vector2(
            GameRedPaddleRect.Width / 1024.0f,
            GameRedPaddleRect.Height / 768.0f);
        BoundingBox leftPaddleBox = new BoundingBox(
            new Vector3(-paddleSize.X/2,
                leftPaddlePosition-paddleSize.Y/2, 0),
            new Vector3(+paddleSize.X/2,
                leftPaddlePosition+paddleSize.Y/2, 0));
        BoundingBox rightPaddleBox = new BoundingBox(
            new Vector3(1-paddleSize.X/2,
                rightPaddlePosition+paddleSize.Y/2, 0),
            new Vector3(1+paddleSize.X/2,
                rightPaddlePosition+ paddleSize.Y/2,0));


texts: changing camera's reference point position by a keyboard event

texts:
I would like to change the camera's reference point position using gluLookAt. I would like that it changes when I press for exemle 'a'. I tried with:

void VueOpenGL::Paint(wxPaintEvent&){
SetCurrent();

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(65.0, 4.0/3.0, 1.0, 1000.0);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
gluLookAt(100, 0.0, 0.0,
           X,   Y,  0.0,
           0.0, 0.0, 1.0 );

}

void VueOpenGL::OnKeyChar(wxKeyEvent& event)
{
   switch (event.GetKeyCode() ){
       case 97:
             X=coordinatesX_obj;
             Y=coordinatesY_obj;
         break;
    }
 }

Everything is ok with the constructor of the class VueOpenGL. Despate that nothing happend when I press 'a'. Do I make something wrong?


texts: LibGDX Shader that converts sprite to single colour with blurred edges

texts:
I made a shader which turns all the colours of the texture to black but I also want it to be blurred at the edges where the opaque sprite turns transparent.
Original texture with desired output.

#ifdef GL_ES
    precision mediump float;
#endif

varying vec4 v_color;
varying vec2 v_texCoords;

uniform sampler2D u_texture;

void main() {
  vec4 c = v_color * texture2D(u_texture, v_texCoords);
  gl_FragColor = vec4(0,0,0, c.a);
}

A simple gaussian blur with good performance is what I want.
This shadertoy shader looks ideal: https://www.shadertoy.com/view/Xltfzj
I managed to convert the above mentioned shadertoy to GLSL which works fine, but I don't know how to make it first turn the texture black before blurring.
#ifdef GL_ES
    #define PRECISION mediump
    precision PRECISION float;
    precision PRECISION int;
#endif

varying vec4 v_color;
varying vec2 v_texCoords;

uniform sampler2D u_texture;
uniform vec2 resolution;

void main() {
    float Pi = 6.28318530718; // Pi*2

    // GAUSSIAN BLUR SETTINGS {{{
    float Directions = 16.0; // BLUR DIRECTIONS (Default 16.0 - More is better but slower)
    float Quality = 4.0; // BLUR QUALITY (Default 4.0 - More is better but slower)
    float Size = 8.0; // BLUR SIZE (Radius)
    // GAUSSIAN BLUR SETTINGS }}}

    vec2 Radius = Size / resolution.xy;

    // Normalized pixel coordinates (from 0 to 1)
    vec2 uv = v_texCoords;
    // Pixel colour
    vec4 Color = texture2D(u_texture, uv);

    // Blur calculations
    for( float d=0.0; d<Pi; d+=Pi/Directions) {
        for(float i=1.0/Quality; i<=1.0; i+=1.0/Quality) {
            Color += texture2D( u_texture, uv+vec2(cos(d),sin(d))*Radius*i);
        }
    }

    // Output to screen
    Color /= Quality * Directions - 15.0;
    gl_FragColor =  Color;
}


texts: Unity - SetActive() on GameObject dont works on child's objects

texts:
I have the following line of code:

GameObject.Find("_obstacles").SetActive(false);

It serves to leave an inactive object, but the children of this object are not getting with the same status.

My result is:

  The objects children do not inherit the parent object state (as stated in the > documentation of Unity)!

But the obsolete method "SetActiveRecursively()" works for me! O.o The Very strange, no?


texts: Fastest way to find closest triangle of mesh from specified point

texts:
I have two triangle meshes (let me call them A and B). The meshes may be really big (10.000 - 100.000 polygons). I want to find for every point in A the closest triangle from mesh B.

Is there a fast way to do it? Does a near real time solution exist?

I found several papers that describe ways to find distance from a point to a triangle and I know a little bit about kd-tree/bvh-tree. Hence I may be able to find several triangles that are close enough to the specified point and then I can find triangle by brute force.

But I guess that this method will be not fast enough.


texts: How can I approximate walking physics via simpler sliding physics?

texts:
I am modeling walking insects.  I implement them as cuboids and use forces (including friction and drag), to control motion.  However, the movement characteristics of this 'sliding box' physics don't match those due to a legged creature.

For example, legged creatures near-instantly accelerate to their top speed; whereas applying a force to a box takes time to accelerate it.

The applied force can be increased along with the counteracting drag, giving much quicker acceleration (via force) to a max speed (via drag).  However, this also means the force that creatures can exert when pushing on other objects is increased.

Does anyone know of any techniques using a physics engine to cheaply model walking creatures?


texts:
In the Sims 4, you can drag to reshape the face and body when you create a sim. You can see a similar system implemented in this Body Visualizer.

How can I implement similar geometry morphing in my game?

Related: What are some ways to implement variable body shapes?


texts: Making dialog "clips" in libGDX or in general?

texts:
I'm new to libGDX (I just released my first game), and I've started thinking about things I'd like to do next time. One thing I really want to do is, have those story type movies, where you tap the screen to advance the dialog. I'm specifically thinking of Pokemon Mystery Dungeon. A small action happens, and then the user has to tap the screen after reading what happened to move on.

My question is how can I do this? I've done a lot of research, but I can't seem to find out how to approach this. I have this vague idea where I create a different GameState using enum types in which the gameplay is modified but I don't know if there is a better way.


texts:
I'm new to game development. I was thinking of different ways to create a game. I discovered Unity3d as much preferred indie game engine and yet so powerful. Then I read about game mods, which I found pretty exciting too. So, I now have two questions.

Are Mod creation Software/SDKs developed by the same company which made the original game? Are there any custom made (recent) mod sdk? Is it even possible to make one like that?
Is it possible to port a model from one mod sdk (say, Halflife) to another mod sdk (say, Skyrim)?


texts: A script isn't showing in the Content Browser

texts:
Just to set the tone, I'm very new to game development.

I'm currently taking an online video course for Unreal Engine 4 that required me to create a C++ script. After I created the script and it compiled it did not appear in the Content Browser where it should be. I received the following text boxes:

and


texts:
Am I doing it right? I converted this.

m_ViewMatrix = XMMatrixLookAtLH(XMLoadFloat3(&m_Position), lookAtVector, upVector);

to this one.

XMVECTOR vz = XMVector3Normalize( lookAtVector - XMLoadFloat3(&m_Position) );
XMVECTOR vx = XMVector3Normalize( XMVector3Cross( upVector, vz ) );
XMVECTOR vy = XMVector3Cross( vz, vx );

m_ViewMatrix.r[0] = vx;
m_ViewMatrix.r[1] = vy;
m_ViewMatrix.r[2] = vz;
m_ViewMatrix.r[3] = XMLoadFloat3(&m_Position);

m_ViewMatrix.r[0].m128_f32[3] = 0.0f;
m_ViewMatrix.r[1].m128_f32[3] = 0.0f;
m_ViewMatrix.r[2].m128_f32[3] = 0.0f;
m_ViewMatrix.r[3].m128_f32[3] = 1.0f;

m_ViewMatrix = XMMatrixInverse( &XMMatrixDeterminant(m_ViewMatrix), m_ViewMatrix );

Everything looks fine when I run it. Another question is, I saw on this site(http://webglfactory.blogspot.com/2011/06/how-to-create-view-matrix.html) that he subtracted lookat from position in his vector vz. I tried it but gave me wrong view matrix. Can anyone check my code. I'm studying linear algebra right now. Sucks my course doesn't have one.

Thank you,
Balls


texts: What features do basic particle engines have?

texts: I created a basic particle system for SDL in C++. It has some basic stuff like an emitter, as well as a simple particle class. It can load a image, or create a dot of a color. And that's it. What other features do most simple particle engines have? Keep in mind this is a 2D particle engine.


texts: Smallest increment for a SpriteBatch depth between 0.0 and 1.0?

texts:
I experienced some problems with SpriteBatch in XNA when I tried to mix two different SpriteSort modes. (Begin with deferred, end, begin with BackToFront wasn't sorting properly.) I've settled on just giving everything I draw with SpriteBatch a depth value.

To that end, what is the smallest increment I can use on the floating point variable that will be used as the depth parameter without running into rounding problems? The valid values for this float are between 0.0 and 1.0. It is a float, not a double, and the language is C#.

UPDATE:
My testing has shown that 0.008f is the smallest amount I can change my depth value by and be certain the sorting will work. I'm guessing there is something else at play in BasicEffect or SpriteBatch.

What I am trying to use this for is the rendering of my game's map grid. I want to make heavy use of transparency and overlapping to create a specific visual look for the tiles, the doodads, and the characters.

Essentially, I am using a painter's algorithm to draw the tiles in order from the back row to the front. I have them numbered so I know the ordering is correct. The doodads I am trying to draw on top of the map are not appearing when my depth decrementor is set to a low enough number to draw everything I will need. It only works properly in a range where I can only access about 100 unique depths.

UPDATE about SpriteSortMode problems (as requested):

Thus far in my project I have got by just fine using SpriteSortMode.Deferred for everything. I have all of the standard UI components you would expect, windowing, clipping, etc. working.

Now I am attempting to draw my map grid. Like windowing/clipping this requires things to be done in a specific order to look right. The grid tiles draw in a certain order. To accommodate overlapping, doodads/characters draw on top of a tile before the next tile is drawn.

No matter what I did, my doodads/characters would always be drawn under the tiles. Changing the order of draws had no impact. Even drawing all of the tiles and then drawing the doodads resulted in them showing up underneath the tiles. Especially odd was that my UI elements continued to appear above the problem tiles as I scrolled around the map.

I switched to SpriteSortMode.BackToFront and with a high enough depth difference (~0.01) I see things drawing on the grid as expected, but this depth difference is way too high to support every visible tile of the map. I am searching for a better solution than to write code that will End and Begin a new SpriteBatch every time ~100 pieces are drawn.


texts: Ogre3D particle effect causing error on iPhone

texts:
1) First I have added the Particle Folder from the Ogre SDK (contains Smoke.particle).

2) Added the Smoke.material And smoke.png and smokecolors.ong.

3) After this I added the Plugin = Plugin_ParticleFX in the plugins.cfg.

Here is my code:

#Defines plugins to load

# Define plugin folder
PluginFolder=./

# Define plugins
Plugin=RenderSystem_GL
Plugin=Plugin_ParticleFX

4) I have added the particle path in the resources.cfg (adding the particle file in this causes the crash):

#Resource locations to be added to the 'bootstrap' path
# This also contains the minimum you need to use the Ogre example framework
[Bootstrap]
Zip=media/packs/SdkTrays.zip

# Resource locations to be added to the default path
[General]
FileSystem=media/models
FileSystem=media/particle
FileSystem=media/materials/scripts
FileSystem=media/materials/textures
FileSystem=media/RTShaderLib
FileSystem=media/RTShaderLib/materials

Zip=media/packs/cubemap.zip
Zip=media/packs/cubemapsJS.zip
Zip=media/packs/skybox.zip

6) Finally I did all the settings, my code is here:

mPivotNode = OgreFramework::getSingletonPtr()->m_pSceneMgr->getRootSceneNode()->createChildSceneNode();  // create a pivot node

// create a child node and attach an ogre head and some smoke to it
Ogre::SceneNode* headNode = mPivotNode->createChildSceneNode(Ogre::Vector3(100, 0, 0));
headNode->attachObject(OgreFramework::getSingletonPtr()->m_pSceneMgr->createEntity("Head", "ogrehead.mesh"));
headNode->attachObject(OgreFramework::getSingletonPtr()->m_pSceneMgr->createParticleSystem("Smoke", "Examples/Smoke"));

7) I run this and got the error below:

An exception has occurred: OGRE EXCEPTION(2:InvalidParametersException): Cannot find requested emitter type. in ParticleSystemManager::_createEmitter at /Users/davidrogers/Documents/Ogre/ogre-v1-7/OgreMain/src/OgreParticleSystemManager.cpp (line 353)

8) Getting crash at:

(void)renderOneFrame:(id)sender
{
    if(!OgreFramework::getSingletonPtr()->isOgreToBeShutDown() &&
       Ogre::Root::getSingletonPtr() && Ogre::Root::getSingleton().isInitialised())
    {
      if(OgreFramework::getSingletonPtr()->m_pRenderWnd->isActive())
      {
         mStartTime = OgreFramework::getSingletonPtr()->m_pTimer->getMillisecondsCPU();
//( getting crash here)

Does anyone know what could be causing this?


texts:
I have a basic snake game movement system with Pygame:
clock = pygame.time.Clock()
if timer == MOVE_TICK_INTERVAL:
    timer = 0
    move_snake()

timer += 1
clock.tick(MAX_FPS)

The issue is that the higher MAX_FPS is, the faster timer iterates and thus the faster the snake moves. I'm aware of using some form of delta_time variable to calibrate and adjust the velocity of an object moving continuously but I don't know how to implement this method with discrete, grid-based movement.
In short,
I want to move my snake the same amount of units in a direction every interval with frame rate considered but I don't want to modify said distance.


texts: LibGDX: Is there a maximum amount of vertices for a PolygonShape?

texts: When you use PolygonShape.set(Vector2[] vertices), is there a limit of vertices of the array which is passed to the method?


texts:
How would one create a map for gaming using Google street view? Are there any programs for doing this? The cars, people and objects could be edited out and replaced with digital copies if the same objects for that area. Originally I was thinking GTA Local but would require a much more work.

3D game with Pre-rendered background

https://law.stackexchange.com/questions/37810/do-objects-in-the-public-view-need-licencing


texts: Game Maker Studio 2: Why is my variable not being properly changed?

texts:
Ok, so in my game you have a party of four characters that you control one at a time, each of which can lose health and die independently of each other. All of the player character objects use essentially the exact same code controlling their "deaths", (just with their own object variables and flags that get set and triggered etc.), but for whatever reason identical code does not produce identical results for all of the characters.

In particular, one of the character classes, the Alchemist, absolutely refuses to either set their "dead" flag to True properly, or at the very least the sections of code that are dependent upon "dead" being true do not appear to be acknowledging that it is. I've gone over all its events several times and monitored its behaviors in-game very closely, and everything about its malfunctioning behavior can be traced to the fact that it's completely ignoring the "dead = true;" line in one of its events while still executing the remaining code that follows it. Absolutely nothing else in any of its events sets or modifies this variable outside of its initialization in the Create event; it's just this one line of code that works perfectly for every other character object refuses to do its one job for this object in particular, and everything is falling apart because of it.

Does anyone know why this might be happening? Is there some quirk of proper GML practice that I'm not using?

If it helps, here's the code that gets triggered when a character is made "dead"

else if(wounded and position == 0 and !dead)
{
    dead = true;
    instance_create_layer(x,y,layer,obj_alchemist_corpse);
    death_sort();
}

Everything else is just a series of If statements that are triggered by 'dead' being true, but again, it would appear that one object in particular is executing the code in the above statement without actually setting 'dead' to true, and I would like to know why or why not.

EDIT: Forget what I said about an alchemist; further testing indicates it's just the second character in your party line of four that isn't getting their flag properly set.


texts: Drawing object lines in the Tiled map editor

texts:
Suppose I have this picture:

I have a map like this created in Tiled already. I would like to draw collision lines (the green ones in the picture) without having to make it a polygon. As far as I know, Tiled does not support drawing a line as a collision object, so I would appreciate ideas on how to make this work.

I also tried drawing a quadrilateral and calculating the diagonal in code (LibGDX), but that's a bit clunky and can go wrong easily.


texts: Does the gender of a game's protagonist affect sales?

texts:
Most protagonists of games are male. I imagine the conventional wisdom is that this is because

We live in a patriarchal society, especially when it comes to game development, and
The target demographic is predominantly male.

I once heard that for fiction, females are more able to empathise with a male character, than males are with a female character. So the great imbalance in gender in fiction is not necessarily due to patriarchy, but that it just makes sense from a financial point of view. I'm not sure if I subscribe to that, but it is interesting.

And there was a time when gaming was for super hardcore nerdy males, but now almost everybody has a games machine, and it is not a stigma to like games as it once was, I don't know if it is such a male domain any more.

So leaving aside any question of whether we should try to reduce gender stereotypes,
my question is, does having a female protagonist actually affect sales, in particular, for small indie games? Are there any experiments, statistics or research relating to this question? What is the actual demographic breakdown of gamers these days?

I realise this is an inflammatory subject, so I will stress here that I am not looking for opinions:

I am looking for hard facts and data.


texts: Is flash game development not considered 'proper' game development?

texts:
I've come across this a couple of times. That flash game development is not 'proper' game development when compared to XNA or even Unity. Mentioned here:
Need guidelines for studying Game Development

Also here in some comments : Where to start with game development?

This judgement also befalls java, according to some. Is it because in flash its so easy to draw graphics and to import and add on to the stage any element we want and also because flash needs a 'container program' to run and others don't?

But flash is by far way easier to 'distribute' than any other of those mentioned above. Maybe except for iphone or android games.


texts:
For the code in my test project,  I want to find 2D[,] array shape on the char[][] list. I created an actual map with 'char[][]' array.
So, how can I find a tileChar's shape on the worldChar array?

How to do this in Java, C#, JavaScript, pseudo-code, algorithm or etc.?

For Example;

List<string> mainShape = GetRandomShape().Split('#').ToList();
char[][] tileChar = mainShape .Select(a => a.ToArray()).ToArray();
char[][] worldChar = GenerateRandomWorld();

Example Image:

'*' -> NOT NULL

'-' -> NULL


texts: What approaches are there to blending multiple terrain types?

texts:
So for my university final assignment I'm doing a procedural world generator in unity. The idea is that different types of terrain are generated such as ocean, swamp, hills etc. I have the different biomes generating as chunks with different colours at the moment and the next step for me is to smoothly transition between them rather than drop off from one terrain type to another.
To do this I'm going to need to adjust the heightmap so that the edges join together rather than having gaps between them. The noise is continuous so biomes of the same type connect seamlessly. However with different biomes the height generated from any given noise is different, that way my mountains stick up without my ocean chunks being weird shapes. The result is like I said earlier, there are seams between my chunks that I need to stitch.
So my real question is what approaches are there currently to blend from one height map to another?


texts: Cocos2dx - Create the friction of the ground

texts:
I'm writing a game, it a pool game.
I've read about cocos2dx + physics library, however the document is really poor to understand.

Material has 3 attributes (http://www.cocos2d-x.org/wiki/Physics#) :
- Density (?)
- Friction (?)
- Restitution (scale from 0 to 1)

Execept the restitution has limitation value from 0 to 1. I don't know what's density and the limitation of friction value?

If i want to create a ball and when it collide to the bound/wall, it bounce back, and the ground has friction to slow down the ball during running, how can i do it?


texts: Unity 3d texture animated round circular bar

texts:
I'm struggling to create a circular bar with an animated texture and a round cap end. What I would like to create is implemented in the Unity game Subnautica - the bottom left bar. So here is the HUD from the game. The problem is that I don't know how to animate texture with the round end. I can fake it with basic colors but I need it to have animated texture.It is possible to make this using shader because i hadn't tried that.
Or are there maybe some assets in the store?


texts: OOP implementation of BUFFS and Stats. Suggestion

texts:
I am developing an MMORPG server using NodeJS.

I am not sure how to implement Buffs, i mean, equipped objects or used skills have effects on the Player() which has many Stats(), some of them have a max cap...

Effects can change the Stat value, increasing or decreasing it by a value, a percentage or completly rewrite the value of the stat.

After a while I have decided to create a base class for buffs, which can be hidden (if they are casted from an equipped object) or shown if they came from an ability (Spell).

Anyway I need suggestion how to implement it, use an array for all active buffs for a stat and have a function calculate the value of the stat affected by buffs each time I need the value of the stat or...? Other more OOP's ways to do it?

I have read this What's a way to implement a flexible buff/debuff system? but this implements only a percentage system, which buffs can only say "+10%, +20%, etc...", but I would love to have an hybrid system, which can have percentage values or static values (like WoW does), and using modifiers it's hard to implement, because modifiers refers to the current value of stat :/

Thanks for suggestions :)


texts: How do I make parts of a texture transparent in Max?

texts:
I am applying an eye.psd eye-texture to my character model's face, but the results aren't what I'm expecting.

Here's what it looks like (Observe the eye on the right. Ignore the other one.):

The image is attached to a quad. I want to either

change the color of the blank area to the skin color, as it is nearby, or
make the image be the shape of the eye instead of square?

As shown, my image is a square and parts of it show as white, even though I erased them in Photoshop:

I expected this area to be skin-coloured:

How can I make this work right?


texts: Can I export animated models from Unity? Into what formats?

texts:
I have an animated 3D model from the Unity Asset Store that I would like a new animator to touch up (the license allows this). But they need it in a format they can use (in Maya or... something else?). All I have been able to find so far is:

how to export from the Editor into Unity Package format
scripts to export the mesh (only?) into OBJ format [1]

Is it possible to export a textured and rigged model from Unity? If so, into what formats and how?

[1] ObjExporter and ExportOBJ


texts: TouchPanel.GetState() Returns wrong touch locations XNA

texts:
I am trying to make my Desktop game playable on IOS. I have a Button.cs class, which has this code in it:

   public bool IsPressed(TouchCollection touches)
    {
        for (int i = 0; i < touches.Count; i++)
        {
            if (TouchTriggerRect.Contains(touches[i].Position.X, touches[i].Position.Y))
            {
                return true;
            }
        }

        return false;
    }

Where TouchTriggerRect is a rectangle describing the button coordinates on the screen

I have noticed that the IsPressed method only works on some buttons (specifically, on all the buttons on the left side of the screen in Landscape orientation)

After some debugging, I understood that the IsPressed method doesn't work on the buttons placed on the right side of the screen because touches made there are getting offset by some random X and Y

Any suggestions on how to fix this bug? Or what can be causing this problem?

P.S I am using a Monogame.Extended.Camera2D in my game

P.S.S I have tried to build a simpler app, which draws red circles at all the touch locations it receives, and it workes perfectly. So, the problem is not in my devices

P.S.S.S This is how I get my touch Input: touches = TouchPanel.GetState();

UPD:

This is the code I use for my transformations:

var bounds = camera.BoundingRectangle;

Vector2 pos;

//The button is basically a rectangle, so I give it an X, a Y, a Width and a Height
JumpButton = new Button(bounds.Right - 80, bounds.Bottom - 74, 64, 64);
pos = camera.WorldToScreen(JumpButton.X, JumpButton.Y);
JumpButton.ScreenX = pos.X;
JumpButton.ScreenY = pos.Y;
//Same for all the other buttons

And this is the code for TouchTriggerRect

public Rectangle TouchTriggerRect => new Rectangle((int)ScreenX, (int)ScreenY, Width, Height);


texts: Can a standalone WPF application create an interface that looks like a Flash interface?

texts: It seems like WPF was created as the application answer to Adobe's Flash.  Silverlight is used for creating web pages.  But, can that same functionality be pulled into a standalone WPF application.  Scaleform allows Flash to be used within unmanaged C++ games.  Can WPF be used to create the same type of interfaces?  What I've read seems to make me believe it can.  But, I haven't seen any sheetshots of applications that show this kind of interface.


texts: How to make ghosts AI chase Pac-Man in Java

texts: I'm beginner at Java and I want to make ghosts chase Pac-Man in game. I read some algorithm like A* or Dijkstra but I don't know how to implement them in my game. Please help me.


texts:
I'm developing a multi-player car game.
Suppose that car A hit car B: both A and B have Rigidbody and collision functions attached.
Because car A hit car B i want to take actions only to car A (add or remove point) but not to B.
So i need to identify that car A is 'hit' (with guilty ) car B that has no 'guilty'.
Can you suggest me how to do ?


texts: Make platform's visibility distinct from background

texts:
I have a 2d infinite runner type game which background is changing its colors constantly. Meanwhile the color of the platforms stays the same. This way the platforms at some point(when their color is the same as the background's) become "invisible" for the player.

How can I creatively, shortly and conviniently avoid this problem with unity?

P.S. I've tried adding glossy material to it but it didn't work.


texts: Quaternion.LookRotation() not rotating 360 degrees

texts:
In my scene I have two cubes one has a tag "Respawn" and another one has the following script attached:

using UnityEngine;
using System.Collections;

public class NewBehaviourScript : MonoBehaviour {

    void Update () {
        transform.rotation = Quaternion.LookRotation (
            GameObject.FindGameObjectWithTag("Respawn").transform.position
        );
    }
}

When I run it and move around my second cube with "Respawn" tag the first cube doesn't always looks at it, at certain point it just starts rotating the opposite side as if it has bounds to it's rotation. What am I doing wrong?


texts: What is the difference between AR, VR and MR?

texts: Please explain clearly and in short about the differences and boundaries between AR, VR & MR.


texts: Crusader Kings 2: How to extract character religion from saved game?

texts:
I am trying to parse and interpret the Crusader Kings 2 save file. I run into problem when trying to extract character religion.
3185293=
{
    bn="Umar"
    b_d="1543.12.21"
    fat=3160797
    mot=3160268
    att={7 3 4 3 3}
    tr={195 }
    rel="norse_pagan_reformed"
    cul="andalusian_arabic"
    dnt=1000128972
    dna="xvfudvhjgxg"
    prp="ojcf0k00000000000000000000000000000000"
    fer=0.400
    health=5.100
    # ... shortened ...
}

In many cases, trait rel is missing. In the documentation, I found reference that the trait does not appear if government make it unnecessary. Can you please advise how exactly to extract character religion if the trait is missing?


texts: Strange behavior b/w Nav Mesh Agent and Trigger Collider

texts:
I'm running into an issue where my click to move character has problems navigating when in an enemy's detection trigger collider. Specifically, whenever my character is inside the trigger collider, there seems to be "inertia" or refusal to navigate properly. Movement is ordinarily very responsive because of how I have the Nav Mesh Agent component set up. When I'm in the trigger, something seems to be wrong with the pathfinding, but I can still force myself to get out.

I have a very basic click to move player movement script.

    public class PlayerMovement : MonoBehaviour
    {
        private NavMeshAgent navMeshAgent;

        void Start()
        {
            navMeshAgent = GetComponent<NavMeshAgent>();
        }

        void FixedUpdate()
        {
            if (Input.GetMouseButton(0))
            {
                Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
                RaycastHit hit;

                if (Physics.Raycast(ray, out hit))
                {
                    navMeshAgent.destination = hit.point;
                }
            }
        }
    }

I also have a very standard enemy detection script attached to an empty game object which is a child of the enemy. I've done it this way so my enemy object itself doesn't have a bunch of colliders.

public class EnemyDetection : MonoBehaviour
{
    private GameObject player;

    public bool playerDetected;

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

    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject == player)
        {
            playerDetected = true;
        }
    }

    void OnTriggerExit(Collider other)
    {
        if (other.gameObject == player)
        {
            playerDetected = false;
        }
    }
}

Finally, I have an enemy movement script attached to the enemy object which handles the actual nav mesh destination setting.

public class EnemyMovement : MonoBehaviour
{
    private GameObject detectionTrigger;
    private EnemyDetection enemyDetection;

    private NavMeshAgent navMeshAgent;
    private GameObject player;

    void Start()
    {
        detectionTrigger = transform.Find("Detection Trigger").gameObject;
        enemyDetection = detectionTrigger.GetComponent<EnemyDetection>();

        navMeshAgent = GetComponent<NavMeshAgent>();
        player = GameObject.FindGameObjectWithTag("Player");
    }

    void Update()
    {
        if (enemyDetection.playerDetected)
        {
            navMeshAgent.SetDestination(player.transform.position);
        }
    }
}


texts:
"Reverse Season Pass" is a name I just made up and I want to know if something like this already exists with a better name.

We all know regular season passes: you buy a pass for a game you already paid for, which gives you access to future dlc, which doesn't exist yet, and may or may not be worth the money. AAA publishers love those things and they're pretty BS for the customer, because they are expected to pay for something that doesn't exist yet, or may never exist, or may not even be worth the money. You just have to trust them with your money, and there's no guarantee the base game hasn't been already sliced up into future dlc prior release.

Now lets say you have a story-driven game you want to release in episodes, like I want to do. The game itself is already completely done, all episodes are ready, you just want to pace the content over a few weeks like a show on tv to create discussion and excitement in the fandom for each new episode. The episodes would be added to the base game, meaning the episodes aren't sold separatly, you want to sell the whole experience.

However, if you're like me and you're still a nobody in the gaming industry, charging full price for a game, that's supposedly done (you can't know for sure, right?), which is going to be released in pieces supposedly, seems... very shady. I wouldn't blame anyone if they found that suspicious.

Lets say your game as a whole is worth 30$ and you have five episodes, so 6$ per episode. What I thought of doing, which I think is pretty fair, is to adjust the price depending on how many episodes are already released. When the first episode is released, the game costs 6$. When the second episode is released, the game costs 12$, then 18$ with three episodes, 24$ with four episodes, and at last, 30$ for the full game with all five episodes.

On top of that, when people buy the game early, when only one or two episodes are available for example, they already essentially bought a season pass on top of the game and will receive all other episodes for free. That way, people pay for the game only what it's currently worth and early adopters are rewarded for their early purchase and show of trust.

Has anyone ever done something similair? Is there a name for it?


texts: How do I manually submit a new UI InputField in code?

texts:
I need some conditions for submitting the text inside of an Inputfield, however I cannot find a way to do this via code. I was expecting something simple like with WPF or WinForms, but I cannot find any method I can use to actually submit an Inputfield via code.

How can I submit an Inputfield through code so that I can add some sort of conditions to when it can be submitted by the user other than just the enter button.

Thanks!

Edit, some clarification:

Submitting an input field is submitting it's text, firing an event which can be listened to by the OnSubmit method which then fires an onEndEdit event (I think event) which you can add listeners to so that specific methods of your own get called when it fires.

Right now I am unable to identify a reasonable way to change the keys or combination of keys that control when the form is submitted (Default ie "Enter" or "Return" in the Input Manager) (Can't use Shift-Enter for a new line since enter submits the form). Instead I want to manually submit the form through code when the appropriate keys are pressed.

public class ChatInputField : MonoBehaviour
{
    public InputField textInput;

    public void Start()
    {
        textInput.onValueChange.AddListener(delegate { CheckForSubmit(); });
    }

    //Checks for an enter to submit
    public void CheckForSubmit()
    {
        //No idea how to get the actual value changed from this event so I have to check for keys being held down. Terribly awkward
        if (Input.GetKey(KeyCode.Return) || Input.GetKey(KeyCode.KeypadEnter))
        {
            if(Input.GetKey(KeyCode.LeftShift) || Input.GetKey(KeyCode.RightShift))
            {
               //Add a new line
            }
            else
            {
                if(textInput.text != "")
                {
                    //Submit form if not empty
                }
            }
        }
    }

Edit2: I just realized that I can manually edit the attributes I want. I can send it's text to the appropriate class, clear the input field, and de-select it if I wanted. No need to fire the event other than for ease-of-use within the inspector. Sorry for wasting you guy's time :)

I'll leave this question open in case someone does figure out how to fire these events manually though.


texts:
I am going to use Cocos2d-x to make a game for Android and ios, but my question is, do I use the Lua integration or only c++, I see Lua useful here because the compilation thing.

Or do I use only Lua for the configuration, save data and things in runtime?

I don´t know if using Lua for the whole game is the right thing :/

Can anyone help me with this question and why use it or not?

Thanks


texts: CCActionMoveBy doesnot working properly when the action called for many of the sprite in cocos2d

texts:
I have an issue with CCActionMoveBy when I call the movement action for many of my sprites. I need to move to a certain position and then remove it from the scene.

My problem is If the call the action for one or two positions its working fine, but when I call this action for more than 5 positions, the sprite doesn't move to the correct position.

My Frames are between 15 and 20, and I am not sure If there is a correlation.

Here is my Code :

[_sprite1[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(60,-10)], remove, nil]];
[_sprite2[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(10, 80)], remove, nil]];
[_sprite3[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(-10,- 80)], remove, nil]];
[_sprite4[1][1] runAction:[CCActionSequence actions:[self moveWithPosition:ccp(-60, 10)], remove, nil]];

the above code is calling action for sprite with its position[1][1] like that i am calling many of the position at a same time for sprite.

Here the method for CCActionMoveBy

-(CCActionMoveBy *) moveWithPosition:(CGPoint) distance{

    return [CCActionMoveBy actionWithDuration:MoveTime position:ccp(distance.x, distance.y)];
}

MoveTime = 0.25f;

if you need more information i will update please help on this issue..


texts:
I want to draw a empty rectangle around my gamescreen, to show "borders" around. I've tried pixmap. Works perfectly fine, but i could not find the option of change stroke width of the rectangle.

I thougt about using texture, but i do not feel it's the best way. Due to there is no artwork into this border. It's just a thick line around the screen.

Remember i want to create the border once and not recreate it everytime i render.

Any suggestions?


texts: Godot: does parse_json accept multiple JSON objects?

texts: If I had a JSON file that had multiple objects, can the method read through without some form of exception?


texts: Pathfollowing with acceleration - centripetal force

texts:
I'm implementing A* waypoint pathfinding with some twists.
One of the problems I'm encountering is because I do not change velocities of the agents directly but rather I do so through forces.

Which gives me the following problem:
let's suppose the path consists of three nodes,

P0 = the starting position
P1 = node 1
P2 = node 2

When the agent starts moving, it's first target position is P1. The agents moves in that direction because I let a force F act on it's velocity: F=normalized(targetPos-agentPos)*agentAccel*agentMass;

The agent reaches P1.

Now the agent's target position is P2, and upon it will act a force in the direction of (targetPos-agentPos).

However, this is a centripetal force, meaning that the agent will most likely orbit around P2 instead of popping the next node off the path (unless the angle between [P0,P1] and [P1,P2] is small) Stopping the agent at each node is not an option (would look unnatural) What should really happen is the velocity of the agent gradually shifting towards 100% the direction of [targetPos-agentPos], and the velocity should be completely 'shifted' before a certain distance(dX) is laid off, starting from the previous node position

In order to solve this problem, only one parameter is adjustable:

F_dir: the direction of the force acting upon the agent, that's
supposed to lead the agent to the next node.

The values of the following parameters are known:

agentAcceleration (=the magnitude of the force vector)
agentVelocity
agentPosition
node positions
targetPosition (= the next node on the path)

I've been trying some different strategies with trial and error to prevent this, but it seemed rather messy, so my question is, what is a decent approach to this problem?


texts: Measuring distances on 2D perspective beat'em'up

texts:
I'm making a 2-D beat'em up. The tech demo is here.

As you can see, the game is in perspective, pretty much like all old school brawlers. What I want to do is measure the distance between objects on the level on screen. The game is made on Construct2, so AFAIK the only distances I can work out are absolute and on a straight line, without accounting for perspective. Ideally, I would like a function that says "if this is here and this is here, this is the real distance between these two objects".

I've been reading about perspective matrixes but can't for the life of me understand what they are or how could I use it. I'm not afraid to read though, so if you could point me to something (book, website) that can explain how to do that in layman's terms I'd be most grateful.

Thank you! :D


texts:
I am trying to figure out how to dynamically add network components to game objects that are managed by the network.

I started unity about a month ago, and I started writing all sorts of components that I then wired together in the editor.  I have now reached the point where I realize how cumbersome it is to manage a complex project that is built that way.

I am now going through and trying to create "controller" mono behaviors for all of my entities.  The intent is that the controller will use AddComponent to add the behaviors it needs.  So instead of creating a prefab with a dozen components that are all wired together in the editor, I create a prefab with a single controller component.  That controller then adds components like a rigid body, collider, etc., and wires them together via code.

This works well until I get to networking the entity.  It seems like network components need to be part of the prefab or they don't work at all.  I tried using OnStartServer and OnStartClient to add NetworkTransform components, but the transform wasn't synchronizing.  I could add the NetworkTransform to the prefab, but then it needs a rigid body... and I suspect other network behaviors would also need to be there.  And then I'm right back where I started, with a large, opaque prefab.

I have no problems getting networked entities working with monolithic prefabs and the built in network manager.  But when I try the " grown up" way, by adding components in code, it goes pear - shaped.

Is what I'm attempting even possible?  How deep do I have to go into unity's networking in order to do this?  Is there a way that involves the sparsely documented ClientScene methods?  Do I need to somehow make the network server aware of the newly added NetworkTransform?


texts: I am looking for a guide on connecting WiiMote with Unity 5 as an Input device. I found this library here but I do not understand how to install it and what the prerequisites are for it to work.


texts:
I'd like to listen to orientation change events, so for example my UI layout or the components themselves can be changed.
All I've found is that I should check the value of Screen.orientation every frame, and check if it has changed since previous frame.
But this isn't really efficient, and I wonder why doesn't Unity provide an event for this.
This asset seems to have what I need. Anyone knows how is it implemented?
As a last resort I could make a singleton behaviour which starts a coroutine which checks every X seconds whether it has changed, and if it has, I fire an event. But this still seems like a suboptimal solution.


texts: Is a game based on a specific cellular automation a copyright infringement?

texts:
If one creates a game which is based on some cellular automation algorithm like Conway's Game of Life or Langton's Ants would that be a copyright infringement?

Are such famous algorithms protected by intellectual property rights, or as long as they aren't mentioned by their official names, the actual effect they create is free to be used?


texts: How to prevent collisions between instantiated prefabs

texts:
I'm creating a virtual creature evolution system like here.
This type of project requires to define creatures, which are made of some 3d boxes and simulate them over and over again, making little changes along the way, until the point where they are good enough at a certain task. Basically, I'm using Genetic algorithms. I'm going to be doing a lot of simulation (a few hundred creatures each generation, times X generations, where X could be in the thousands).
In order to save time, I want to simulate multiple creatures at once, so I must run collision checks efficiently. Each creature exists on its own and therefore should not be bothered by other colliders except himself and the ground.

I have a prefab of a creature. Each creature is made of multiple 3d boxes with colliders. The nodes in the same creature should collide with themselves but should not collide with nodes that are in other creatures (because it should learn to perform based on the environment as it is). What is the most efficient way I could do this?

I thought about checking the root of the collision object but that just prevents the collision and doesn't eliminate the useless checks that are being made. I've also looked at solutions involving the "Layer Collision Matrix" but still could not find a way to make it work.

Thanks in advance.


texts:
I'm trying to find the angle between a point and the left side of my camera's fov.

In the picture below the camera (Red dot) is looking towards a polygon (Green) with the fov of the camera represented as the blue lines.

I've tried to butcher some code together from my limited understanding of linear so I havent gotten far. I've tried atan2 as well, but it seems to give incorrect answers for what im looking for.

the info i have is:

the point(x,y) I'm evaluating
the camera(x,y)
line segment and angle representing the left side of the cameras fov
same for the right

How would i find the angle between the left angle and the point?
I'm going to use the calculation to find the angle to each of the points making up the polygon.

Below is a rough mock up ive been using to try to figure this out
the blue angle with the question mark is what im looking for


texts: Does anyone have an insight of the suggest a card algorithm in hearthstone deckbuilding? I would like to try to see it that same suggestion can be applied in MtG, having for example to choose your total mana and get suggestions for color, colorless and enchantments/artifacts/sorceries/instants.


texts:
This is something I have been discussing with my team as to how we should approach it on our project.

The question is, what is better practice, make your model already with different Levels of detail, importing everything in one go, or importing the base model on the game and only then making LODs for it later?


texts: Packing jar files into library jar files

texts:
This question is not about packing a simple jar file (e.g. lwjgl) into a runnable jar file. I know how to do this using JarSplice. So if I have a game which uses JInput, I will pack my game jar and jinput.jar using JarSplice and enter the natives in the process. The problem arises when I want to create a custom library that uses JInput, and then pack that into my games. See, the whole idea of writing a game library is that I don't ever have to even copy code like the wrapper I wrote for JInput Controller, and I always have a definitive version inside a library jar. Basically what I want to do is create a jar file of my library, pack jinput.jar into it using JarSplice, possibly with the natives as well, and then when I want to export a jar of my game, I either export it automatically through Eclipse with the library jar, or, if that doesn't work, use JarSplice.

I've tried several solutions, and nothing works. When I try to pack the game jar and the library jar using JarSplice, I get an error saying that there's either duplicate .project or .classpath. When I try to export my game through Eclipse with the library jar, it won't run (which is to be expected), but then, if I try to attach the natives with JarSplice, it doesn't give me any errors but the jar doesn't run.

I'm not expecting anyone to solve this, but if anyone has an idea, something that will allow me to never look at the Gamepad code ever again, that would be awesome. I don't care if I have to package my library jar using JarSplice 5 times, and then do the same with the game jar, as long as it works. Otherwise I'll just have to copy the Gamepad class into every project alongside the library jar. :(

Edit: to clear things up, here's what I'm trying to do-
JInput has a class Controller, for controller input.
My_Library has a class Gamepad, which is a wrapper for JInput's Controller.
My_Game should be packed with My_Library so that it can access My_Library's different utilities, including Gamepad (for example, the class Player in My_Game has a field Gamepad for the player to pass gamepad input).
If I can't pack them all into one fat jar, I guess it's OK, as long as I'll be able to place Gamepad in My_Library and access it from My_Game.


texts: Unity3d Colliders not working on my characters

texts: I have create 2 characters in maya and imported them in Unity3d. I am able to move and animate them in unity but the characters are not colliding with each others. I have tried all major colliders capsule, box and mesh. I am kind of stuck in it !


texts: Bug with OnColliderEnter/Exit when colliding with multiple objects at almost the same time

texts:
Unity Version: 2017.4.1f1

I currently have a game with a jumping mechanic. I only want the jump to work where you're on ground, so I have planes on top of everything, which, if you are on a plane, then you can jump.

This works, however if you are in a position where you are falling and then in quick succession, hit one plane, fall off that plane (like when your centre of mass is hanging off the edge), then land on another plane, at the end of it all, it still thinks you are on the air.

Note: I don't think this is an error with the velocity of the player, at no point do you go through a collider.

So my question is, is there an error in my code (shown below) which I can fix, or should I take another approach towards jumping, thanks. Relevant code below.

private bool canJump;
private Rigidbody rb;
public float jumpStrength;

private void OnCollisionEnter(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = true;
    }
}
private void OnCollisionExit(Collision collision)
{
    if (collision.collider.CompareTag("Jumpable"))
    {
        canJump = false;
    }
}
private void Update()
{
    if (canJump && Input.GetKey(Keyode.W))
    {
        rb.velocity += new Vector3(0, jumpStrength, 0);
        canJump = false; // Safety measure to ensure consistent jump height
    }
}

Thanks


texts:
I am using below shader with my mesh object that is showing a webpage. It is showing fine but the problem is the web page has flipped:
 Shader "UI/Default_OverlayNoZTest"
 {
     Properties
     {
         [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {}
         _Color ("Tint", Color) = (1,1,1,1)

         _StencilComp ("Stencil Comparison", Float) = 8
         _Stencil ("Stencil ID", Float) = 0
         _StencilOp ("Stencil Operation", Float) = 0
         _StencilWriteMask ("Stencil Write Mask", Float) = 255
         _StencilReadMask ("Stencil Read Mask", Float) = 255

         _ColorMask ("Color Mask", Float) = 15
     }

     SubShader
     {
         Tags
         {
             "Queue"="Overlay"
             "IgnoreProjector"="True"
             "RenderType"="Transparent"
             "PreviewType"="Plane"
             "CanUseSpriteAtlas"="True"
         }

         Stencil
         {
             Ref [_Stencil]
             Comp [_StencilComp]
             Pass [_StencilOp]
             ReadMask [_StencilReadMask]
             WriteMask [_StencilWriteMask]
         }

         Cull Off
         Lighting Off
         ZWrite Off
         ZTest Off
         Blend SrcAlpha OneMinusSrcAlpha
         ColorMask [_ColorMask]

         Pass
         {
         CGPROGRAM
             #pragma vertex vert
             #pragma fragment frag
             #include "UnityCG.cginc"

             struct appdata_t
             {
                 float4 vertex   : POSITION;
                 float4 color    : COLOR;
                 float2 texcoord : TEXCOORD0;
             };

             struct v2f
             {
                 float4 vertex   : SV_POSITION;
                 fixed4 color    : COLOR;
                 half2 texcoord  : TEXCOORD0;
             };

             fixed4 _Color;

             v2f vert(appdata_t IN)
             {
                 v2f OUT;
                 OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
                 OUT.texcoord = IN.texcoord;
 #ifdef UNITY_HALF_TEXEL_OFFSET
                 OUT.vertex.xy += (_ScreenParams.zw-1.0)*float2(-1,1);
 #endif
                 OUT.color = IN.color * _Color;
                 return OUT;
             }

             sampler2D _MainTex;

             fixed4 frag(v2f IN) : SV_Target
             {
                 half4 color = tex2D(_MainTex, IN.texcoord) * IN.color;
                 clip (color.a - 0.01);
                 return color;
             }
         ENDCG
         }
     }
 }

I am using above shader so that the mesh should be shown on top of everyting.


texts: How to get several frequency ranges at the same time in fmod?

texts:
After reading documentation and tutorials about fmod I still have a question about frequency ranges.

I've found how to get a frequency range using low and high pass DSP at the same time on the main channel, but I can't find how to get several ranges at the same time.
For example I want, for a specific phase of my game, to hear range 400 to 600Hz and 1000 to 2000hz of the same sound.
I tried to create a channel by range, but it doesn't seem to work (or maybe I do something wrong).
How can I do that ?

Thank you


texts: How are red dot/reflex/holographic sights implemented?

texts:
In first-person-shooters like Call of Duty, the hologram only appears when it is behind the glass portion of the sight.

In OpenGL, would it be implemented by rendering the glass to the stencil buffer and then rendering the hologram, but masked by the stencil buffer?


texts: How do I make objects move along a path?

texts:
I'm trying to get something like the below image. As you can see, there's a highway and inside of it, there'll be some objects moving (millisecond). I guess the street behavior is like a pipeline. When the highway loads an object, it appears at the beginning and it'll be moving through the highway until it arrives in the other extreme of the highway.

My main problem is, how can I move several objects only inside of the highway?


texts: Client-Server MMOG & data structures sync when joining / playing

texts:
After reading a few articles on MMOG architecture, there is still one point on which I cannot find much information: it has to do with how you keep in sync server data on the client, when you join, and while you play. A pretty vague question, I agree. Let me refine it:

Let's say we have an MMOG virtual world subdivided into geographical cells. A player in a cell is mostly interested in what happens in the cell itself, and all the surrounding cells, not more. When joining the game for the first time, the only thing we can do is send some sort of "database dump" of the interesting cells to the client.

When playing, I guess it would be very inefficient to do the same thing regularly. I imagine the best thing to do is to send "deltas" to the client, which would allow keeping the local database in sync.

Now let's say the player moves, and arrives in another cell. Surrounding cells change, and for all the new cells the player subscribes, the same technique as used when joining the game has to be used: some sort of "database dump".

This mechanic of joining/moving in a cell-based MMOG virtual world interests me, and I was wondering if there were tried and tested techniques in this domain.

Thanks!


texts: With gravity enabled, how do you move a RigidBody forwards at a specific speed?

texts:
I have a perfectly smooth cube on top of a perfectly smooth plane. I am applying a forward-force of 1 unit per second, using rigidBody.AddForce(new Vector3(0, 0, 1), ForceMode.VelocityChange). I apply this force every FixedFrame(), taking into account Time.fixedDeltaTime, of course.

When the "Use Gravity" checkbox on the RigidBody is not checked, the object behaves as expected; after exactly 3 seconds, it has a speed of exactly 3 units per second.

However, when I enable the "Use Gravity" checkbox, the object barely moves. Both the object and the surface are using Physic Materials with zero friction, and the moving object's RigidBody has zero drag and zero angular drag.

Why does this happen? And more importantly, how would I apply a force to this object so that it moves forward at, say, exactly 3 units per second, with gravity enabled?

Thank you.


texts: Implement resolution scaling HTML5 canvas

texts:
I'm building an hmtl5 real time game using socket.IO and node.js. If you've heard of the classic game "pong", I'm going for that. When you consider the gameplay for this game, it becomes apparent that resolution scaling is something I'll have to implement. I'm running one instance of the game on the server (no graphics rendering, only physics), and of course once for every client. Each client's canvas is the size of the browser window so could be any resolution.

What I'm wondering is how I should keep track of positions, velocities, etc. in the core game code. Should I use percentages and then multiply them by the respective screen sizes? Like x = 0.5 to store a position halfway across the screen? What's the best/standard way of doing this? Thanks so much.


texts: Vertical vs horizontal hex grids, pros and cons

texts:
With hex grids, you can choose to arrange the tiles with the pointy sides up, so that you can move along the west-east axis, or you can arrange them with an edge up, so that you can move along the north-south axis.

Horizontal or pointy-side-up hex grid:

Vertical or flat-side-up hex grid:

According to this page, the vertical alignment is "by far the most popular" in pen-and-paper RPGs, but it doesn't explain why. This blog post also mentions both varieties, but again gives no reason to use one or the other.

And if you look at some PC games using hexes, it seems both have their adherents:

Horizontal: Heroes of Might and Magic series (except V), Civilization V...
Vertical: Panzer General and many similar wargames, Battle for Wesnoth...

But what are the main reasons for choosing a vertical or a horizontal layout of hex grids?

I'm looking for objective advantages and disadvantages in terms of data structures, graphics, gameplay, etc, not personal preferences. Or is it really inconsequential which orientation you choose?


texts: Why is my Texture becoming slower when it approaches it's destination?

texts:
I have a texture drawn on screen. Whenever I click on the viewport it remembers its destination and starts moving towards it, until it is there. This is the code I am using therefore:

//Check if destination was reached
if ((currentDestination - position).Length() <= movementSpeed)
{
     // Stop moving
     position = currentDestination;
     playerState = PlayerState.Idle;
     reachedDestination = true;
}

// If destination is not reached
if(!reachedDestination)
{
    Vector2 direction = (currentDestination - position); // gives the direction needed to travel from position to target
    angle = (float)(Math.Atan2(direction.Y, direction.X) + MathHelper.PiOver2);

    direction.Normalize(); // we need it as a unit vector

    position += direction * movementSpeed;
    // The Y coordinate stays the same in this case
    position.Y = 455;
}

It does work, but the closer the texture is to the destination, the slower it gets. Why is that?


texts: Mesh with Alpha Texture doesn't blend properly

texts:
I've followed example from various place regarding setting OutputMerger's BlendState to enable alpha/transparent texture on mesh. The setup is as follows:

            var transParentOp = new BlendStateDescription {
            SourceBlend = BlendOption.SourceAlpha,
            DestinationBlend = BlendOption.InverseDestinationAlpha,
            BlendOperation = BlendOperation.Add,
            SourceAlphaBlend = BlendOption.Zero,
            DestinationAlphaBlend = BlendOption.Zero,
            AlphaBlendOperation = BlendOperation.Add,
        };

I've made up a sample that display 3 mesh A, B and C, where each overlaps one another. They are drawn sequentially, A to C. Distance from camera where A is nearest and C is furthest. So, the expected output is that A see through and saw part of B and C. B will see through and saw part of C.

But what I get was none of them see through in that order, but if I move C closer to the camera, then it will be semi transparent and see through A and B. B if move closer to camera will see A but not C. Sort of reverse.

So it seems that I need to draw them in reverse order where furthest from camera is drawn first then nearest to camera is drawn last.

Is it suppose to be done this way, or I can actually configure the blendstate so it works no matter in which order i draw them?

Thanks


texts:
I am developing a game (in Java) that is going to have a lot of textures and images in it.

What is the most efficient way to load all the textures? I was thinking on pre-loading all the images instead of loading them during runtime (because during runtime they will be loaded over and over again).

I'll be happy to hear your opinion on those strategies, and also, if you have a better strategy I would like to hear that.


texts: How do I prevent clicking at the end of each sound play in OpenAL?

texts:
I have put together a basic sound handler class for use in my game. It uses OpenAL.

It's a simple method at the moment to play sounds - here's an extract from a switch block:

case "EATEN_PILL":
    wavPath = "D:\\Programming\\SFX\\EATEN_PILL\\Hit_43.wav";
    ALfilename = Path.Combine(Path.Combine("Data", "Audio"), wavPath);
    sound_data = LoadWave(File.Open(ALfilename, FileMode.Open), out channels, out bits_per_sample, out sample_rate);
    buffer_EATEN_PILL = AL.GenBuffer();
    AL.BufferData(buffer_EATEN_PILL, GetSoundFormat(channels, bits_per_sample), sound_data, sound_data.Length, sample_rate);
    AL.Source(source, ALSourcei.Buffer, buffer_EATEN_PILL);
    AL.SourcePlay(source);

    break;

Problems:
1. An annoying click at the end of each sound.
2. Eventually sound stops playing completely. This is after perhaps playing 100 sounds.

Has anyone hit this problem before?


texts:
I'm trying to build a collision response ( it uses vectors2f from slick2d ) so that enemies don't overlap on each other so basicly what I'm doing right now is, I loop trough all enemies in array trough the same array of enemies to check if they collide or not , if they collide I swap their velocity.

The code partialy works for some enemies and doesn't for others. If anyone can give me some links how to code this or advise me how to do it , that would be nice. I already google'd to see if I could find something like this but I couldn't find anything.

Here is the code for the current code i got:
http://pastebin.com/AbCvTtV0

Slick 2d documentation : http://www.slick2d.org/javadoc/


texts:
I'm working on a 2D javascript/Three.js multiplayer game, using web sockets and an authoritative server currently written in Python.

The combat mechanic will be similar to Geometry Wars however i'm struggling to get my head around how to implement this in an efficient way.

There are several drawbacks/concerns I need to take into account:

Efficiency is key
Three.js particle systems aren't mutable, you cannot add or remove particles once the system has been created, only move them off screen
All calculations with respect to collision and damage must be done server side
My game currently implements entity interpolation with fixed time step updates from the server
Potentially several different weapons/projectile types

I can see several solutions:

Handle each 'bullet' particle individually

Pros

Most accurate way of doing thigs

Cons

Slow on server
Lots of bandwidth
Hard to batch draw objects, will have to draw each individually

Use ray casting on server and have some form of network synced particle emitter

Pros

Much easier on the server and network

Cons

Network synching issues
What happens when a bullet hits an object? Bullet will pass right through

Use ray casting on server for collision/damage and use raycasting on client for more accurate particles

Pros

Much easier on the server and network
Will look more accurate

Cons

May still have some synching issues
More work for the client

Obviously the amount of players currently connected will have an impact on the implementation, I would ideally like to allow hundreds of players to share a game world but there may only ever by 20 or so on screen at once.

The mutable particle system is an issue for all of these but I would still like to use it as it is more efficient that drawing each particle individually. In a test I could have over 10000 particles all moving and still get 60fps.

Any help or comments on my though process would be greatly appreciated. Is there another approach that would be better?


texts: How can I export Blender game logic for controlling actor actions?

texts:
How does one export game logic ("Sensors") that Unity references for controlling actions from Blender's "Action Editor" or "Dope Sheet?"

I have a Blender model that has game logic sensors that respond to complex input. These actions are defined in Blender's "Action Editor" or "Dope Sheet". What is the easiest way to export the game logic so that I have access to its input that causes the actions? There are many exporters that focus on the mesh/skeleton, is there a solution for exporting these sensors?

Here is a list with screen shots of Blender's sensors to give a better idea of what I want exported.

For each character made, I want their sensors exported to a file that is easy to read (some kind of XML). This way I don't need to hard-code character behavior or action triggers/sensors. Each modeled Blender actor can have its sensors programmed in Blender with its nice GUI and later exported to my game engine.

This question has been asked before and it seems the asker ended up scripting a very limited exporter (for one variable) but didn't fully explain his approach:
http://www.blender.org/forum/viewtopic.php?t=18803&sid=22ac4b2d3993949b1e71e9568b0d6834

Again, this was asked with no apparent solution:
http://www.blender.org/forum/viewtopic.php?t=18803&sid=22ac4b2d3993949b1e71e9568b0d6834

Looks like someone has already tried using Collada but this was only for exporting actions (not sensors that trigger them):
Blender multiple animations and Collada export

Someone here wrote their own exporter. I don't think they are exporting sensors though:
exporting bind and keyframe bone poses from blender to use in OpenGL

Any ideas?