texts: Finding roots/zeros for collision detection?

texts:
For the most simple of 2D games, I have implemented a posteriori collision detection (overlapping rectangles) on the x/y Cartesian plane, but am now interested in understanding the basics of a priori collision detection...

In the link here, I noticed the reference to Newton’s Method.  So, I want to better understand the link b/w finding zeros of an equation and detecting a posteriori collision.

Let's start with the most obvious case of finding roots of an equation:  If you have a projectile's trajectory modeled as a quadratic function, you can find the roots to predict at what time the height will equal zero (or any other constant height, actually, by just solving f(x)=C to be f(x)-C=0 and then finding roots of that expression).

So, as I understand, finding the root can tell me the time at which the object will be at any chosen height.  More broadly, we basically know the (x,y) location of the object for any given time.  But how does root finding, in particular, translate to detecting collisions with another object?  (The other object may be stationary, or be moving.  If the latter, do you also determine roots/location of this moving object as well? Calculate the (x,y) trajectory of both objects and determine where they will intersect?)

Again, the basic question is where does root finding come into play?  Any links to a basic primer on this topic, with a simple example would also be greatly appreciated.


texts:
I want to make an evolution games similar to this old games that was generating cars.
Except I want it to be more realistic.

So I want air friction to impact the speed of my cars, but how do I do that? wind will always be blowing at the same speed and in the same direction.

But my car chassis are random and their angle of attack can change due to the terrain shape (which is also random)

So I cannot apply a drag value, because this drag value change for the angle of attack. instead I must compute a new drag value for each frame.

Using real world physics might be to much to let the game run smoothly (10-20 cars running at the same time) How would you do it?

Thanks.


texts: Legal Implications of using Openal in Opentk Commercially

texts:
Myself and my friend are currently creating a game, which we plan on selling upon its completion. We are using opentk.

I read over this: http://www.opentk.com/node/532 , and it pretty well describes that this is perfectly legal. However, we are using the included openal standard included with opentk. The license that openal belongs to is somewhat ambiguous, I read in some places that it is under LGPL, and in other places that it is not. I've also heard about an "openal soft". I'm not entirely sure what the difference is, and which is included in opentk, and what I am allowed to do, and not to do with it.

Are we allowed to include the openal installer with our program so that the program will correctly launch for the user? Or will this incur possible legal implications?

Also, do we need to include legal information in/with the game regarding openal and its usage? Or are we fine simply using it?

Sorry for all the questions, and thank you anyone and everyone who responds to, and reads this, for your time.


texts:
I am making a 3D infinite runner game in Unity in C#. When the player has reached the end of the tile it should spawn another tile and then delete the previous tile. When the player reached the end of the first tile it deletes that tile and spawns another(just like it should), but when the player reached the second tile is does nothing. Does someone have a solution?

Thanks

Here is my code:
Old:

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

public class Terrain : MonoBehaviour
{
    private List<GameObject> objs = new List<GameObject>();
    public GameObject terrain;
    public GameObject terrain2;
    public GameObject player;
    //private float z = 4130.875f;
    private float safeZone = 260.0f;
    private float tileLength = 260.0f;
    private int animTilesCount = 2;
    private Vector3 position;
    void Start()
    {
        objs.Add(terrain);
        objs.Add(terrain2);
        for (int i = 0; i < animTilesCount; i++)
        {
            spawnTile();
        }
    }
    void Update()
    {
        if ((objs.Count > 1) && (player.transform.position.z - objs[0].transform.position.z > safeZone))
        {
            spawnTile();
            DeleteTile();
        }
    }

    public void spawnTile()
    {
        position = objs[objs.Count - 1].transform.position;
        position.z += tileLength; //21, -13
        position.x += 21;
        position.y += -13;

        GameObject go = Instantiate<GameObject>(
                      terrain,
                      position,
                      terrain.transform.rotation);

        go.transform.SetParent(transform);

        objs.Add(go);
    }

    public void DeleteTile()
    {
        Destroy(objs[0]);
        objs.RemoveAt(0);
    }
}

New:

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

public class Terrain : MonoBehaviour
{
    [SerializeField]
    private List<GameObject> objs = new List<GameObject>();
    public GameObject terrainPrefab;
    public GameObject player;
    public GameObject terrain;
    public GameObject terrain2;
    //private float z = 4130.875f;
    private float safeZone = 260.0f;
    private float tileLength = 260.0f;
    private int animTilesCount = 2;
    private Vector3 position;
    void Start()
    {
        objs.Add(terrain);
        objs.Add(terrain2);
        for (int i = 0; i < animTilesCount; i++)
        {
            spawnTile();
        }
    }
    void Update()
    {
        if ((objs.Count > 1) && (player.transform.position.z - objs[0].transform.position.z > safeZone))
        {
            Debug.Log("Hello");
            spawnTile();
            DeleteTile();
        }
    }

    public void spawnTile()
    {
        position = objs[objs.Count - 1].transform.position;
        position.z += tileLength; //21, -13
        position.x += 21;
        position.y += -13;

        GameObject go = Instantiate<GameObject>(
                      terrainPrefab,
                      position,
                      terrainPrefab.transform.rotation);

        go.transform.SetParent(transform);

        objs.Add(go);
    }

    public void DeleteTile()
    {
        Destroy(objs[0]);
        objs.RemoveAt(0);
    }
}


texts: How to make one material on object with many parts inside?

texts:
I have a weapon witch have many parts, it also have many materials. Do I really need to make it like that?
It's like about 8 mats! :(


texts:
I've got an object in HLSL and I'm using hardware instancing to render multiple copies. But I've come a bit of a cropper when it comes to the vertex normals. Currently I am not using normal mapping (although planning to implement it soon), I'm just putting the normals inside the vertex structure. I can put the world matrix and get it out in HLSL just fine, but I need the inverse transpose if I want the world position of the vertex normal from object space. How can I invert a matrix in HLSL? Or am I going to have to send the matrix and it's inverse in the instance buffer?

Or is this somehing that normal mapping doesn't require?


texts:
If I set linearDamping on a body, it's velocity will be decreased slowly, until it stops.
The documentation says, that the units are 1/time, which is unclear for me.

If the velocity of a body is 10 m/s, and the linearDamping is 0.5, then how can I calculate that when will the velocity be decreased to 1 m/s ?


texts: Exporting 3DS Max animated biped character into Assimp

texts:
I've been having some trouble with MD5 meshes exported from 3DS Max into my C++ program, using Assimp to import the model and its skeletal animation.  If the models were rigged manually with bones, the export and animations work perfectly, but if they were rigged as a biped character, the animation hits a "deadly import error" and all the bones appear to get smooshed together into a big pile.  This seems like it might just be a limitation of the MD5 exporter (we're currently using the one found here.

Our plan is to try out a different MD5 exporter (this one), and if that still has problems, then try switching from MD5 to COLLADA.

Our modeler won't be able to make time to try out these other exporters for a few days, so in the meantime I wanted to see if there were any better methods out there for getting biped rigged models from 3DS Max into our app via Assimp.  Out of Assimp's supported formats, I need to figure out which will support the following:

Skeletal animations
Exportable from 3DS Max biped rigged models

Failing that, an alternative would be a way to convert a biped character to its corresponding bones before exporting.  We did find one script to do that, but it only seems meant as a starting point for modeling -- it doesn't carry over any hierarchy, skinning, or animation -- so it can't be used solely during export.


texts: Pushing Rigidbody forward doesn't go straight

texts:
I have a object that pushing rigidbody forward when it's instantiated:

GameObject grenade = Instantiate(projectilePrefab, shootPoint.position, shootPoint.rotation);
grenade.GetComponent<Rigidbody>().velocity = transform.forward.normalized * 50;

It seems fine, but when I ran the game, projectile always not going straight and it's little bit moving left or right.

So I thought that shoot point wasn't pointing the right direction or my crosshair didn't centered properly, but unfortunately there were nothing wrong with them.

I think there's no extra forces that affects physics in my scene except gravity, and gravity has default settings which only affects downside. But why projectile doesn't go straight and move little bit left?

What am I missing?


texts: What causes SFML pollEvent to segfault here?

texts:
I'm writing an SFML application in C. Currently sfRenderWindow_pollEvent() and sfRenderWindow_waitEvent() always segfault.

Here's the cleaned code that shows the issue.

sfRenderWindow* window;
sfVideoMode mode = {SCREEN_WIDTH, SCREEN_HEIGHT, 32};
window = sfRenderWindow_create(mode, "SFML window", sfResize | sfClose, NULL);

sfEvent* InputEvent;

while(1)
{
    while (sfRenderWindow_pollEvent(window, InputEvent) == sfTrue)
    {
        ...
    }
}


texts:
I just started unity. Currently, I am familiar with Start() , Update(), Awake(), OnCollosionEnter(), OnTriggerEnter() and FixedUpdate().
Can you give me more functions like these


texts: How can I compute the shortest path in Euclidean environments with non-convex polygons?

texts: Can someone suggest papers or algorithms about calculating shortest paths in Euclidean spaces with non-convex polygon as obstacles?


texts: Is it a bad idea to couple action and animation?

texts:
I'm making an ARPG (like Legend of Zelda but with more action), and this question raised during the development:

Should action and animation be coupled? Or should they be independent?

With this I mean, the process of executing an action (eg. Attacking) should be:

Input
Start Animation
Frames 1-3 are transitioning, do nothing
Frames 4-7 are attack moves, do the attack action during these (searching enemies in front of the character, pick the closest and deal the damage)
Frames 7-10 are transitioning, do nothing again
Animation finished, release input again.

This way, it's like the action is triggered by the frames, as events on the animation itself.

If it helps, I'm making the game on an Entity/Component System.

Should it be done this way? Why yes/no? What are the advantages/disadvantages?


texts: What functional abstraction to use for multi-agent simulation?

texts:
this is quite a broad question, touching a few different fields, so let me know if there's a way to narrow it down.

What I would like to know is your opinions on what abstraction to use for my use case.

My game is a grid-based trading game (it's more complicated than that, but for now  think of a Patrician on a grid) and I want to do some heavy simulation in the settlements. Heavy here means that the decisional processes and actions of every individual is simulated. I already managed to do a stress test and I know I can handle about 1 milion individuals without any slow down for the game.

The game is written in Scala in a functional style. The problem is that I achieved those performances using a naive copy of immutable states. So for every entity and settlement I compute the next state, I aggregate it in a global state and in the next iteration, I replace the old state with the new one. The issue is with the garbage collector: if the state grows too much after a while it tries a full garbage collection to free up memory and considering that with this approach I may have two whole sized states (the old one and the just computed new state), this gargabe collection may happen at every step.

What I did to solve this was to break the global state in N parts, computing and replacing parts of the state in N iterations. This works because every settlement is assumed to be in isolation and so it won't conflict with the others. This  is a strong assumption though and in such an early state of development I don't want to be bound to it.

So what I need is a way to structure this simulation, settlement by settlement but that allows the agents on the map to interact with the settlements. The abstraction must be functional and match the requirements for the memory issue.

An obvious answer may be to use actors but I fear that using frameworks like Akka, the overhead may be too great for a game.


texts: Texture size and scaling, 2D, for OpenGl ES 1.0/1.1

texts:
I read everywhere that you have to use a power of two
size for your texture width and height, like 16, 32 or 64,
but right now my sprite drawing is based on Grid.java from
SpriteMethodTest, and I set the Vertex array "quad" to the pixel
size, 20 X 28, and and apply the texture, the same pixel size, to that,
and I'm not using any scaling information, and it's drawing them fine
and I don't seem to be getting any errors.

Is it actually scaling it behind the scenes?

When I process each Bitmap I use:

gl.glBindTexture(GL10.GL_TEXTURE_2D, iTextureName);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MIN_FILTER, GL10.GL_NEAREST);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_MAG_FILTER, GL10.GL_LINEAR);

gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_S,    GL10.GL_CLAMP_TO_EDGE);
gl.glTexParameterf(GL10.GL_TEXTURE_2D, GL10.GL_TEXTURE_WRAP_T, GL10.GL_CLAMP_TO_EDGE);

gl.glTexEnvf(GL10.GL_TEXTURE_ENV, GL10.GL_TEXTURE_ENV_MODE, GL10.GL_REPLACE);

So if I start doing sprite batching instead, the image I grab
out of the bigger image has to be a power of two width
and height, if I want it drawn without any scaling?

Thanks!


texts: How do you decide on the size of a tech tree?

texts:
Is there any established metric with which a game designer might decide the best size for a tech tree?

In this case the game is a single player 4X game (thank you, Peter, for that term). I wanted to incorporate an appropriate length and breadth of tech tree as a basic design goal.

For instance, is there data on player reactions to tree size vs game scope or game length? Or even a reasonably established rule of thumb?


texts:
I'm trying to use ASSIMP to load an fbx file with a skeleton and animations, but I'm stuck on something I'm misunderstanding and struggling to see it.

I've attached 2 images, one of the fbx file as rendered by Open 3D Mod which uses ASSIMP and looks correct. The second image is my renderer that does not look correct. The only thing wrong with mine is that the main body is rotated 90 degrees from what it should be.

For this fbx file, it has 3 nodes that contain a mesh to draw: "Mesh 1" is the main body and "Mesh 0" is an axe. The axe is referenced twice, once from each hand node. The main body mesh's vertices are tied to the bones, so Mesh 1 gets animated with the bones. The axe mesh's vertices are not tied to bones.

So I'm traversing the skeleton, and when I get to a node that references a mesh to draw, I transform to that node's position, then draw the mesh instance at that spot. This is how the axe meshes get animated: the axe mesh vertices are not tied to bones, but since the hand nodes reference them, I transform wherever the hand bone animation currently is then draw them.

My problem is when I do this same thing on the main body (Mesh 1), it ends up rotated 90 degrees as seen in the blue picture. The reason is because the node it is attached to has an mTransformation of -90 degrees about the x-axis.

Another note is that the mTransformation of the RootNode is the identity matrix, so the global inverse is identity.

There's too much code involved for me to realistically be able to post it here. However, the relevant logic follows what's shown in this tutorial: http://ogldev.atspace.co.uk/www/tutorial38/tutorial38.html
The one thing the tutorial doesn't mention is handling the mesh references at each node. If I ignore where the meshes are referenced from, the body works but the axes break (axes don't animate any more and simply draw at their bind position).

The model I'm using was a free one I grabbed from the unity store for testing:
https://assetstore.unity.com/packages/3d/animations/zombie-0-1-19254

My questions are:
Am I correctly interpreting the mesh references at a node by transforming to the node position prior to drawing?
If so, why does this get the axes to the correct place but not the main body?
If not, what am I missing?

 Open 3D Mod's render, looking down the Z axis
 My render, looking down the Z axis


texts:
I'm trying to get Nifty GUI to work with Slick2D. So far everything is going great, except that I can't seem to figure out how to properly interact with the GUI. I'm trying the example in the nifty manual http://sourceforge.n....0.pdf/download
but it doesn't seem to entirely work.

The Element controller is being called for bind(...), init(...) and onStartScreen() as it should, as I can see their println output, but the next() method isn't being called when I click on the GUI element that I assigned the controller to, nor the screen controller as no output from println is shown.

What's weird is, that the player is moving, so the mouse input is working.
It's supposed to be called when I click the mouse button on it from the  in the XML.

Here is my code:

My Element controller:

public class ElementController implements Controller {

private Element element;

@Override
public void bind(Nifty nifty, Screen screen, Element element, Properties parameter, Attributes controlDefinitionAttributes) {
  this.element = element;
  System.out.println("bind() called for element: " + element);
}

@Override
public void init(Properties parameter, Attributes controlDefinitionAttributes) {
  System.out.println("init()  called for element: " + element);
}

@Override
public void onStartScreen() {
  System.out.println("onStartScreen()  alled for element: " + element);
}

@Override
public void onFocus(boolean getFocus) {
  System.out.println("onFocus()  called for element: " + element + ", with: " +
    getFocus);
}

@Override
public boolean inputEvent(NiftyInputEvent inputEvent) {
  return false;
}

public void next() {
  System.out.println("next() clicked for element: " + element);
}
}

MyScreenController:

class MyScreenController implements ScreenController {
    public void bind(Nifty nifty, Screen screen) {}
    public void onEndScreen() {}
    public void onStartScreen() {}
    public void next() {
     System.out.println("next() called from MyScreenController");
}
}

And my XML file:

<?xml version="1.0" encoding="UTF-8"?>
<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://niftygui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd">
<screen id="start" controller="predaN00b.theThing.V0004.MyScreenController">
  <layer childLayout="center" controller="predaN00b.theThing.V0004.ElementController">
   <panel width="100px" height="100px" childLayout="vertical" backgroundColor="#ff0f">
     <text font="aurulent-sans-16.fnt" color="#ffff" text="Hello World!">
      <interact onClick="next()" />
     </text>
   </panel>
  </layer>
</screen>
</nifty>

My main class, in case it's needed:

public class MainGameState extends BasicGame {

public Nifty nifty;

public MainGame() {
  super("Test");
}

public void init(GameContainer container, StateBasedGame game) throws SlickException {

  nifty = new Nifty(new SlickRenderDevice(container), new NullSoundDevice(), new PlainSlickInputSystem(), new AccurateTimeProvider());

  nifty.addXml("/xml/MainState.xml");
     nifty.gotoScreen("start");

}

public void update(GameContainer container, StateBasedGame game, int delta) throws SlickException {
  nifty.update();
}

public void render(GameContainer container, StateBasedGame game, Graphics graphics) throws SlickException {
  nifty.render(false);
}

  public static void main(String[] args) throws SlickException {
     AppGameContainer app = new AppGameContainer(new MainGame());
     app.setAlwaysRender(true);
     app.setDisplayMode( 1260 , 720, false); //window size
     app.start();
}
}


texts:
I try to rotate a 3D cube on itself from its center, not the edge.
Here is my code used.

public rotatemyCube()
{
    ...
    Matrix newTransform = Matrix.CreateScale(scale) * Matrix.CreateRotationY(rotationLoot) * Matrix.CreateTranslation(translation);
    my3Dcube.Transform = newTransform;
    ....

public void updateRotateCube()
{
    rotationLoot += 0.01f;
}

My cube rotate fine, but not from the center. Here is a schematic that explains my problem.

And i need this:


texts: Is there a way to reference Unity UI object inside native code?

texts: Let's say we have a scene in Unity with canvas and InputField on it. Is there a way i can reference my InputField inside native plugin? Maybe i can pass it from Unity?


texts: How to circle an uneven object with Camera at a fixed distance?

texts:
Unity3d. I am trying to move an object with Camera around a fixed terrain (Mountain), while staying an set distance from its edge.  I have the camera set to lookAt the mountain, and I want to circle the mountain.  I was thinking about sine wave for circular motion but its not an exact circle as I need to move in or out to maintain the fixed distance from the mountains edges.

It looks like I might need transform.RotateAround(..), but what about the adjusting to maintain a fixed distance from the edge of the uneven surface while maintaining the circular motion.

    transform.RotateAround (Vector3.zero, Vector3.up, 20 * Time.deltaTime);

Update:  Here is my current script for circling around mountain as first person object:

function Update () {
   var mountain : GameObject;
   mountain = GameObject.Find("QuantumCold_B");
   transform.RotateAround(mountain.transform.position, Vector3.up,20 * Time.deltaTime);

}

Unfortunately there are two problems:

1) The first person object appears to be falling or maybe its the main camera, but in any even there is a game screen looks like its falling below the mountain.
2) it is the mountain that seems to be rotating. Do I need to switch the main camera to be the first person camera. Why does the mountain appear to be rotating?


texts:
I'm serializing a data structure to XML using the IntermediateSerializer class.  This data structure has an XNA Rectangle in it.  The rest of the data structure outputs fine, but the Rectangle part outputs as:

<Bounds>
  <Location>
    <X>15</X>
    <Y>0</Y>
  </Location>
  <Size>
    <X>16</X>
    <Y>13</Y>
  </Size>
  <X>15</X>
  <Y>0</Y>
  <Width>16</Width>
  <Height>13</Height>
</Bounds>

Instead of the condensed form:

<Bounds>15 0 16 13</Bounds>

Previous experience has shown me that I really want the condensed form so my other program can read in the Rectangle correctly.  How do I get the serializer to write it that way?


texts: I am confused . what shall I set the orthographic camera viewport in libGDX when I use box2d , in one tutorial I saw that he divided his viewport numbers to 32  because 1meter =32 pixel , but I think it will make the images to be displayed by lower quality , so can anybody explain me what viewport shall I set ?


texts:
I'm currently porting a game written in C# with XNA library to Android with Monogame.
I have a Texture2D and i'm trying to get an array of uint in this way:

Texture2d textureDeform = game.Content.Load<Texture2D>("Texture/terrain");
uint[] pixelDeformData = new uint[textureDeform.Width * textureDeform.Height];
textureDeform.GetData(pixelDeformData, 0, textureDeform.Width * textureDeform.Height);

I get the following exception:

  System.Exception: Error creating framebuffer: Zero at
  Microsoft.Xna.Framework.Graphics.Texture2D.GetTextureData (Int32
  ThreadPriorityLevel) [0x00000] in :0

I found that the problem is in private byte[] GetTextureData(int ThreadPriorityLevel) creating the framebuffer:

private byte[] GetTextureData(int ThreadPriorityLevel)
{
            int framebufferId = -1;
            int renderBufferID = -1;

            GL.GenFramebuffers(1, ref framebufferId);  // framebufferId is still -1 , why can't be created?
            GraphicsExtensions.CheckGLError();
            GL.BindFramebuffer(All.Framebuffer, framebufferId);
            GraphicsExtensions.CheckGLError();
            //renderBufferIDs = new int[currentRenderTargets];
            GL.GenRenderbuffers(1, ref renderBufferID);
            GraphicsExtensions.CheckGLError();

            // attach the texture to FBO color attachment point
            GL.FramebufferTexture2D(All.Framebuffer, All.ColorAttachment0,
                                    All.Texture2D, this.glTexture, 0);
            GraphicsExtensions.CheckGLError();

            // create a renderbuffer object to store depth info
            GL.BindRenderbuffer(All.Renderbuffer, renderBufferID);
            GraphicsExtensions.CheckGLError();
            GL.RenderbufferStorage(All.Renderbuffer, All.DepthComponent24Oes,
                                   Width, Height);
            GraphicsExtensions.CheckGLError();

            // attach the renderbuffer to depth attachment point
            GL.FramebufferRenderbuffer(All.Framebuffer, All.DepthAttachment,
                                       All.Renderbuffer, renderBufferID);
            GraphicsExtensions.CheckGLError();

            All status = GL.CheckFramebufferStatus(All.Framebuffer);

            if (status != All.FramebufferComplete)
                throw new Exception("Error creating framebuffer: " + status);

...
}

The frameBufferId is still -1, seems that framebuffer could not be generated and I don't know why.
Any help would be appreciated, thank you in advance.


texts: I've created plenty of 2D games and now that I've gotten my hands dirty working with 3D in opengl I want to start a game. The issue is I don't know how I can store all the map data. Not only the terrain but the textures and objects in the world, lighting, what's intractable etc. it seems that it'll get way to big if I don't have an efficient system for storing and loading maps. So what methods or articles can you guys suggest on this?


texts: Problem with shooting. Projectile is missing target from about 5 degrees to about 30 degrees

texts:
I'm trying to make projectile shooting code. But there is a problem, in most cases projectile is missing target.

-sprite is origin of projectile
-bulletSprite is a projectile
-mouse is a target

float moveX, moveY;

void getTarget(){

float directionX = sf::Mouse::getPosition().x - sprite.getPosition().x;
float directionY = sf::Mouse::getPosition().y - sprite.getPosition().y;

float magnitude = sqrt((directionX*directionX) + (directionY*directionY));

moveX = directionX / magnitude;
moveY = directionY / magnitude;

bulletSprite.setPosition(sprite.getPosition());}

void fire(){
bulletSprite.move(sf::Vector2f(moveX, moveY));}

Looks like changing float to long double helps a bit.
Gif with this problem - https://drive.google.com/file/d/0BxPqUosXueuNY2FjcmluWlBZWW8/view?usp=sharing


texts: Most suited technology for browser games?

texts:
I was thinking about making a 2D MMO which I would in the long run support on various plattforms like desktop, mac, browser, android and ios.

The server will be c++/linux based and the first client would go in the browser.
So I have done some research and found that webgl and flash 11 support hardware accelerated rendering, I saw some other things like normal HTML5 painting.

So my question is, which technology should I use for such a project? My main goal would be that the users have a hassle free experience using what there hardware can give them with hardware acceleration. And the client should work on the most basic out-of-the-box pc's that any casual pc or mac user has. And another criteria would be that it should be developer friendly. I've messed with webgl abit for example and that would require writing a engine from scratch - which is acceptable but not preferred. Also, in case of non-actionscript, which kind language is most prefered in terms of speed and flexability. I'm not to fond of javascript due to the garbage collector but have learned to work around it.

Thank you for you time.


texts:
I am creating a simple concept where I have a small menu to choose a tool from and then I can click and drag to build.

For example, I click on the rails tool and then I can click and move the mouse to create a rail segment.

I'm coding it something like this(missing some variables for temp values and objects):

var toolSelected = false;//if I click the rails button, it changes to 'rails'

renderer.domElement.addEventListener('mousedown', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //create rail object starting in event coordinates
    }

});

renderer.domElement.addEventListener('mousemove', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //pass the mouse movement to the rail object to update end coordinates position so I can drag and see the potential rail
    }

});

renderer.domElement.addEventListener('mouseup', function(event){

    //here I check which is the tool selected
    if(toolSelected === 'rails'){
        //indicate that the rail should be finished and build it with the mouse up coordinates
    }

});

The question is, is there a better or recommended way to structure these mouse events? Or do I have to, under each mouse event, check which tool is selected and perform the appropriate actions?


texts: Time per turn in a .NET turn-based game?

texts:
I am developing the server for a browser game, it uses an ASP.NET API for authentication, login and character creation and a websocket for the rest of the game (Microsoft.Web.WebSockets).

While on combat mode, each character will have a fixed amount of time to carry out their actions.

is there a way to keep track of the time on the server or should I create a different server to serve as time master ?

Which method/library should I use to control the time ?


texts: I'm looking into starting a project on RMMV; a medieval fantasy with a heavy focus on storytelling. For part of that storytelling, I was hoping to include "cutscenes" composed on images and text to illustrate important events. I could hire an artist online but I would need a lot of images to accomplish my ends. Now, I've watched my wife play "The Sims" franchise for awhile now, and that game is heavily and widely modded by its fanbase, and a large focus on that is historical in theme. If I were to use a posing mod to illustrate scenes from my game in "The Sims 2" and then edit them to my liking, would I be facing any legal troubles from EA Games? I would certainly credit the game and any modders, but I wonder if that would be enough, especially if I were to attempt a commercial release.


texts: Unity - OnTriggerEnter & OnTriggerExit strange behavior

texts:
I am having a trouble with OnTriggerEnter with a lot of objects.

I have a NavMeshAgent moving randomly throught the scene, then I have a sphere collider inside a children to detect nearby objects. If the object has an allowed tag it adds to the objects_near List.

It starts working right, but when it is working a few secs it starts dropping the objects_near variable to a wrong value, sometimes to 0, then, a few minutes later it drops to 0 permanently.

Is it a Unity bug? Is it my fault because I am using a lot of resources?

https://imgur.com/toLIMew

    void OnTriggerEnter(Collider col)
    {
        string tagname = col.gameObject.tag;

        for (int i = 0; i < tags_allowed.Length; i++)
        {
            if (tags_allowed[i] == tagname)
            {
                objects_near.Add(col.gameObject);
            }
        }
    }

    void OnTriggerExit(Collider col)
    {
        string tagname = col.gameObject.tag;

        for (int i = 0; i < tags_allowed.Length; i++)
        {
            if (tags_allowed[i] == tagname)
            {
                objects_near.Remove(col.gameObject);
            }
        }
    }


texts:
Im trying to set a constant buffer in my shader with a value. But getting nothing, no results.

Code in shader

cbuffer MatrixBuffer : register(b0)
{
    float4 test;
};

----------------------------------------------------------------
In main part

#pragma pack(push,1)
struct CB_GBUFFER_UNPACK
{
    D3DXVECTOR4 test;

};
#pragma pack(pop)

            D3D11_BUFFER_DESC cbDesc;
        ZeroMemory( &cbDesc, sizeof(cbDesc) );
        cbDesc.Usage = D3D11_USAGE_DYNAMIC;
        cbDesc.BindFlags = D3D11_BIND_CONSTANT_BUFFER;
        cbDesc.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
        cbDesc.ByteWidth = sizeof( CB_GBUFFER_UNPACK );
        device->CreateBuffer( &cbDesc, NULL, &m_pGBufferUnpackCB  );

            D3D11_MAPPED_SUBRESOURCE MappedResource;
            ic->Map( m_pGBufferUnpackCB, 0, D3D11_MAP_WRITE_DISCARD, 0, &MappedResource  );
            CB_GBUFFER_UNPACK* pGBufferUnpackCB = ( CB_GBUFFER_UNPACK* )MappedResource.pData;

            pGBufferUnpackCB->test.x = 10.0f;
            pGBufferUnpackCB->test.y = 10.0f;
            pGBufferUnpackCB->test.z = 10.0f;
            pGBufferUnpackCB->test.w = 0.0f;

            ic->Unmap( m_pGBufferUnpackCB, 0 );
            ic->PSSetConstantBuffers( 0, 1, &m_pGBufferUnpackCB );

What seems to be my problem?


texts:
I've seen many a time in source code, things like this [well, this is more of a pseudo C++ idea of mine]

typedef shared_ptr<Resource> ResourcePtr;// for ease
ResourcePtr sound1 = resourceManager.Get<SoundResource>("boom.ogg");
sound1->Play();
ResourcePtr sprite = resourceManager.Get<Image>("sprite.png");

I was just wondering how useful a class like this was, something that:

Loaded media files
Stored them in memory
Did this at the start of a level - loading screen.
Cleaned up

Rather than having a system of:

Resources are held by entities only, or loose.
Responsible for own load into memory.

The first is a 'manager' as such; something I feel indicates it's wrong to use. However, it allows for something like a vector of resource names to be passed, rather than having to scramble around finding everything that needs to be loaded.


texts: Color Based Collision Javascript (Cocos2d-js)

texts:
I'm looking to make an isometric game so my partner designed the isometric map (jpg image) along with the map objects (png) on Adobe Illustrator. The thing is I would like to set the player path based on color, for example if the terrain is white the player can go through, if it's black then the player is not allowed to pass. Is this a viable method to do this or are there better methods? Also I'm using Cocos2D-js so my coding is JavaScript

I would appreciate any suggestions.


texts:
I downloaded asset from Quixel, I'm using Unity HDRP, the problem I am facing is how to properly create a mask map cause the asset from Quixel doesn't have metalness map where in HDRP mask map it requires channel R should be metalness map, and the base map requires RGB color and I've got diffuse map from the asset, to put diffuse map to the basemap slot the right way to do? I'm fairly new to the channel, so put it simple
1.How to pack channels for mask map if no metalness map in the asset, what to do with the empty channel
2.Is it right to put diffuse map to basemap slot?
3.What to do with the detail map in the maskmap , the same as to no metalness map provided in the asset.
4.Another question is heightmap, Unity provide pixsel mode and vertex mode, what is the consideration before choose the displacement mode, When I choose pixsel mode, the whole texture seems to be lowered down not the pixsel on the texture surface bumped or lowered down, it is the whole texture moved.
Thanks for answering these!


texts: Problem with default 3rd person controller in Unity 4

texts:
I am new to Unity. Whenever I am importing the default 3rd person controller (construction worker) in my scene and clicking the play button, the model seems to be in the running pose.

The control keys are working properly, and I am also being able to make the character stand, walk, run and jump properly.
Only problem is that it is always in the running pose - which looks very odd.
I did not make any change to anything. I just imported the controller as is.

Can someone please tell me how to correct this issue?

P.S. I hope my question was clear.


texts:
I was having a conversation with someone who believed that components of a games code where subcontracted out to programmers in different countries where it would be cheaper, then assembled by the local company.
I understand that people often use pre-built engines but I would think that making the actual game would require people to work closely in the same studio.

I couldn't find much clear information on this when I looked, does anyone know?


texts: How to make sure spinning objects hit a target with the right end?

texts:
I'm working on a throwing knife type weapon where a player free aims and then throws a knife. The knife spins through the air and on collision stops spinning and parents itself to the object it collided with. The spinning is handled via animation while the path of the knife is handled by physics.

One problem I'm facing is how to make sure that when the knife collides with an enemy that the knife will be facing towards them. At the moment what is happening sometimes is that the knife embeds into an enemy handle first. Which is obviously unrealistic. At the same time, I think it would be quite unreasonable for the knife to only "hit" the enemy if it collided blade first, since the rate at which the knife spins is beyond the player's control.

I've been watching a lot of slow killcam footage of similar weapons and each time the weapon is thrown it spins through the air and magically always ends up with the blade pointing at its target. For a game where the throwing distance will be consistent, this is quite straight forward to do. But I'm not quite sure how to predict this since there are many unpredictable factors involved eg. direction of the knife, rotation of the knife, position of the enemy, distance from enemy etc. If possible, I would prefer not to have to use complex prediction logic since the game will be for fairly low end devices. Is there a "smoke and mirrors" way to solve this?

Example: https://youtu.be/0fav8lFpBko?t=42s


texts: Libgdx drawing semi-transparent circle on pixmap

texts:
I am currently working on an android game using libgdx and would like to add a joystick to its interface. For this I use the built-in touchpad class. Untill now I have used external images for rendering the background and joystick. Now, I would like to dynamically draw the background of the joystick. This would make it possible to make the background of the joystick semi-transparent and to change the color of the background dynamically.

To do this, I implemented the following:

public class Joystick{
    private Touchpad touchpad;
    private static TouchpadStyle touchpadStyle;
    private Skin touchpadSkin;

    public Joystick(GameWorld world, GuiComponent gui) {
        touchpadSkin = new Skin();
        touchpadSkin.add("touchKnob", new Texture("data/touchKnob.png"));

        touchpadStyle = new TouchpadStyle();
        touchpadStyle.knob = touchpadSkin.getDrawable("touchKnob");;

        Pixmap background = new Pixmap(200, 200, Format.RGBA8888);
        background.setColor(1, 1, 1, .6f);
        background.fillCircle(100, 100, 100);
        touchpadStyle.background = new TextureRegionDrawable(new TextureRegion(new Texture(background)));

        touchpad = new Touchpad(10, touchpadStyle);
        touchpad.setBounds(15, 15, 200, 200);

        gui.inputStage.addActor(touchpad);
    }
}

As you can see, this code provides a joystick with a semi-transparent background: Joystick with semi-transparent background

However, this background has some inexplicable lines that are not transparent. Does anybody know what causes this? I thought it could have something to do with the format of the pixmap, but after trying with some other formats, there was not much improvement.


texts:
How can I create a menu that slides up while "un-fading" as illustrated in this video?

As you can see in the video, the menu also falls down a bit in the end which gives it a realistic feel. I really have no idea on how to approach this, and searching the web did not help either.

Any help is appreciated.


texts: How to create a realistic 2D Role-Playing game collision detection?

texts:
I’ve always wanted to create an old-fashionned 2D Role-Playing Game like Star Ocean, Final Fantasy, Sword of Mana and even the “Tales of” series, and I guess a lot of people do. But before even writing a single line of code I did a lot of research, drawing and tryouts.

I've found almost all the answers to my questions but there is a problem I haven’t been able to solve: How do you create a realistic but yet simple collision detection, like in the games I named before?

I already know several ways of calculating collision detection, look at the following examples:

None of these satisfy my needs.

Tile-based collisions are way too simple and suits more a Zelda than a Star Ocean. Plus, the drawing of each tile needs to fill up all space in order to look realistic.
Pixel-perfect has too many constraints. If your tile has some pixel here and there,  the player will most likely get stuck in the midle of nowhere(ie: in some games you get stuck on a 2 pixels width tree root).
And binary masks uses too much memory and settings imo.

I've read alot of documentation but I never found something that looked good to me. And all my tryouts didn't look close to what I used to play with. So if you have any good links or tutorials on how evolved 2D RPG work please let me know.


texts: What are the technical certification requirements for the Xbox 360?

texts:
I came across this document listing the technical certification requirements from March 2009, but I haven't been able to track down anything more up-to-date, nor have I been able to find the "terminology list" that the document refers to.

Is there a current version that is available to non-developers like myself?


texts: How can i create a 2 player turn-based board game on a separate android device using unity?

texts: im trying to make a 2 player turn-based board game, i have already made the connection between 2 device. I used photon. They both connect but i don't know how to sync them both to the game. can any one help me? i hope my question is right.


texts: How to throw b2body with various speed at fixed position?

texts:
Above image is for ref to better representation.

I have box2d object and i know start point & end point position.

Now i want to give any force or impulse such that b2body will first collide at end point BUT with different speed also should collide at that same end point.

How should i achieve this?


texts: Instantiating on a random node, provided the node is walkable, but what if it isn't walkable?

texts:
In my demo I have a GUI where the user determines the number of AI that will spawn. I would like these AI to spawn onto the walkable area of my Grid. So I choose a random position then get the node from that, then check to see if the node is walkable, if it is then instantiate the game object at that position, however my problem here is that if it is not walkable I would like a new random position to be chosen and then checked again to see if it is walkable all the while looping until the number of game objects specified have been created. How do I go about the last part of this? I can't get my head around the logic.

        for(int i = 0; i < intBlinkyCount; i++)
                {

                    Vector3 pos = new Vector3(Random.Range(-(floatGroundScaleX/2*10), floatGroundScaleX/2*10), 0.5f, Random.Range(-(floatGroundScaleZ/2*10), floatGroundScaleZ/2*10));
                    Node randomNode = grid.NodeFromWorldPoint(pos);

                    if(randomNode.walkable)
                        {
                            Instantiate(blinky, pos, Quaternion.identity);
                            blinky.name = "blinky"+i;

                        }
                    else
                        {

                        }

                }


texts: Unity / Box2D / Raycasting and Performance

texts:
Im currently using the Unity Engine and the Box2D Physics Engine.

I have this line of code:

    "RaycastHit2D ray = Physics2D.Raycast(origin, direction, distance);"

Im planning to use this line of code ... like "a lot" times (maybe like 100.000 times per frame)

And I have 3 simple Questions about Raycasting and Performance:

How much does 1 Raycast cost (approximately).
Is the Raycast processed by the CPU now or by the GPU?
Does the number of the BoxColliders affect the cost of the Raycast? (for example:
If I have 1000.000 Tiles on the map which have box Colliders, does one ray has the same performance cost as if i would have 1 single Tile?
And if I have 1000.000 tiles - is the cost millionfold then?


texts: Convert transform from world to local space

texts:
I have a hierarchical node system. Given a world space transform, I need to obtain the transform for a specific node in local space.

My Node class has the following method.

public void worldToLocal(Matrix4 world, Matrix4 local) {
    if (dirty) update();
    local.set(worldInverse).mul(world);
}

worldInverse is the inverse of the node's world transformation matrix.

I'm using LibGDX, so this is equivalent to doing:

LOCAL = T^-1 * WORLD

T^-1 being the inverse of the node's world transform. However, this doesn't seem to be working correctly.

Let's say we have a node at (2, 4, 0) rotated 180 degrees along its Z axis.

    Node node = new Node();
    node.setPosition(2.0f, 4.0f, 0.0f);
    node.rotate(new Vector3(0.0f, 0.0f, 1.0f), 180.0f);

Now, the point (1, 7, 0) should be (2, 1, 0) in local space for that node.

    Matrix4 local = new Matrix4();
    Matrix4 world = new Matrix4();
    Vector3 pos = new Vector3();

    world.translate(1.0f, 7.0f, 0.0f);
    node.worldToLocal(world, local);
    local.getTranslation(pos);

However, I get (1, -3, 0).

I'm using this operation to translate from world space Bullet body transforms to local node transforms.


texts: Computing orbit direction depending on angle of approach

texts:
I'm trying to develop a simple 2D space game with no friction using corona-sdk. In the game, I have several planets which all applies forces to the player according to Newton's law of universal gravitation. Once the player is close enough to a planet, I need to put him in orbit. I do so, by creating a pivot joint between the planet and the player. From the player's liner velocity, I compute the joint's motor speed in order to achieve an as much as possible smooth cyclic rotation around the planet.

The solution, which might not be optimal (in future versions I would like to avoid completely the joint), so far is working but I'm not able to determine correctly the joint's rotation direction. The rotation of the player around the planet should be CW or CCW depending on the player's angle of approach. How do I compute that ?

Thanks !


texts: Determine the cut sections of a polygonal mesh

texts:
I have a polygonal mesh, defined by vertices $V$, edges $E$ and face $F$. One can view this as a real life 3D terrain.

I want to obtain cut sections of this terrain, defined by vertical cut planes. What are the algorithms I can use to determine the cut sections of the terrain in an efficient manner? The cut section here is just a polyline that are the intersection lines between the cut section vertical plan and the polygonal mesh.

Edit:  Since my elevation map is a mesh, this means that I know every information associated to a vertex, face and edge, e.g, which faces are connected to which edge.Is it possible to leverage this information in order to speed up the cut section further?


texts: Large-Scale Case Handling for 2D Procedural Environment

texts:
I am creating a procedurally generated side scroller and I have a question regarding proper code structure/Architecture when it comes to connecting different platforms and large scale cases. There are various platform types I need to connect (e.g. a hill which leads into a tunnel which then leads into a cave, etc). I can successfully generate and connect the meshes using a bezier curve. My problem is that the way I am handling each platform connection case seems very clunky/inelegant the more I expand.

Currently I am using switch statements to handle each scenario like the above mentioned. Below is a small snippet of how I am handling each case.

public void SetTransition(int PrevPlatform, int CurrPlatform , Vector3 LastPosition)
{
    switch (PrevPlatform) {
    case 0:
        GroundTransition (CurrPlatform,LastPosition);
        break;
    case 1:
        CaveTransition (CurrPlatform,LastPosition);
        break;
    case 2:
        WaterTransition (CurrPlatform,LastPosition);
        break;
    case 3:
        TunnelTransition (CurrPlatform,LastPosition);
        break;
    case 4:
        WallJumpTransition (CurrPlatform,LastPosition);
        break;
    }
}

From here I have separate functions that handle the cases using more switch statements. The problem now is that I am starting to have a large number of branching functions that are relying each case. My code structure is becoming this large tree of switch statements. For the most part it works but I wanted to reach out to other developers before I continued this route. Is there a more effective, organized methodology to handling large scale cases?


texts: Computing how fast a vector should go toward certain direction

texts:
I have two object in space, one has velocity (object A) with fixed magnitude, and one is static (object B).
every timestep, I add to object A's velocity a vector which direction is object A to object B, and then make the length of velocity back again (so after this addition, only angle changed), then I move object A using this new velocity (with its magnitude multiplied by fixed timestep), so at the next timestep, the additive vector will have different angle because object A had moved.
If I keep doing it every timestep, the angle between velocity vector of A and vector that goes from A to B will go toward (small enough) zero.
How do I calculate the magnitude of the additive vector so that the angle will go to zero after x seconds?


texts:
My effect file compiles successfully, but FindNextValidTechnique fails.

Technique part of the shader:

technique Diffuse
{
    pass Pass0
    {
        VertexShader = compile vs_2_0 VertexShaderMain();
        PixelShader = compile ps_2_0 PixelShaderMain();
    }
}

I try to get the first valid technique after compilation:

pEffect->FindNextValidTechnique(NULL, pValidTechnique);

This returns some minus value which doesn't go along with D3D_OK.

I've used other flags than D3DCREATE_HARDWARE_VERTEXPROCESSING to test, but no result with them either.

UPDATE

I've read in documentation that, "Applying Compiler Flags or Assembler Flags to the incorrect API will fail shader validation.", but I'm not sure this applies to the compile time validation or afterwards. I have no problem in compile.

I compile with these flags:

D3DXSHADER_DEBUG |
D3DXSHADER_NO_PRESHADER |
D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT |
D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT


texts: How to move from A to B, with check and fix the destiny?

texts:
I only found the formula for check the collision between two lines. But never about of movement and fixed from one point to other point in one of the line.

I need move from pA to pB and if take collision in one line (wall), move around before of the wall to the new destiny point fixed.

Where found this and/or which is the formula?


texts: Why does Unity heavily blur edges of a single cube despite 8x antialisaing

texts:
I was messing around a random project and everything was working perfectly, when all of a sudden jagged edges appeared on all objects. I've been trying to resolve this issue for the past two dails, only to no avail. I have tried changing various settings, when at last I've uninstalled unity and removed all projects. After re-installing it, however, the problem still persists:

What I've tried:

changing settings in Nvidia Control Panel (for example, settingantialisaing mode to application-controlled)
changing the Quality settings inside Unity
removing any normal/texture maps
changing metallic and smooothness of the material and removing specular highlights
reinstalling Unity

These pictures depict current settings/object properties:

Properties of material added to the cube

Camera properties:

Quality settings:

Graphics settings:


texts: Optimal way to store coordinates of a random point in 3D space in a texture?

texts: A quick question: there is a well-known approach to store 3d point in space in a texture as a distance between camera and an object (deferred rendering). But it implies that the object lies on a ray, cast from the camera towards that object in such and such section (UVs) of the texture. Is there any way to store a RANDOM 3d point in space in a texture with a single (mb 16-bit) depth value or less than 3 values?


texts: How much slower is it to draw on "half pixels"?

texts:
I've noticed that games like Diep.io are using floating decimal points for thin stroke lines on the grid. I have even tried this myself, by adding 0.5 to all of the positions for the grid lines to make the lines more thin.

I heard it from a friend that drawing on half pixels causes the GPU to do more work to smooth it out, like anti-aliasing. I am really trying to make my game look nice, by making the most smoothest lines as I can. How much slower is it really, and should I use it in an online competitive 2D game using Canvas?


texts: How to move a object to a target point like sine wave in 2D world

texts:
I want to move my gameobject to move point A to target point B like sine wave, I have used Vector2.Lerp but its just straight line.
so far I tried many ways and I managed this

//sine wave
vLastPos = new Vector2(transform.position.x , Mathf.Sin(Time.time)*2f+2f);
transform.position = vLastPos+Vector2.right*Time.deltaTime;

but the problem is its moving the gameobject left to right not to target position. the gameobject shold reach the target position and stop. please help me.


texts: How can I move objects on to positions declared by their clicking order?

texts:
I'm trying to create a quiz game with clickable letters. How can I move them to another area based on their clicking order?

Though you probably already understand what I'm trying to ask, lets clarify:
If I was to click the "H" letter first, it would move to the first white box, clicking "O" after that, would move it to the second white box etc.


texts: Updating OpenGL ES 1.1 based iPhone game to use Open GL ES 2.0

texts:
I'm fairly new to anything OpenGL in general.  I've made an OpenGL ES 1.1 based 2D iPhone game by working from sample code.  I'm under the impression that OpenGL ES 2.0 is substantially different from 1.1.  So what does updating 1.1 code to 2.0 entail?

I'm accustomed to the kinda basic drawing pattern of "push matrix, translate, rotate, draw 2D texture, pop matrix".  What's the "equivalent" in 2.0?


texts: Details of what GPU actually do when clipping in 4D homogeneous space?

texts:
I am learning programmable rendering pipeline by implementing a tiny software renderer. I try to implement it in a 'hardware' style. However, I am not familiar with the GPU pipeline and got some problems of homogeneous clipping.

The homogenous clipping space contains a w variable which various at each vertex. Is each vertex object's homogenous coordinate (between projection matrix and homogenous division by w) at its own clipping space? If so, how to clip the lines and triangles nearer than the Frustum or even stretching behind the camera (i.e. w <= frustum_znear)?

Update: this thread says that the clipping in homogeneous space is directly an intersection problem in the 4D homogeneous space. Which means the intersection point is p_vec4 = t * point1_vec4 + (1 - t) * point2_vec4. Say I have P0(-70, -70, 118, 120) and P1(-32, -99, -13, -11) in 4D homogeneous space, and the intersection point with plane w = -z (which in NDC is z = -1) is (-35, -96, -1, 0.9) t = 0.99, how to get the corrresponding vertex object in NDC space?

And once I get the correct intersection point, should I do the interpolation between vertex objects produced by vertex shader to get new vertex object?


texts: How can I remove branches from a fragment shader function?

texts:
I have a fragment shader, when I've carefully managed to remove most branching decisions, as I have found out through research here that they are bad.

But I have one function that I just can't work out how to do it without them.

The function takes in a HSV vector, and 'expands' it. By that I mean any Value (V of HSV) from 0.0 to 0.5 gets expanded to 0.0 to 1.0. Any Value from 0.5 to 1.0 gets de-saturated, so that it becomes more white. At V=1.0 any input colour is white.

Here is my working function. Can anyone help me de-'if' it?

//expand doubles the level up to 0.5=> 1.0
//for over 0.5 then the saturation is reduced from where it is now (V=0.5) to 0.0 (v=1.0)
vec3 expand() {
    vec3 expanded;
    float newSaturation;
float newValue;

//HSV = rgb2hsv(inputColor);
if (HSV.z < 0.5) { //x = Hue,y = Sat,z = Val ,w= bugger all
    newValue = HSV.z * 2.0; //double value 0.0 to 0.5 => 0.0 to 1.0
    //no need to touch saturation
    newSaturation = HSV.y;
} else {
    newValue = 1.0; //value is max
    //need to de-saturate proportional to level over 0.5 : (1.0 - ((v - 0.5) * 2)) * s
    newSaturation = (1.0 - ((HSV.z - 0.5) * 2.0)) * HSV.y;
}

expanded = hsv2rgb(vec3(HSV.x, newSaturation, newValue));
return expanded;
}


texts: Collision representation in game overworlds

texts:
I'm implementing a 2D overworld where one can walk through an area that is not tile based. I was wondering the best way to implement collisions. In the past when I've done similar things, I've used one image (or set of images) to show an elaborately drawn world and then a second binary image that does nothing but differentiate "wall" and "not wall". Then, I'd use the first for all drawing to the screen, but the second for collision detection. Having another image of the same size to represent collisions seems like lots of overhead. Is there a better way to handle this?

(I'm currently using C++ with SDL, although I'm more interested in general concepts)


texts:
I'm working on a 3d terrain. I tried out some existing GLSL implementations for bump mapping using normal maps from a Procedural Infinite 3D Cave Generation tutorial.
The actual code that I used is in the Cave3D repository, not the one in the post. Here's their vertex shader and their fragment shader. The textures can be found on the same repository.
Note that this shader uses tri-planar texturing.
The problem is that I'm getting the following artifacts - black spots:

Does anyone have a clue why this is happening?


texts: How to detect aging signs with ARkit / AR foundation?

texts:
How Do I approach the matter of detecting skin color, wrinkles, age estimation using ARkit / AR foundation in unity ?
I haven't found any tutorials online that can help on this.


texts: Continous Movement and Gravity Switch With 1 button

texts:
I have a sphere with a rigidbody on it, and it moves to the right continously as I need it, but as it moves I want the space bar to be able to switch the gravity (so it either rides on the ceiling or on the floor), as it moves along to the right.

Please help, have been googling consistently for the past 3 hours.

Here is the code I have so far:

public class movement : MonoBehaviour {

    public float movementSpeed = 10;
    private bool haspressed;

    void Start()
    {
    }

    void FixedUpdate()
    {

        transform.Translate(Vector3.down * movementSpeed * Time.deltaTime);

        if (Input.GetKeyDown ("space") && haspressed == true) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = false;
        } else if (Input.GetKeyDown ("space") && haspressed == false) {
            transform.Translate (Vector3.right * movementSpeed * Time.deltaTime);
            haspressed = true;
        }
    }
}

Thank you sooo much!


texts:
I have just recently started using Maya LT so forgive me if I am asking a silly question.

I am trying to model a meteoroid in Maya LT of about 8km in diameter and I am trying to model it to scale. Now I know this sounds like crazy-talk but I don't want a procedurally generated model or a model using a UV-map.

The largest (metric) unit type in Maya is meters, so I have set this to meters and try to create the model at its actual size.

For starters I created a sphere of 2 units in diameter and set the scale to 4000. This results in me seeing nothing. When I try to frame the object I just get a gray screen and I am unable to edit it properly. I feel that my model might be getting a bit to big for the application.

What is the best approach for modelling such large environments. Should I scale it down, add smaller details and scale it up in Unity? How would I best go about this?


texts: How to get buttons to follow the GUI perfectly while also being usable in GameMakerStudio

texts:
Basically I'm trying to figure out how to make a button, that you can interact with that shows above the GUI draw event and locks perfectly to the screen.

The current draft I have the button is below the GUI layer so I need it above

The button is functional so thats good

The button does not lock perfectly to the screen when the camera stops it lags behind and has to catch up to the camera no matter what direction I move, I dont want the player to see the button actually following I want all the parts to move seamlessly together.

This is a gif of whats happening


texts: I imported vertex positions, indices and normals successfully in OpenGL using fbx sdk, but I just can't figure out how to import vertex colors. I tried to fetch the pointer to array of colors trough mesh layer but it returns null. Can anyone help me with this one please?


texts: XNA Vertex buffer/Index buffer high memory usage?

texts:
I've got about 120mb of vertex and indices data, but when I set the data in the vertex and indices buffer it ramps up to about 300mb of memory used, this isn't really acceptable and I don't know why it is, my code to set them is:

        vertex_buffer = new VertexBuffer(device, VertexPositionColor.VertexDeclaration, chunk_vertices.Count, BufferUsage.WriteOnly);
        vertex_buffer.SetData(chunk_vertices.ToArray());
        index_buffer = new IndexBuffer(device, IndexElementSize.ThirtyTwoBits, chunk_indices.Count, BufferUsage.WriteOnly);
        index_buffer.SetData(chunk_indices.ToArray());


texts: D3D12 ConstantBuffer - Shader receives wrong values

texts:
im having trouble with one constantbuffer:

struct CameraConstData
{
    urd::Matrix projection; // 64 ( 16 floats)
    urd::Matrix view;       // 64 ( 16 floats)
    urd::Vec3 viewPosition; // 12 ( 3 floats)
    urd::Vec3 viewDir;      // 12 ( 3 floats)

    // 104 bytes (26 * 4)
    float offset[26];
};

inside the shader its defined like:

// desc heap cbv
cbuffer CameraConstBuffer : register(b0)
{
    float4x4 projectionMatrix;
    float4x4 viewMatrix;
    float3 viewPos;
    float3 viewDir;

}

now viewdir is always filled with wrong buffer indices.

viewDir.x is the passed y value
viewDir.y is the passed z value
viewDir.z is 0.0

checked it in the shader like:

float3 vpos = normalize(float4(viewDir, 0.0)).xyz;
//float value = vpos.x; // uses the passed y value
//float value = vpos.y; // uses the passed z value
color = float4(vpos, 1.0);

GPU Debugging shows that the constant buffer looks fine:

i checked the vectors against the cpu side and they match.

So why is the shader reading index 36-38 instead of 35-37?

Its always affecting the 4th member of the struct. If i switch viewPosition with viewDir, viewPosition is false.


texts:
I have an UMA that I want to be in a sitting position basically forever. I assume I need an animation that will put him in an idle sitting position.

I found the MoCap Huge Animation library for free in the Assets Store, but it is so big that I don't know which animation is sitting.

Does anyone know of an idle sitting animation that I could use? Or specifically which number (ie 02_01) of the MoCap Huge Library which has one?


texts:
I'm trying to create a simple beer pong game in Unity. The basic idea is this - when it's your turn to shoot, you use your mouse to pick a point on the table that you want the ball to hit and bounce off of.

Then you press the left mouse button, and while it's pressed, move it up and down to determine the degree of the arc of the shot (the ball should hit the same previously chosen spot on the table no matter which degree is chosen).

The arc should be visible as well. It would look something like this:

So my questions are:

Given a target point and a launch angle, how do I calculate the trajectory?
Given the same, how do I calculate the force to apply to the ball?
What is the best way to display the trajectory in Unity? My first idea is manually placing a bunch of particles (which is how I did it in the screenshot), but I'm not sure if that's the best choice performance-wise.


texts: How can I cut a doorway through my wall at runtime?

texts:
I am working on a Unity project where I have 3 models: a stacked, rounded wall (think logs), a flat wall (think bricks), and a door.

The door has an animation to open / close itself, and when it's attached to a wall, there's one major problem -- when the door swings in, it reveals not the empty space one would expect, but the segment of wall it's layered on top of!

Since all 3 models are part of dynamic mesh structures, I can't "pre-calculate" what the model should look like to account for the empty space of the door -- what if the player puts the door on the next segment of wall instead?

I considered expanding the "door" model to a "door + wall segment" model (replacing that wall segment entirely), but because I already have two separate shapes of wall, it quickly becomes a combinatorics problem -- 2 models for each door, per door shape (not to mention windows, or a 3rd [or fourth!] wall shape!). In short, this doesn't seem like a tenable solution.

What would work most cleanly is if I could remove a "Door-shaped" segment of my Wall segment mesh, leaving a clear hole that the Door model could snugly fit.

In an equation: Final Mesh A = Mesh A Volume - (Mesh A Volume ∪ Mesh B Volume)

Is an operation like that feasible? My gut tells me that polyhedron intersection is hard, and there might be a better way to do this. I'm also equally interested if someone has a better suggestion on how to solve the initial problem of doors intersecting with wall segments.


texts: how to stop camera at the end of world map when zoomed in

texts:
Im building a tile-based game, and Im trying to implement zooming in on the center of the screen.
My problem is, when I get to the edge of the map and im zoomed in, Im noticing that my camera doesn't scroll all the way to the very last tile when zoomed in. If my zoom scale value is 1(not zoomed in), the camera moves to the last edge of the tile map just fine.

I have a feeling my matrix math is wrong, and I should be setting the position of the camera differently. It could also be that my tile map edge checking is incorrect. I currently limit the user to zoom in by a factor of 2 at maximum

Heres my code:

public class CameraPositionComponent : PositionComponent
{
    private Vector2 mOrigin;
    private Viewport mViewport;
    private Matrix mMatrix;
    private float mZoom;

    public CameraPositionComponent(int x, int y, Viewport viewport, Entity owner) :   base(x, y, owner)
    {
        mZoom = 1.0f;
        mViewport = viewport;
        mPosition = new Vector2(viewport.Width / 2, viewport.Height / 2);
        mOrigin = new Vector2(viewport.Width / 2, viewport.Height / 2);
        mMatrix = Matrix.CreateTranslation(1, 1, 1);
    }

    public Matrix Matrix
    {
        get { return mMatrix; }
        set { mMatrix = value; }
    }

    public float Zoom
    {
        get { return mZoom; }
        set { mZoom = value; }
    }

    public Vector2 Origin
    {
        get { return mOrigin; }
        set { mOrigin = value; }
    }

    public Viewport Viewport
    {
        get { return mViewport; }
    }
}

public class CameraTouchComponent : TouchComponent
{

    public CameraTouchComponent(Entity owner) : base(owner)
    {

    }

    public override void Update()
    {
        GameTime gameTime = ServiceLocator.GetService<GameTime>();
        Camera camera = mOwner as Camera;
        CameraPositionComponent positionComponent = camera.PositionComponent;

       /////input handling here
      ////zoom/drag etc..

        if (positionComponent.Position.X < positionComponent.Viewport.Width / 2)
            positionComponent.Position = new Vector2((positionComponent.Viewport.Width / 2), positionComponent.Position.Y);
        if (positionComponent.Position.Y < positionComponent.Viewport.Height / 2)
            positionComponent.Position = new Vector2(positionComponent.Position.X, positionComponent.Viewport.Height / 2);
        if (positionComponent.Position.X + positionComponent.Viewport.Width/2 > TileMap.Width)
            positionComponent.Position = new Vector2(TileMap.Width - positionComponent.Viewport.Width/2,
                positionComponent.Position.Y);
        if (positionComponent.Position.Y + positionComponent.Viewport.Height / 2 > TileMap.Height)
            positionComponent.Position = new Vector2(positionComponent.Position.X,  TileMap.Height - positionComponent.Viewport.Height / 2);
        //positionComponent.Origin = new Vector2((positionComponent.Viewport.Width / 2) / positionComponent.Zoom, (positionComponent.Viewport.Height / 2) / positionComponent.Zoom);

        Layer layer = LayerManager.GetLayerOfEntity(mOwner);
        layer.Matrix =  Matrix.CreateTranslation(new Vector3(-positionComponent.Position, 0)) *
                  Matrix.CreateScale(positionComponent.Zoom, positionComponent.Zoom, 1) *
                   Matrix.CreateTranslation(positionComponent.Origin.X, positionComponent.Origin.Y, 0); ;

    }
}

All the bounds checking stuff seems wrong to me as well.


texts:
First the issue im having: Basically its the fact that the angles of a circle aren't continuous, they rise from 0 to 2pi then immediately fall back to 0.

I want to make a game where the player controls a tank and ive got a tank drive working but i want to implement a "Directional Drive" where the player can push a joy stick(XBOX360) in a certain direction and the tank will move forward and turn towards this direction.
heres the code i have to do that:

if (Math.Abs(controllerCOORD.Y) > Deadzone || Math.Abs(controllerCOORD.X) > Deadzone)
        {
            decimal intended_angle = (decimal)Math.Atan2(controllerCOORD.X, controllerCOORD.Y);

            double correction = (double)Decimal.Round((intended_angle - (decimal)this.BaseAngle_Rad), 1, MidpointRounding.AwayFromZero);

            this.BaseAngle_Rad += (correction / demultiplier_rot);

            this._x_pos += ((float)Math.Sin(this.BaseAngle_Rad) * multiplier_pos); //x component vector of movement
            this._y_pos -= ((float)Math.Cos(this.BaseAngle_Rad) * multiplier_pos); //y component vector of movement
        }

Unfortunately with this code, when the player pushed the joystick downwards(0,1), the angle it calculates approches pi from the right side and negative pi from the left side causing it to make a full turn in the wrong direction instead of like a few degrees in the correct direction.

How do i make the rotation continuous all the way around?
Ive already found these two questions on here but neither is helping me:

360+ degree rotation skips back to 0 degrees when using Math.Atan2(y, x)

Turning a sprite such that it rotates in the direction that's most efficient

Thanks


texts:
My game a sidescrolling platformer. I've created my own Tile app which in the end export an xml file detailing what each 32x32 space (in the entire image) contains (environment, platform, etc.). I get how to use it for static things/collision detection and quad trees and so forth but still have no clue how to use this map xml file for keeping my character on a path in my background image which in my case is a hill with lots of odd curves.

Also, yes, there are tutorials on tile movement, but they are mostly movement from a top-down view which is slightly more trivial to implement. 80% of the image in my game is just a pure background and the very bottom are bricks covered with grass with some weirder angles. The thing is, I can have mixed tiles of empty space and grass which contains a part of a curve so I don't know how I would want the player leg to interact with this.
Can anyone give me an idea or an example?


texts:
What i want to do is make the Player class inherit the Sprite class.

So I inherited it like this :

class Player: public Sprite {};

But when I go to my Player.cpp I get the following error :

  Error : No default constructor exists for "Sprite".

But it does have a constructor (well, 2 of them...) :

Sprite(int index, sf::Vector2f position);
Sprite(int index, sf::Vector2f position, float rotation);

Also, not sure if this is the right place to post this. But since it contains SFML library code I will post it here.


texts: Vector math to calculate the rotation and drift of a tectonic plate?

texts:
I've been following the excellent Experilous procedural planet generation post, trying to recreate it in Java using libGDX. My planet is simpler, as it lacks any distortion of the mesh. It's just hexagons and 12 pentagons right now. However, I've been running into trouble at the part:

The next step was to take the motion of plates and calculate the type and degree of stress at each point along the boundaries between the plates. For each point, I calculated the movement of each plate at that particular position. Subtracting the two gave me the relative movement. I then determined the component of that movement that exactly perpendicular to the plate boundary at that location. This corresponded to the amount of relative movement that was directly pushing the plates into each other or pulling them directly away. This I classified as pressure, and it could be either positive (collision) or negative (separation). I also determined the relative movement that was parallel to the boundary and stored this as shear. (Only the magnitude of this movement was relevant, so shear was strictly non-negative.)

The picture is the example of each tile's motion following this calculation of drift and spin for the tectonic plates. However, the math to actually calculate this completely escapes me. Given that I have the tiles grouped into tectonic plates, a random center (of a tile) for each plate, the center of every tile, and the normal vector of every tile, how could I achieve the same effect depicted here?
Thank you.


texts: I've been happy using bitmap fonts for games so far, but now I find I really need the polygon edge in some form. I saw the freetype engine some time ago, which can provide rastering of truetype fonts from within your engine, but what I think I really want for my current project is some way of converting from truetype to a triangle mesh.


texts: How do I prevent my game from being detected as a virus?

texts:
I developed my own game engine and I'll refer to it as a Software Development Kit (SDK) here, for making a specific type of game.
The SDK encapsulates low level DirectX APIs. It's written in C++ and compiled on its own using Visual Studio 2019 which generates a static library file.
Under the Visual Studio 2019 compiler/debugger with remote debugging tools, I can compile, link and deploy a debug sample application to another computer and continue my development activities.
However, when I copy all the graphics files and the executable to a standalone computer (running antivirus software) and then run my sample application, the antivirus software detects my application as a virus and will go so far as to delete it from my computer.
It does so before I get so far as to change video resolution. I am running Windows 10.
This is now of concern because I would like to use the sample to solicit friends and to gauge interest in collaborating with me on a small gaming project.  The sample is simply a means to test artwork by seeing it animated, so that a graphic artist can work independently with his/her own tool. They would simply have the sample application and an artwork compiler as well.
I read  in another post that is several years old entitled “Conundrum with quality and virus reports: is our game releasable?“, in which the author had similar issues.
In that post it was recommended that the antivirus vendors should be contacted, in hopes that the problem would be corrected before they released their product.
Is this really the best course of action? Does anyone know how my application got into the database used by the antivirus vendor? When I contacted the vendor the analyst whom I spoke with suggested to turn the antivirus software off.
I am trying to prevent the possibility of releasing something I worked hard at, only to have it be detected as a virus after release. Is this preventable and avoidable?
Windows Protected you PC
Microsoft Defender SmartScreen prevented an unrecognized app from starting.
Running this app might put your PC at risk
More Info.
App: Buzz.exe
Publisher: Unknown Publisher
Run Anyway or Don't Run
I select Run Anyway

Down Load Insight
Our information on this file is inconclusive.
We recommend not using this file unless you know it is safe.
Very Few Users
Fewer than 5 users in the NXXXXn Community have use this file.
Buzz.exe
Downloaded from
http://codeload.github.com/david-harding/
Very New
File was relead less than 1 week ago
Unproven
There is not enough information about this file to recommend it.

Stop this program from running.
Remove this file from the system (recommended).
Run this program anyway.

More details.
File Insight

Details
a. Developers Not available
b. Version Not Available
c. Identified 2/11/2021 at 4:14:23 am
d. Last used 2/11/2021 at 4:21:46 am
e. Startup item No

Origin
a. https://codeload.github.com/david-harding/sample/zip/main
b. Downloaded file buzz from github.com
c. File Created Buzz.exe

More Info
Taked me to the AV web site to rate the binary
Click 3. Run this program anyway.
Program runs normally.
++++
I am now using only a release version of my sample executable and the original reported issue has not gone away. The problem is chronic. I am not able to unzip the file downloaded from GitHub on my development computer, the AV software removes the .exe file immediately. I have not done exhaustive testing with USB devices etc. The message above indicates that the file is not trusted.
I am going to digitally sign my sample file with a certificate that is trusted by a trust provider. If the certificate is not too expensive. I tested with a sample PFX, which is included in VS 2019.
I found the following article useful. https://docs.microsoft.com/en-us/dotnet/framework/tools/signtool-exe#sign
If anyone has any suggestions on ordering a PFX cert, I would appreciate suggestions. It looks like that is what is needed here. I will report back when this issue is resolved.  Thanks for everything so far.


texts: How to correctly handle multiple movement key presses resulting in double the speed?

texts:
I am trying to implement acceleration and drag into my top-down 2D game. The player can move using the WASD keys. Acceleration works fine, but the way I handle the directional velocity causes the player to abruptly stop when the movement keys are released instead of coming to a stop. Here is the code I currently have:

EDIT: I officially solved the above issue by implementing an applyForce method and triggering it when the movement keys are pressed as seen here:

    public void applyForce(float angle, float amount)
    {
        Vector2 v = new Vector2((float)(Math.Cos(angle)), (float)(Math.Sin(angle)));
        v.Normalize();
        v = Vector2.Multiply(v, amount);

        velocity = Vector2.Add(velocity, v);
    }

            if (oldKeys.IsKeyDown(Keys.A))
            {
                applyForce((float)Math.PI, CurrentSpeed);
            }
            if (oldKeys.IsKeyDown(Keys.D))
            {
                applyForce(0, CurrentSpeed);
            }
            if (oldKeys.IsKeyDown(Keys.W))
            {
                applyForce((float)Math.PI * 1.5f, CurrentSpeed);
            }
            if (oldKeys.IsKeyDown(Keys.S))
            {
                applyForce((float)Math.PI * 0.5f, CurrentSpeed);
            }

As you may have guessed, the new problem is that when 2 keys are pressed the method is called twice causing the player to move faster than he should be. Are there any effective ways of handling this?


texts:
I would like to build a simple but challenging soccer game. I can define simple as not need to be realistic and challenging having a good team sense that could colaborate doing nice plays.

I have read a bunch of resources about the subject and almost all solucitions are based on heuristics to decide the different actions depending on the state of the team (Attacking, Deffending, etc...).

Beside this we have things like steering behavirous for things like "Go get the ball", "Go to this point to block ball/other player", etc...

Could for example a Goal Oriented action Planner help in this subeject? has anyone any experience on this? How would you orquestate all players movement to behave like a team and not like independent entities on the play field but not feel like robots?

I'm looking here for just some guidelines or concepts, I know it is a broad topic but listening for other people that have experience on the subject could be really helpfull.

Thanks in advance.


texts: Inheritance Hierarchy and Design -- avoiding multiple inheritance

texts:
I am working on a 3D game, and need some advice about how to best design and structure my code so that I achieve what I'm going for without using bad practices like multiple inheritance.

Basically I keep finding myself tempted to implement multiple inheritance with simple interfaces.

For example, I have an abstract base class, Physical_Object, and I have an abstract class derived from it, Controllable, and I have a class derived from Controllable, Drone.

Controllable must implement an update method, which, depending on the state of the controllable, will either call an AI update method, or an update method based on the keyboard/controller state.

A Drone has different segments, of which are interchangeable, and have different abilities.

Some of these segments, as well as some other future game objects will need to be able to target/trace a ray from their origin to where they are aiming.  So I thought to make a new abstract class / interface which requires the implementation of target.

Currently, I have an abstract Drone_Segment class, which helps to allow me to polymorphically manage the Drones interchangeable segments.  And these each have hierarchies, like for example, Drone_Turret_Segment: Physical_Object-->Controllable-->Drone_Segment->Drone_Turret_Segment.

In essence, given the current structure and design, the quickest and easiest way to add the target method to all of the classes which will need it, without multiple inheritance, is to add and implement target in the Controllable class.  But this would have the downside, that Objects that have no logical use for the method would inherit it.

Another option is to make a simple interface and make just objects which need the target method inherit from it, but I cannot figure out how to best do this without multiple inheritance, ie: Physical_Object-->Controllable-->(Drone_Segment,Targeting_Object)->Drone_Turret_Segment.

What are some ways to go about this?


texts:
I started to learn Cg shader programming, following the Panda3d shader tutorials. Having a scene with only a cube shown, each vertex of the model with a different color, I can successfully use the following shader:

void vshader(
    uniform float4x4 mat_modelproj,
    in float4 vtx_position : POSITION,
    in float4 vtx_color : COLOR,
    out float4 l_color : COLOR,
    out float4 l_position : POSITION)
{
    l_position = mul(mat_modelproj, vtx_position);
    l_color = vtx_color;
}

void fshader(
    in float4 l_color : COLOR,
    out float4 o_color : COLOR)
{
    o_color = l_color;
}

This works fine, I can see the colors on the cube interpolated between the vertices, based on the color values of the vertices set in to the cube model.

Now I changed that shader a bit to the following:

void vshader(
    uniform float4x4 mat_modelproj,
    in float4 vtx_position : POSITION,
    in float4 vtx_color : COLOR,
    out float4 l_my : TEXCOORD0,
    out float4 l_position : POSITION)
{
    l_position = mul(mat_modelproj, vtx_position);
    l_my = vtx_color;
}

void fshader(
    in float4 l_my : TEXCOORD0,
    out float4 o_color : COLOR)
{
    o_color = l_my;
}

However, using this custom variable l_my the coloring of the cube does not work correctly any more. Instead of the interpolated vertices colors I only see the default gray-ish color on the whole cube.

I understand that in the second example l_my is a TEXCOORD0 instead of a COLOR, but isn't it still a normal float4 value?

PS: it works again fine if I change l_my to COLOR -- but why does that solve the problem, if in both cases its of type float4?


texts: How do I dispose of OpenGL resources cleanly on Android?

texts:
I am creating a framework for OpenGL ES 2.0 for Android. How can I cleanly dispose of my OpenGL resources when my Android app is done?

I check for isFinished() in the onPause() event and then dispose of the resources but it calls the OpenGL functions from the main UI thread so it gives me an error (0x501).

When I try to call isFinished() inside my onDraw() in my GLSurfaceView.Renderer class, it is never called when I quit my app.

Anyone got any ideas?


texts: Do I need Microsoft authorization to support Xbox 360 controllers for a pc game?

texts: Do I need to pay Microsoft, or do I need some kind of license so I can support the xbox controller on a pc game? Or I just implement it and let people use their Xbox 360 controllers?


texts: Turn and point Animation not ending in correct position

texts:
I have Right Turn, Point & talk Mixamo animation. I am playing animation in this order

Play Idle animation
Turn animation
Point Animation
Then, run Turn animation again with - speed to bring it back(reverse)
and then finally played Idle animation and loop continue.

But the problem is, each time when I return from step 4 my character rotation is different. And over different iterations the character rotation become completely changed. The rotation of the character increment in each iteration. How can I solve this problem? I am learning this but unable to understand.


texts:
A while back I was looking for a way to export / load Models in XNA for animations. I took the advice from a comment, and tried using the "SkinnedModelProcessor" he linked me to. It worked great at home, but at school, I can't seem to get XNA to acknowledge that I have a custom pipeline in the solution. I've added the references to both the content project and the main project, but no luck. When I compile the example, Visual Studio complains that the content processor can't be found. When using my own project, Visual Studio doesn't have the custom Pipeline Processor as an option. When using the example, "SkinnedModelProcessor" is the value in the fields, but if I click on the combobox, that option isn't there, and VS still complains. Obviously this is a problem with how Visual Studio is configured, but I have absolutely no clue what I should do about it. Any suggestions guys? I guess I could build the code for animations at home, and not worry about it at school, but that sounds like the easy way out.

[/walloftext]

Some notes that are probably worth mentioning:
* Any settings that I apply are reset when I log out.
* Any changes to the C drive are reset when the computer shuts down.
* The project is stored on a network location, which has caused problems in the past, evidently. ( Although, I personally don't know what these problems would include ).


texts: Creating orientation Quaternion from forward vector

texts:
Suppose that I have an orientation Quaternion Q, I can compute its forward vector from V = Q * Vector3.forward easily.

Inversely, suppose that I have its forward vector V, how do I compute Q?

I know that is not possible, please tell me what's needed beside V, in order to compute Q.

Motivation behind the problem: I have a forward direction of a game object, I want to find out its up direction and its right direction. I can find out all these 3 directions if I have the orientation Quaternion.


texts: Why doesn't Unity let me build my project with TextMeshPro after updating to Unity 2017.4.5?

texts:
I have recently upgraded to Unity 2017.4.5. This required me to reimport TextMeshPro which I used previously in the project. Now I am trying to build (Android, Windows) and it is giving me hell a lot of errors, but I do not have any when I want to run the project. It is yelling about TMP, it does not find specific scripts. I tried to move around the runtime and the editor dll, reimporting all, googleing the error message, but it did not help.
Please see my errorlog: http://pasted.co/35185b3c.
Thanks


texts: How can I fix “Cannot read value of type Vector2 from composite” error in Unity?

texts:
I'm making a 2D game with Unity using the new Input System. I used spriteRenderer.flipX to flip the player but since it is made of three parts (body and two eyes), the spriteRenderer didn't work. Also, I couldn't convert them to a single sprite because I need the eyes in order to animate them. So, I decided to use transform.localscale for flipping and change movementInput value from a float to a Vector2. The problem is that when I press the arrow or AD keys to move the character, an error pops up saying "Cannot read value of type Vector2 from composite". This error is from InputActionState which is a long and complicated code related to the new Input System. Also, getting input from gamepad causes the same error. I don't know what does this error mean and how can I fix it. Now, the player can jump but it can't move or flip. You can see the code, the error and my action map down below.
This is my Player Controller:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;

public class PlayerController : MonoBehaviour
{
    [SerializeField] private float speed, jumpSpeed;
    [SerializeField] private LayerMask ground;
    private PlayerActionControls playerActionControls;
    private Rigidbody2D rb;
    private PolygonCollider2D pol;
    private Animator animator;
    private bool facingRight = true;
    private Vector2 movementInput;

private void Awake() {

    playerActionControls = new PlayerActionControls();
    rb = GetComponent<Rigidbody2D>();
    pol = GetComponent<PolygonCollider2D>();
    animator = GetComponent<Animator>();

   }

private void OnEnable() {

    playerActionControls.Enable();

   }

 private void OnDisable() {

    playerActionControls.Disable();
   }

 void Start()
   {
     playerActionControls.Land.Jump.performed += ctx => Jump(ctx.ReadValue<float>());

    }

private void Jump(float val) {
       if (val == 1 && IsGrounded()) {
           rb.AddForce(new Vector2(0, jumpSpeed), ForceMode2D.Impulse);
       }
   }

private bool IsGrounded() {

       Vector2 topLeftPoint = transform.position;
       topLeftPoint.x -= pol.bounds.extents.x;
       topLeftPoint.y += pol.bounds.extents.y;

       Vector2 bottomRightPoint = transform.position;
       bottomRightPoint.x += pol.bounds.extents.x;
       bottomRightPoint.y -= pol.bounds.extents.y;

       return Physics2D.OverlapArea(topLeftPoint, bottomRightPoint, ground);
   }
     void FixedUpdate()
   {
       if(facingRight == false && movementInput.x > 0){
           Flip();
       } else if (facingRight == true && movementInput.x < 0){
           Flip();
       }
   }
   void Flip(){
        facingRight = !facingRight;
        Vector3 Scaler = transform.localScale;
        Scaler.x *= -1;
        transform.localScale = Scaler;
   }

   void Update()
   {
      movementInput = playerActionControls.Land.Move.ReadValue<Vector2>();

       Vector2 currentPosition = transform.position;  // This was a Vector3 but since I got the error  "Operator '+=' is ambiguous on operands of type 'Vector3' and 'Vector2", I changed it to a Vector2.
       currentPosition += movementInput * speed * Time.deltaTime;
       transform.position = currentPosition;

   }
}

This is the error I get when I want to move the player.

This is my action map.


texts: What keys should I use for a four-player game with one keyboard?

texts:
I'm planning on making a multiplayer game for up to four people on a single machine. We want to have all input coming from players using the same keyboard (or multiple keyboards connected to the same computer). What keys should I use for each player?

Each player will be able to move around at a minimum, which will require four directional keys. They might potentially have one extra action they can take, which would require a fifth key.

WASD and the Arrow Keys are somewhat obvious options for a single player game, but what other sets of keys should I use?

I'm mainly interested in what positions of keys to use, rather than the letters, so just answer using the QWERTY keyboard layout. Potentially we can let people map this to their own preference for the other keyboard users.

I'm aware that many keyboards limit the number of keys that can be pressed simultaneously, however for this particular game we will be controlling the hardware and using multiple keyboards. It would be nice to have a set of keys that would work on a single keyboard if that keyboard didn't have that input limit (although it might be difficult fitting everyone's hand)


texts: Working with lots of cubes. Improving performance?

texts:
Edit: To sum the question up, I have a voxel based world (Minecraft style (Thanks Communist Duck)) which is suffering from poor performance. I am not positive on the source but would like any possible advice on how to get rid of it.

I am working on a project where a world consists of a large quantity of cubes (I would give you a number, but it is user defined worlds). My test one is around (48 x 32 x 48) blocks.

Basically these blocks don't do anything in themselves. They just sit there.

They start being used when it comes to player interaction.

I need to check what cubes the users mouse interacts with (mouse over, clicking, etc.), and for collision detecting as the player moves.

Now I had a massive amount of lag at first, looping through every block.

I have managed to decrease that lag, by looping through all the blocks, and finding which blocks are within a particular range of the character, and then only looping through those blocks for the collision detection, etc.

However, I am still going at a depressing 2fps.

Does anyone have any other ideas on how I could decrease this lag?

Btw, I am using XNA (C#) and yes, it is 3d.


texts:
In my old game based on canvas and bitmaps I used surfaceHolder and Thread to call onDraw:

public class GameThread extends Thread {
private SurfaceHolder _surfaceHolder;
private ScreenObjectsView _panel;
private boolean _run = false;

public static int mOnDrawPeriodGap = 20;

public GameThread(SurfaceHolder surfaceHolder, ScreenObjectsView panel) {
    _surfaceHolder = surfaceHolder;
    _panel = panel;
}

public void setRunning(boolean run) {
    _run = run;
}

public SurfaceHolder getSurfaceHolder() {
    return _surfaceHolder;
}

@Override
public void run() {
    Canvas c;
    while (_run) {

        if(!_surfaceHolder.getSurface().isValid()){
            continue;
        }

        c = null;
        //Log.e("test","thread running");
        try {
            c = _surfaceHolder.lockCanvas(null);
            synchronized (_surfaceHolder) {
                _panel.updatePhysics();
                _panel.onDraw(c);

                /** onDraw() method  run too fast, lets slower it*/
                try {
                    Thread.sleep(mOnDrawPeriodGap);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
            }
        } finally {
            // do this in a finally so that if an exception is thrown
            // during the above, we don't leave the Surface in an
            // inconsistent state
            if (c != null) {
                _surfaceHolder.unlockCanvasAndPost(c);
            }
        }
    }
}

}

Today I try to adapt my game to openGL 2D. I'm new in openGL world.

Do I need to do the same for new framework?

As I know  It (openGL) seems already starts a second thread for rendering, calling into the Renderer methods.

Thank you,


texts: How to utilize miniMax algorithm in Checkers game

texts:
I am sorry...as there are too many articles about it.But I can't simple get this.

I am confused in the implementation of AI. I have generated all possible moves of computer's type pieces. Now I can't decide the flow. Whether I need to start a loop for the possible moves of each piece and assign score to it.... or something else is to be done.

Kindly tell me the proper flow/algorithm for this. Thanks

UPDATE:

MiniMax code

Now I coded the algorithm but not getting correct moves. Please help me find out the logical error.