texts: Trouble with Normal Matrix and Point Lighting

texts:
I'm having issues with lighting in my game. For some reason, no matter what I try, point lights appear to cut off halfway through the center of the light. I'm trying to render this light on a quad.

Setup:
All of the vertices of my quad have a normal of (0, 0, 1). I translate this quad, rotate 90 degrees along the y-axis (just as a test), rotate 90 degrees along the x-axis (so that it appears as a floor), then scale.
I compute my normal matrix inside my vertex shader currently via the following:
mat3 nMatrix = mat3(transpose(inverse(model)));

Then I determine the normal via the following:
lightNorm = nMatrix * aNormal;

I calculate the vertex position with the following:
verPos = vec4(aPosition, 1.0) * model;

Then in the fragment shader I do the following:
vec3 norm = normalize(lightNorm);
vec3 lightDir = normalize(lightPos - verPos); // lightPos is the position of the light, unaffected by any matrices.
float diffuse = max(dot(norm, lightDir), 0);
vec4 diffuseColor = vec4(diffuseLightColor, 1.0) * diff * inputDiffuse;
lightColor += diffuseColor;

What is strange, is once I remove the rotation along the y-axis, everything appears correctly:

Note: I am using OpenTK. I've noticed some strange behavior with matrices in OpenTK, where multiplication order is flipped from many examples and demos online, so I'm wondering if that might have something to do with it.
I've tried multiplying by the view matrix (I might have not done this correctly), flipping multiplication order, etc, and none of that has seemed to work. I've also used a normal map instead of vertex normals and I get the same result.
Why is it, that when I rotate along the y-axis, my lighting appears to be "cutoff" right through the middle?


texts: NullReferenceException until tile is spawned

texts:
I have a tile and tile has enemies spawn positions, and spawner script in it. Everything works fine when tile is spawned, my ray hits the collider in tile and enemies get spawned, but my spawn script is in tile my ray script is in my player so im reaching from my PlayerMove script to spawner script, but until my tile is spawned i get this error NullReferenceException: Object reference not set to an instance of an object because tile is not spawned yet after its spawned error stops, but after tile is deleted it starts again how can i get rid of this error.

PlayerScript

private Spawner spawner;
private RaycastHit hit;

private void Update()
{
  spawner = GameObject.FindGameObjectWithTag("Spawner").GetComponent<Spawner>();
  DrawRay();
}

private void DrawRay()
{

    Ray ray = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

    if(Physics.Raycast(ray,out hit))
    {
        if(hit.collider.tag == "SpawnerCollider")
        {
            if(hit.distance < 5)
            {
                Destroy(hit.collider);
                spawner.Spawn();
            }
        }
    }
}

SpawnerScript

public Transform[] spawnPos;
public GameObject fireBall;

public void Spawn()
{
    for (int i = 0; i < spawnPos.Length; i++)
    {
        Instantiate(fireBall, spawnPos[i].position, Quaternion.identity);
    }
}


texts: How import and draw a tiledmap with slick2d

texts:
How I can import and draw a tilemap with different layers? I have the next code and send me error if the tilemap have more than one layer.

public class Map {

    private TiledMap map = null;

    private int bg,level,extras;

    public void init(GameContainer container) throws SlickException {

        map = new TiledMap("assets/levels/default.tmx", false);

    }

    public void render(int type, GameContainer container, Graphics g) {

//      map.render(0, 0, 0, 0, 19, 13);

    }

    public void update(GameContainer container, int delta) {}

}

I was thinking to save each layer in a different variable for later draw each layer. But Im not sure how I can do it. I have been looking for tutorials, and the slick2d API. And this is the error.

Fri Feb 06 22:18:30 GMT 2015 ERROR:For input string: ""
java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1008)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
    at gameEngine.Map.init(Map.java:54)
    at states.Play.init(Play.java:26)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at gameEngine.Main.main(Main.java:31)
Fri Feb 06 22:18:30 GMT 2015 ERROR:Failed to parse tilemap
org.newdawn.slick.SlickException: Failed to parse tilemap
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:695)
    at org.newdawn.slick.tiled.TiledMap.<init>(TiledMap.java:106)
    at gameEngine.Map.init(Map.java:54)
    at states.Play.init(Play.java:26)
    at org.newdawn.slick.state.StateBasedGame.init(StateBasedGame.java:171)
    at org.newdawn.slick.AppGameContainer.setup(AppGameContainer.java:393)
    at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:317)
    at gameEngine.Main.main(Main.java:31)
Caused by: java.lang.NumberFormatException: For input string: ""
    at java.lang.NumberFormatException.forInputString(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at java.lang.Integer.parseInt(Unknown Source)
    at org.newdawn.slick.tiled.TiledMap$ObjectGroup.<init>(TiledMap.java:1008)
    at org.newdawn.slick.tiled.TiledMap.load(TiledMap.java:688)
    ... 7 more


texts: how to apply force/impulse perpendicular to the moving direction in box2d

texts: How can i apply or impulse to an object perpendicular to its moving direction in a top down game. Like if object is moving up, i press left or right, then force or impulse should be applied to left or right direction(object can be at any angle).


texts: How to refresh andoid photo gallery in unity

texts: After saving a screenshot into the folder i cannot view the screenshot in the android gallery but can see the screenshot in the folder created.Is there anyway i can see it through gallery?


texts: How to prevent objects from colliding into each other in the Unity editor?

texts:
I am building a map for a game... I am making most of the buildings with cubes. When I move a cube next to another one they go through each other... Which creates flickering. This is making it very hard to build the map. How do I enable collisions in the editor (Make it so they don't go through each other when you try to move one)?

Here is a picture:


texts: Is there a way to allow for design-time math on a scriptable object in Unity?

texts:
Sorry for the title, I did not know how else to describe the question.  I am writing a turn-based strategy game and am looking for a way to enable design-time additions of game mechanics where the mechanics each require some different math.
What I'd like to do is to be able to create a ScriptableObject and then modify it with the formula and various descriptions (all through the inspector), then add it to the game.
As an example, my game has cities where each city has several attributes such as population and various technology levels.  I'd like to be able to add various "resource generators" at design-time via the inspector with the formula for how the resource is generated per turn.
Some examples of resource generators:

A "gold" resource generator with the "population * 0.025" formula to indicate that, each turn, the city generates 2.5% of it's population as gold.
A "research" resource generator with "assigned population * 0.5" as the formula to indicate that, each turn, the population assigned to research generates 0.5 pts of research per person.
A "production" resource generator with the "assigned population * production tech level * 0.75" with a max value of "1000 * city level" where excess production gets dumped to gold.

And so on.  These are examples, but the formulas should allow for arbitrary interactions with other values in the game.
Some of the simpler formulas seems pretty easy, i.e. create a scriptable object attached to a primary value (say population) and then a simple modifier.  But I'm stuck on how to do the more complex ones.
Anyone have an idea about how to accomplish something like this?


texts:
I'm trying to make a bounding rect for my bullet which is in space invader game.
I'm using marmalade, and the bounding rect seems translated and doesn't bound the bullet at all, however the math is correct.
Here is a video of the behavior and a snippet of code
http://youtu.be/SbjMPKQ7ilE

void Bullet::Render()
{
    if (ShipBullet == nullptr)
        return;

    if (Visible)
    {
        Transform.SetIdentity();

        // Build transform
        Transform.SetRot(Angle);
        Transform.ScaleRot(Scale);
        Transform.SetTrans(Position);
        Iw2DSetTransformMatrix(Transform);
        Iw2DSetColour(Colour);

        CIwFVec2 pos = Transform.t;
        BoundingRect.x = pos.x;
        BoundingRect.y = pos.y;
        BoundingRect.w = (float)ShipBullet->GetWidth();
        BoundingRect.h = (float)ShipBullet->GetHeight();

        // Render image
        if (ShipBullet != 0)
        {
            int x = -(ShipBullet->GetWidth() / 2);
            int y = -(ShipBullet->GetHeight() / 2);
            Iw2DDrawImage(ShipBullet, CIwFVec2(x, y), CIwFVec2(ShipBullet->GetWidth(), ShipBullet->GetHeight()));
        }

// render bounding rect
#if 1
        Iw2DSetColour(0xff0000ff); // Set red
        Iw2DDrawRect(CIwFVec2(BoundingRect.x, BoundingRect.y),
            CIwFVec2(ShipBullet->GetWidth(),ShipBullet->GetHeight()));
#endif

    }
}


texts:
Came from Java (and fairly C++) and I am very confident in my programming skill
Now I'm about to move to something more interesting, game programming
The thing is as I am new to this,

I need to know some basic Theory that we need to know before start learning game programming
You know there has to be some foundation of theory that we need to know

as in web Programming, basic Http Protocol, ftp and all those theory
maybe something like Collision Detection, Vector, and all that
you know I don't wanna get too excited about it and then lost at some point and giving up, like most of the newborn

This is purely a hobby so, there's nothing like "I am going to make the next hallo game"
a pretty lame game is sufficient
thank you

EDIT : You're right its too broad and unclear
lol I forgot I'm sorry
I mean Its for developing 3D Game on Desktop, And Android
And No, No Iphone and not web either
And about the game Engine, I can decide myself, but if there are suggestions that'd be okay
If its still unclear you can edit it please to prevent this kinda question asked again


texts: Something is preventing my NavMeshAgent from moving

texts:
I apologize for the vague title. I really wish I could ask something more specific, but I can't. I had my click-to-move script working fine with the NavMesh. I showed it to my colleague earlier today, and must have accidenntally made a change and saved. Now the guy's not walking.

There are no errors and my debugging leads me to believe all code paths are working as expected. When I click on a location, it checks that it is valid on the NavMesh, then updates the NavMeshAgent's destination:

I am not going to post the code because I don't think the problem resides there, but rather it was something I did in the editor. The character also turns in the correct direction, and starts the walk animation correctly, but it looks like something is blocking its movement, and I can't figure out what that is.

The following screenshots will help clarify my situation. Note that the camera is shaking because its position is set to match the character's in Update. The character appears to be colliding with something, which makes it look like the camera is colliding too (note this is not a physics-based game in any way).

edit here's some more screenshots, showing the person slightly above the ground and their collider (it's the box near their feet). I disabled the collider on the floor so there are no colliders other than the player's.


texts: Easy way to project point onto triangle (or plane)

texts:
I have a mesh of triangles (navigation mesh), and a point in 3d space. This point should be "over" one of the triangles all the times. I'm trying to determine which triangle is the one the point is "over", but I can't quite figure it out.

I have found a way to tell if the point is in the triangle using one of the techniques described here, but I can't quite figure out how to project the point on the triangle (or the plane the triangle is in, for that matter). I've been looking online but I can't find anything helpful.

Does anyone know how to project a point onto a triangle (or plane)?

Also, if someone knows of a better way to test which triangle is the one the point is over, it would be appreciated.


texts: How to make non-static gameobjects brighter?

texts:
I placed non-static gameobject in the scene. Look at this picture:

You can see the lighter, but it's too dark, way darker than others. The only difference between the lighter and the  other objects are the fact that other objects are static objects.

How do I make this object brighter in this case? Why do non-static objecs have different light results?


texts: How do I include the gizmo in my simulation?

texts:
My company is developing 3D simulation program using Unity 5.x and we need a gizmo in our solution. My goal is to displaying that a factory is building.

I don't know how do programmatically use Unity Engine. How do I include a gizmo like the gizmo in the scene view, or the one in the image?


texts: How can I extend btCollisionAlgorithm to enable collision with a voxel terrain?

texts:
I am using Bullet, and am attempting to make a collision algorithm that generates contact points off of a cube-based terrain along with the appropriate collision response. I also plan to extend this to include non-box shapes too, however that is not vital at the moment. I've found that using a triangle mesh is too much of a RAM hog for large maps.

I have tried the procedure outlined by Byte56 here, however, I have a number of questions regarding implementing this with Bullet:

How do you generate a collision shape for the world? Do you use a custom shape? What do you set m_shapeType to be on it?
Or do you still use a box shape the size of the world?
How do you ensure that contact points are freed?
How exactly do you modify processCollision?

What I've done:

I've created a terrainShapethat extendsbtBoxShape, the only difference being thatm_shapeType = CUSTOM_CONVEX_SHAPE_TYPE`, in order for me to be able to register a new collision algorithm with the dispatcher for objects with only this shape.
I've extended the btRigidBody class in a way similar to Byte56 in his question (see the link in the 2nd paragraph), however checkCollisionWith(CollisionObject * co) returns true if any voxel in the AABB of co is not air.
I've extended the btCollisionAlgorithm class, in a way similar to btCompoundCollisionAlgorithm, with processCollision doing the following:

Check the colliding objects passed as arguments, and determine which is the terrain, and which is the entity.
Clear the manifolds any child algorithms.
Call resultOut->setPersistantManifold(resultOut)
Generate new box shapes and transforms in the AABB occupied by the colliding entity, and then call m_dispatcher->findAlgorithm. Store the shape, transform and found algorithm in a Child Algorithm struct for each voxel within the AABB.
Iterate over all child algorithms, calling proccessCollision.
Iterate over all child algorithms, removing any now outside of the AABB of the colliding entity. (calling ~btCollisionAlgorithm() then m_dispatcher->freeCollisionAlgorithm())
Call resultOut->refreshContactPoints().

What works: processCollision is called whenever the player's AABB intersects with non-air voxels.

What doesn't: the collision response is just plain weird... The player entity starts levitating upwards. If it walks into something, it bounces off violently. Sometimes, it is unable to keep moving on one axis after walking into something. What I suspect is going on is that contact points are not being released after collision response, possibly due to the player entity always being in the world object's AABB. I am curious to see if I am barking up the right tree with respect to processCollision?


texts:
This is a newbie question, but here it goes:

My map is a 2d grid, and I want to generate roads and rivers. The route from the starting to ending point must not be the optimal route in number of tiles. Instead, they should have a certain level of randomness (turns).

Is there a standard algorithm for this kind of thing?

Cheers!

UPDATE:

This is the result of playing with weights on the grid, and applying a shortest path algorithm (Bellman-Ford) using the jgrapht library. I went with Donutz' answer after all.

http://pastebin.com/AGQGK5ik


texts:
A friend and I are trying to develop a “chance to dodge” formula that will scale from level 1-1000. I would like to see if one formula can be utilized, using a difference ratio between Character A’s level and Character B’s level. The factors involved in the equation are as follows:

Dexterity (Max 38)

Acrobatics Skill (up to 5 possible skill points)

The equation in theory:

(Acrobatics Skill * 5) + ((Dex - 10) * 0.1) + ((CharacterB's Level - CharacterA's Level) * 0.1)

The formula has been varied a little to make it work better in one regard which has the inverse effect of making it not work in another area. For example, the formula may work and scale well if a lvl 700 is striking at a lvl 1000. Let’s say that works out that Character B has a 65% to dodge. Sounds good…..except if the same formula is applied to a lvl 5 is striking a lvl 20 (low levels).

We don’t want there to be a 100% chance to block. Then again, I guess if a level 1 struck at a level 1000, that would be a little bit ridiculous that he would succeed. But once again, it would be nice if there was a way to scale the entire level spectrum by use of perhaps cosine and the difference-between-level’s ratio.


texts: How do i approach these inheritance problem? (Pokemon Gen III)

texts:
I'm currently making a Pokemon clone on Python just for the heck of it. After fiddling a bit with some GBA ROM editing tools, i've found out that on these games there are, among other things:

Events placed on a map, each with a script that is run when you interact with it (Either by running into them or pressing the A button at them).
Examples of this are Signposts, hidden items, doors, and more importantly...
NPCs, which, aside from having scripts (talking, triggering a pokemon battle, etc) can move and/or look around (at least some of them).
The Player character, which can also move and look around, controlled by the human player or by some outside event that may be manipulating it. But the Player itself is not an event, as it has no associated event scripts on its own. It just triggers everyone else's.

So how should i go about recreating this with Python? By using multiple inheritance, i'd get something like this:

class Event(object):
    def __init__(self, x, y script):
        self.x = x
        self.y = y
        self.script = script

class Moving(object):
    ''' objects that can move '''
    def __init__(self, x, y, direction):
        self.x = x
        self.y = y
        self.direction = direction

    def move_one_space_to(self, direction):
        self.x += direction.x
        self.y += direction.y
        self.turn_to(direction)

    def turn_to(self, direction):
        self.direction = direction

class NPC(Event, Moving):
    def __init__(self, x, y, script, movetype):
        Event.__init__(self, x, y, script)
        Moving.__init__(self, x, y, DOWN)
        self.movetype = movetype

class Player(Moving):
    # many methods that an NPC shouldn't have go here
    pass

However, even though i may be sidestepping any problems that come with it, i'm still reluctant to use multiple inheritances. So...

Should i stick with this approach?
And if not... why not? and can you post a better one?


texts: Is it possible (and practical) to dynamically create normal maps from graphics in Pixi.js?

texts:
I am building a tile game using Pixi.js. The game features dynamically-generated terrain and a day/night cycle. I'd like to use a normal map to give the sense of sloping hills or mountains.

Luckily pixi.js supports normals. I've recreated a demo app from their examples here:

var viewWidth = 1024 // /2;
 var viewHeight = 1024 //512 /2;

  // Create a pixi renderer
 var renderer = PIXI.autoDetectRenderer(viewWidth, viewHeight);
 renderer.view.className = "rendererView";

  // add render view to DOM
 document.body.appendChild(renderer.view);

  // create an new instance of a pixi stage
 var stage = new PIXI.Stage(0xFFFFFF);

  //EXPERIMENTAL: Trying to dynamically create textures. Doesn't work.
  //If using this method, comment out line 24.
 /*var rect = new PIXI.Graphics();
 rect.beginFill(0xFFFFFF);
 rect.drawRect(0,0,600,600);
 rect.endFill();
 var pondFloorTexture = rect.generateTexture();*/

  // create a background texture
  var pondFloorTexture = PIXI.Texture.fromImage("http://www.goodboydigital.com/pixijs/examples/20/counch_norm.jpg");

  // create a new background sprite
  //var pondFloorSprite = new PIXI.Sprite(pondFloorTexture);
  //stage.addChild(pondFloorSprite);

 var filter = new PIXI.NormalMapFilter(pondFloorTexture);

 var sprite = PIXI.Sprite.fromImage("http://www.goodboydigital.com/pixijs/examples/20/couch.jpg"); //(pondFloorTexture);

 sprite.filters = [filter];
 stage.addChild(sprite);

 var tick = 0;
 requestAnimationFrame(animate);

 function animate() {

   // increment the ticker
   tick += 0.1;

   var mouse = stage.interactionManager.mouse;

   if (mouse.global.x < 0) mouse.global.x = 0;
   else if (mouse.global.x > viewWidth) mouse.global.x = viewWidth;

   if (mouse.global.y < 0) mouse.global.y = 0;
   else if (mouse.global.y > viewHeight) mouse.global.y = viewHeight;

   filter.uniforms.LightPos.value[0] = mouse.global.x;
   filter.uniforms.LightPos.value[1] = mouse.global.y;
   // time to render the state!
   renderer.render(stage);

   // request another animation frame..
   requestAnimationFrame(animate);
 }
<script src="http://www.goodboydigital.com/pixijs/examples/20/pixi.js"></script>
<script src="http://www.goodboydigital.com/pixijs/examples/20/NormalMapFilter.js"></script>

Note that at line 15 I've added a bit of code that attempts to replace the normal map with a dynamically created rectangle. But for some reason this results in everything appearing black. Am I doing something wrong? Is there a better way to do this?

But more importantly, should I be creating normal maps dynamically? Obviously generating them on the fly will be computationally expensive, but how else would I get a normal map for something I won't know the shape of until last minute?


texts: Rewarded video ads for two different functions - Unity

texts:
I'm implementing reward based video ads in my game. There are two functions that provide the reward. One is a ReceiveLife() function where once the player dies, if they click on the revive button the game restarts and the score is set to score before the player dies instead of 0. The other function is ReceivePoints(), where if the player clicks on the add points button, they are rewarded with 100 extra points. Here are the functions in the game manager script:
 public void ReceiveLife()
   {
     savedScore = (int)playerScore;
     SceneManager.LoadScene(1);
   }

 public void ReceivePoints()
   {
     playerScore+=100;
     gameOverPanel.gameOverScoreText.text = "Score: " + ((int)playerScore).ToString();
   }

Here is the unity ads manager script:
 public void OnUnityAdsDidFinish(string placementId, ShowResult showResult)
  {
    if (showResult == ShowResult.Finished)
    {
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        gameManager.ReceiveLife();
    }

    if (showResult == ShowResult.Finished)
    {
        gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
        gameManager.ReceivePoints();
    }
 }

Once they watch the ad successfully, both the functions are being called. If the player clicks on the ReceiveLife(), he should only get one extra life and not the additional 100 points and vice-versa.
I'm not sure how to call each function separately. Do I have to create two separate admanagers in order to call these functions or is there a better method?


texts:
I want to use LibGDX with Android, but instead of modifying my Activity to extend

  AndroidApplication

I want my to render my graphics inside Android Fragment

The problem is that my class already extends Fragment, so I can't make it extend LibGDX AndroidApplication (Multiple Inheritance)

is there any workaround for this ?

Thanks


texts: I'm trying to work with 2D graphics using Direct3D 9, but am not sure where to start. Right now I'm using a texture as the "draw buffer", and drawing that texture to screen. For the simplest things, it works. But I can't see a way to e.g. draw lines, arcs, and the like onto the texture. How should I go about doing this?


texts: Blender, Exporting to Collada, Assimp and Normal Maps

texts:
I have a simple model that uses a diffuse and a normal map - in this case just two textures applied to the same material, where for the normal map I uncheck all the options in the "Influence" section in Blender and check the option for "Normals". Inside Blender the normal map is used correctly, but when I export the file to collada and try to load it with OpenAssimp, the normal map doesn't show up in the material.

Also, the Collada file doesn't seem to mark the normal map as something special, it's just listed as another image under  (there's no reference to it being a normal map, and there is no bump effect in library_effects).

Do I need to activate some special option in blender to make sure the normal shows up in the collada file?

Notes: AssimpView doesn't load the normal map either, but when I export as 3DS it shows the normal map correctly - too bad I can't use 3DS since it doesn't support bones.


texts:
Is it possible to modify Sony PlayStation 1 games?

For example I'm planning to modify a soccer game called Winning Eleven 3. What I'm exactly trying to modify is player properties such as speed, shot power and so on.


texts: "Failed to fetch the following dependencies: com.google.games:gpgs-plugin-support:0.9.50 " when force resolve GooglePlayGamesPlugin-0.9.50

texts:
Ive been stuck with this problem for the last few days and really need some assistance.

Iv created an android app and im trying to set up google play services as i want to use the leader board etc..

I downloaded and imported the latest plugin "GooglePlayGamesPlugin-0.9.50 " no errors during the import.

I then go to assests/ play service resolver/android/force resolve and run that.

After running I end up with the following error:

Resolution failed

Failed to fetch the following dependencies:

com.google.games:gpgs-plugin-support:0.9.50

UnityEngine.Debug:LogError(Object)

Google.Logger:Log(String, LogLevel)

GooglePlayServices.PlayServicesResolver:Log(String, LogLevel)

GooglePlayServices.ResolverVer1_1:LogMissingDependenciesError(List`1)

GooglePlayServices.c_AnonStorey18:<>m_26(List`1)

GooglePlayServices.c_AnonStorey14:<>m_1F(Result)

GooglePlayServices.c_AnonStorey15:<>m_28()

GooglePlayServices.PlayServicesResolver:PumpUpdateQueue()

UnityEditor.EditorApplication:Internal_CallUpdateFunctions()

If i ignore the error and complie the app it works fine but does not connect to the google service. I can publish and use the app without crashes etc but i cant log on to google or view leaderboards.

Can any one assist me as im really desperate to get this up and running.

Im using :
unity 2017.1.1f1 personal 64bit

Windows 10 64 bit

jdk1.8.0_162


texts: Looking for a clever way to differentiate objects

texts:
I have a lot of cubes in my game (2d squares) and I decided to add some skins to them. However the colors that they have don't really make them look appealing.

For example, I have this sprite:

Here is how the squares look with that particular sprite:

As you can see, they don't really look that great with all these bright colors.

Is there any way that I can make this look better, but for the users to still be able to differentiate between the different cubes?


texts: Procedurally generating a building of specific area

texts:
Myself and a team are working on a factory builder game that gives the player a random factory at the start of the game. To try to make sure there is a sense of "fairness," ideally the randomly generated factory would have an area within a few units of (placeholder value) 30.

Its relatively simple to write a basic random rectangle generator to meet these specifications, but our goal is for the factory to be more complex, perhaps made up of 2, 3, or even 4 intersecting rectangles, producing more complex shapes (think of L, U, and O shaped buildings).

I've tried generating a random rectangle and then using basic algebra to fill in a 2nd rectangle, but so far I've had no luck implementing more than 2 rectangles, and even then I am unhappy with the results for just a 2 rectangle design.

Some more relevant info:
2D top down
Some of the mechanics are factorio style so rooms should have reasonable length and width to allow room for machinery
Currently in Java and Lua (can use built in libraries from either if needed)

Thanks in advance!

EDIT:
When I say "good" or "bad" outputs, a bad output would be any output which has space unusable by the player. The factory shape limits where the player can place factory machines such as conveyor belts. Ideally, the factory shouldn't have areas that are only 1-2 blocks wide, the shape shouldn't be one or two big rectangles with a line of 1-2 blocks "hanging" out to one side.
A good output would be where all floor space is "workable", so all areas are at least 3-4 blocks wide. A good output doesn't always have to be complex (1 or 2 rectangles is okay), but it should have a fair chance if being made up of more than 1-2 rectangles.


texts:
In my C++ program I am trying to develop a simple saving and loading function for my game. I can easily get the save function on it, but the loading part of it really stumps me.

What I need is to load the numbers on the file (line by line) and insert them into different variables for my player. I'm just not able to figure that out. I've even looked all around the inter webs.

Here is the code for the player save and load functions:

void Player::Save()
{
    std::ofstream savePlayerFile;
    savePlayerFile.open("Save/playerSave.dat", std::ofstream::trunc);

    savePlayerFile << x << "\n" << y << "\n" << prevX << "\n" << prevY << "\n" << health << "\n" <<
    health  << "\n" <<  mana  << "\n" <<  gold  << "\n" <<  level  << "\n" <<  maxHealth << "\n" <<
    maxMana << "\n" << strength << "\n" << defense;

    savePlayerFile.close();
}

void Player::Load()
{
    std::ifstream loadPlayerFile;
    loadPlayerFile.open("Save/playerSave.dat", std::ofstream::in);

    /*std::string line;
    while(std::getline(loadPlayerFile, line))
    {
        std::istringstream iss(line);
        */
    loadPlayerFile >> ( x && "\n" && y && "\n" && prevX && "\n" && prevY && "\n" && health && "\n" &&
    health && "\n" && mana && "\n" && gold && "\n" && level && "\n" && maxHealth && "\n" &&
    maxMana && "\n" && strength && "\n" && defense);
}


texts: How can I model a "weapon overheating" mechanic?

texts:
I want to create a weapon overheating system very similar to the plasma rifle in Halo. You can watch a video of the plasma rifle firing.

What I want to do is to create a flexible logic that can be used for multiple weapons for different in-game feelings.  Here is my proposed system

Create a bar that is split from 0 - 100.
Each bullet has a heat value as an integer.
Every bullet adds this value to the bar.
The bar has a cooldown set as some value per second.
If the bar goes over 100 with any bullet fire the bullet still shoots but then the weapon is deactivated for a period defined as it's "cooldown."

Now this system is very simple but visually it will be very linear, with a simple growth and decay. I wanted to try to create a more exponential system that would mean the bar would jump quickly to the middle then remain and hover near the top / hot bit of the bar for a long period to create a sense of anticipation just before it overheats.

What would be a good formula to achieve that result?


texts:
I am trying to learn and teach myself openGL and I wanted to draw a figure 8 in a 3D setting but I'm having a problem. Please forgive me, I am very new at this but I'll attempt to explain what I have done so far

I understand that I can use the Lemniscate of Bernoulli to draw a nice figure 8, so I've have adopted that idea into my code. I just want to draw it along the x and z plane.
 My code looks like this

#define PI 3.1415926535f
#define MAX_STEPS 100.0f
//...
Vector3 PointOnCurve1(Vector3 p1, float t)
{
    Vector3 tempPoint = {0.0f, 0.0f, 0.0f};
    float scaler = 2/ (3- cos(2*t));

    varX = scaler * cos(t);
    varZ = scaler * sin(2*t) / 2

    tempPoint.x = varX+p1.x;
    tempPoint.y += p1.y;
    tempPoint.z =varX+p1.z;

    return tempPoint;
}

Vector3 g_Point    = {-4,  0,  0};
glBegin(GL_LINE_STRIP);
    for(float t = -PI; t <= PI; t += PI / MAX_STEPS)
    {
        vPoint = PointOnCurve1(g_Point, t);
        glVertex3f(vPoint.x, vPoint.y, vPoint.z);
    }

glEnd();

All I'm getting is one straight green line instead of a figure 8. any ideas? Am I missing something here? I'm basing this equation from this gamedev article

How can I move an object in an "infinity" or "figure 8" trajectory?


texts: How does one make games playable before they are fully downloaded?

texts:
Diablo 3 and StarCraft 2 have a nice feature: I can start playing before the full game or update has finished downloading.

I guess Diablo 3 downloads mandatory files like like UI assets and some meshes and textures that are used across several levels first. However, when starting a game, I can choose any level I want, assuming I have appropriate saves. I never experienced any lag from such when playing—starting is always very smooth.

How does this work? How could I implement a similar feature?


texts:
Possible Duplicate:
  What C++ GUI library can you suggest?

I am creating a simple 2 dimensional GUI for an RPG game. It will be pretty simple and will contain a few windows a chat box. Does anyone have any suggestions for UI code to use?


texts: Networking in Flash games. Socket or Stratus?

texts:
Working on a prototype for a Flash game that will use networking communication. It would be better to use Peer 2 Peer connection, since it will be a multiplayer game.

Has anyone used Stratus or tried to make a multiplayer game via the built in socket?

The game will be a turn based game, similar speed to poker but if I could get faster turns that would be great.


texts: RWTexture3D in Compute Shader on Intel HD 4000

texts:
I'm having some weird issues running a Compute Shader with DirectX 11 on an Intel HD 4000 GPU.

The goal is to write different shapes into a DXGI_FORMAT_R32_FLOAT 3D Texture with a size of 128x128x128 - the example below creates a sphere.

On a NVidia GTX 680 the texture is generated fine, but on an Intel HD 4000 it seems the Z-coordinate/3D texture slice coordinate is multiplied by 4 (see image below).

The drivers for the Intel GPU are up to date (Dec 2015). The compute shader is executed only once, immediately after initializing DirectX swapchain/viewport/... and I disabled all other render code in the application which could influence the compute shader.

I'm running DirectX with D3D11_CREATE_DEVICE_DEBUG enabled which prints no warnings/errors and shader compilation returns no error messages either.

In this picture you can see the 3D Textures generated by the two GPUs in comparison - the slices of the 3D texture are placed besides each other:

DirectX Code:

// INITIALIZATION

//loads & compiles shader from file
ID3D10Blob* computeShaderbuffer = m_Context->loadShaderFile(compute_shader, "cs_5_0");

device->CreateComputeShader(computeShaderbuffer->GetBufferPointer(), computeShaderbuffer->GetBufferSize(), NULL, &m_ComputeShader);

D3D11_TEXTURE3D_DESC desc = {};
desc.Width = m_dataSize.x; // 128
desc.Height = m_dataSize.y; // 128
desc.Depth = m_dataSize.z;  //128
desc.MipLevels = 1;
desc.Format = DXGI_FORMAT_R32_FLOAT;
desc.Usage = D3D11_USAGE_DEFAULT;
desc.BindFlags = D3D11_BIND_UNORDERED_ACCESS;
desc.CPUAccessFlags = 0;
desc.MiscFlags = 0;

device->CreateTexture3D(&desc, nullptr, &m_DensityTexture3d);
device->CreateUnorderedAccessView(m_DensityTexture3d, nullptr, &m_DensityShaderWriteResource);

// EXECUTION
deviceContext->CSSetShader(m_ComputeShader, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &m_DensityShaderWriteResource, nullptr);

deviceContext->Dispatch(m_dataSize.x, m_dataSize.y, m_dataSize.z);

deviceContext->CSSetShader(nullptr, nullptr, 0);
deviceContext->CSSetUnorderedAccessViews(0, 1, &uav_null, nullptr);

Compute Shader:

RWTexture3D<float> output : register (u0);

[numthreads(16, 16, 1)]
void main(uint3 id : SV_DispatchThreadID)
{
    float3 size;
    output.GetDimensions(size.x, size.y, size.z);
    float3 center = size / 2.0f;

    float max_distance = center.x * 0.7f;
    float3 norm_position = float3(id) / size;

    output[id] = 1.0f - (length(float3(id)-center) / max_distance);
}

Am I doing something wrong or is it simply an Intel issue?

Thanks for your help!


texts:
Initial Situation
Using Blender 2.6, I often come to the same problematic setting: There are two faces on one straight line.

My Aim
I want to keep just one of the two selected faces, which you can see above. And all of the vertices adjoining the one face should be merged [Alt + M in Vertex Select Mode] with the apt vertex adjoining the other face.

Summary
I just simply need a tool working like Vertex Merging [Alt + M in Vertex Select Mode] for faces.
How can I do that easily?


texts:
I want to import an image using Haxe, my image is big but it is 8 bits and it weighs 89kb. The problem occurs when I import it, because the size of the memory grows by 35mb. I suppose it is reserving memory for a 32bit image.
Any idea how to import an image of 8bits, without consuming so much memory?


texts:
I have beens struggling with the following. In the game I am developing with Unity 5 in C#, I need to implement basic pathfinding over moving platforms (not with moving platforms). It means, I am not concerned that NPC are able to take moving platforms, I am specifically concerned that the whole pathfinding process should happen on big moving floors.

Being that the case, NavMeshes are not an option. Would anyone happen to know of any approach, or have any good tips for that? Thanks in advance for your time.


texts:
I want to create a game where the main character can pass through all the zombies that are chasing him but he can also jump up and bounce on their heads to kill them (like in old mario)...

The problems I am running into are:

When I am in the same position as the zombie and jump to kill him the trigger collider triggers the Destroy(Zombie) method. I only want them to be killed when you "Stomp" on them.
How do I make the character able to pass through the zombies without falling through the floor?

Here is my code for the trigger event that is attached to the "Stomper" box collider on my character.

     void OnTriggerEnter2D (Collider2D other) {
    if (other.tag == "EnemyHead") {

        //Destroy
        Rigidbody2D playerRB = transform.parent.gameObject.GetComponent<Rigidbody2D> ();
        playerRB.velocity = new Vector2 (0, 0);
        playerRB.AddForce(Vector2.up * 10, ForceMode2D.Impulse);

        Destroy (other.transform.parent.gameObject);

    }
}

Let me know if you need anything else. I am trying to explain this as well as possible...


texts:
Recently I started creating a game in java to hone my rusty java (I work primarily with cpp) and because I thought it to be a neat idea. To better illustrate the problem, let me explain a part of the game. The details aside, the game is in essence a dungeon builder and the problem pertains to the blocks you place down to create the maze adventurers have to travel through. Each block is a corridor and on each wall/floor/ceiling of a block you can place objects such as traps etc. However, while finishing up the game engine I realized I still lacked a list for blocks/objects that are special. Blocks or items that need a special animation (some extend spikes, some shoot fire, some contain a chest with inventory, etc). They're hard to bring together in one class and as we all know they can't be together in one list with different classes unless we want code-bloating. So my question is, what is the most efficient way to make collection of diversified game objects and how do other games do it?

Presently I have the following methods thought out.

I reduce all objects to instances of one class. They all fit in one list. However, to induce special methods I need a long list of methods that each do something else. Frankly, this method is inefficient, unpleasant and unpractical to work with.
I reduce all object to instances of one class. They all fit in one list. However, they each have an ID of a special action. If the need arises the ID gets compared with another list that's much shorter in length and uses generics or reflection to store the different effect. If it needs a special action it simply activates the effect (such as fire plume) on the given vector. The problem with this is that it does not allow for direct manipulation of the object such as a block that moves out to squash adventurers. Or if it could, it would be messy code, unnecessary throughput of code etc. I'd rather avoid it.
I make a list of the base class/interface and add the different child classes to it. Each child class can thus have a different implementation. However, to access it, I need to know to use reflection and for that I need to know the initial class, which, in many cases, I don't since I want a dynamic system. The result is that I need to store the child class name in the 'block' parent class and then when the need arises, use that name to reflect the new class. Once again, it is inefficient and far too slow.
I create a list of the block class and access it every time a generic block needs to be checked. However, if a creature/person walks over a tile it checks if the child class name in the block class is empty. If not, convert it to that class and execute the special function. This seems the best option as it gives the least code-bloating, is the most efficient, etc. However, it still needs to reflect and convert every time a creature goes onto a special block.
I create an event driven list in which each block instance has his own special event that links to a certain animation. This is very tedious, very inefficient and because it is so detached it is once again difficult to animate the basic block.
I use generics. Sadly, this causes far too much code-bloating and the accessing of the classes themselves gets difficult and messy.
I create a huge switch method and each block instance has a number. The number corresponds with the correct animation in the switch it needs to execute. I don't think I need to say why I don't want to do this.

And there are a few more, but each of them is still as inefficient as the next. Furthermore, every time I look around this site or another people say "use a base interface/class in a list" however they never say what the most efficient way is to get the class out of the list again. Am I missing something obvious? How should I tackle this?


texts:
This is probably a simple vector question, but I'm not sure how to do it.

I have an object at vector position (ox,oy). Potentially every update, the user walks around the screen, and will be at position (px,py) at any given moment. How do I make it so that the object is always facing the player? I need to get the angle in degrees.

This is what I've been messing around with, but the direction doesn't immediately point to where the user is located. Instead, it slowly increments in the direction the user is walking in.

 objVec.Normalize();
 playerVec.Normalize();

 obj.Rotation = MathHelper.ToDegrees((float)Math.Acos(Vector2.Dot(objVec, playerVec)));

I might be going about it completely wrong, so any help is appreciated!


texts: Can I set multiple animations to run at the same time with Unity's animator (some animated properties would overlap)

texts:
I am creating a vehicle in Unity and I am currently trying to set up lights for it. I need to be able to press one button to turn on the parking lights. But the parking lights share the same bulb as the turn signals. So when a turn signal is turned on, I need that parking light bulb to now flash, while the others remain on. This is just one example of several I am coming across.

Now, I could create an animation for every single scenario, but I believe there should be a simpler way to do this. I thought perhaps using the layers would handle it, but I'm fairly new to animations and I'm not sure I'm understanding them right. I put each animation on a different layer, and then ordered them in a way that made sense to me, and set them to additive. The right turn signal is on top and it works, but the left turn signal right below it does not.

Is there something else I can do to make this work? Or a tweak I can do to fix what I have now, something I'm missing maybe? Thanks for the help!


texts: How can I implement infinite scrolling by scrolling the background's texture, not the quad?

texts:
I'm writing a 2D platformer game on Java with LWJGL. I'm doing this just for the sake of learning and not the result itself, so when I decided to implement scrolling I did it two ways I could invent myself:

Three "sky" rectangle entities that located in a row and when my camera is moved to the right (fully on third), I move my first rectangle (from the far left) to the far right, etc. Pretty sure it can be made that way only with two entities, but I didn't have enough motivation to do it right now.
Not infinite, but you can just stack these Sky entities in a row for the whole level width. Very lame approach.

But I realised that to optimize it, I can move not the "canvas", but the "painting" on the "canvas" itself. So, is it possible to move it this way? I'm not entirely sure that's possible at all, but I think it should be. How I see it: I change not position.x or position.y, but the texture coordinates, they should repeat, aren't they?

My code, if that will be helpful anyway.
Render function in Main class:

private void render() {
    setupGL();
    GL11.glPushMatrix();
        GL11.glTranslatef(-Camera.x, -Camera.y, 0.0f);
        GL11.glScissor(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT);
        sky.draw();
    GL11.glPopMatrix();
}

Draw function of the Sky entity, and yes, I know that immediate mode is bad, but I still haven't got my hands on arrays and other drawing methods.

public void draw() {
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, TextureWrapper.get(EntityTypes.SKY).getTextureID());
    GL11.glColor3f(1.0f, 1.0f, 1.0f);
    GL11.glBegin(GL11.GL_QUADS);
        GL11.glTexCoord2f(0.0f, 1);
        GL11.glVertex2f(this.x, this.y + this.height);

        GL11.glTexCoord2f(1, 1);
        GL11.glVertex2f(this.x + this.width, this.y + this.height);

        GL11.glTexCoord2f(1, 0);
        GL11.glVertex2f(this.x + this.width, this.y);

        GL11.glTexCoord2f(0.0f, 0);
        GL11.glVertex2f(this.x, this.y);
    GL11.glEnd();
    GL11.glBindTexture(GL11.GL_TEXTURE_2D, 0);
}


texts: How can i play animationclip from array of AnimationClip?

texts:
The original goal is to switch and play each time animation from the Animator.
But not sure if it's possible so i'm trying to play it as animation clips.

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

public class SwitchAnimations : MonoBehaviour
{
    private Animator animator;
    private int index = 0;

    static UnityEditor.Animations.AnimatorController controller;

    // Use this for initialization
    void Start ()
    {
        animator = GetComponent<Animator>();

        GetStateNames(animator);

    }

    // Update is called once per frame
    void Update ()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            if (++index == controller.animationClips.Length)
                index = 0;
            Animation clip = controller.animationClips[index];

        }
    }

    private static UnityEditor.Animations.AnimatorState[] GetStateNames(Animator animator)
    {
        controller = animator ? animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController : null;
        return controller == null ? null : controller.layers.SelectMany(l => l.stateMachine.states).Select(s => s.state).ToArray();
    }
}

What i want is to switch between the animation and each time i switch by pressing A it will play the current animation clip.

I'm getting error on the line:

controller.animationClips[index];

Cannot implicitly convert type 'UnityEngine.AnimationClip' to 'UnityEngine.Animation'

Update this is how i'm playing the Animator States:

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

public class SwitchAnimations : MonoBehaviour
{
    private Animator animator;
    private List<AnimationClip> myAnimationComponent = new List<AnimationClip>();
    private int index = 0;
    private static UnityEditor.Animations.AnimatorController controller;
    private UnityEditor.Animations.AnimatorState[] an;

    // Use this for initialization
    void Start()
    {
        animator = GetComponent<Animator>();
        myAnimationComponent = new List<AnimationClip>();

        an = GetStateNames(animator);

        for (int i = 0; i < controller.animationClips.Length; i++)
        {
            myAnimationComponent.Add(controller.animationClips[i]);
        }
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.A))
        {
            animator.Play(an[index].name);
            if (++index == an.Length)
                index = 0;
        }
    }

    private static UnityEditor.Animations.AnimatorState[] GetStateNames(Animator animator)
    {
        controller = animator ? animator.runtimeAnimatorController as UnityEditor.Animations.AnimatorController : null;
        return controller == null ? null : controller.layers.SelectMany(l => l.stateMachine.states).Select(s => s.state).ToArray();
    }
}


texts:
For, hours, I've been following these instructions.

public PathFinder(IntegralLocation loc, final int dest_x, final int dest_y) {
    boolean found = false;
    final List<Node> open = new ArrayList<>();
    final List<Node> closed = new ArrayList<>();

    // 1. Add starting node to open list
    open.add(new Node(loc.getX(), loc.getY(), Math.sqrt(Math.pow(dest_x - loc.getX(), 2) + Math.pow(dest_y - loc.getY(), 2))));
    Node current = null;

    final int[] axs = new int[] { -1, 1 };
    final int[] ays = new int[] { -1, 1 };

    while(!open.isEmpty() && !found) {
        // 2a. Select current node
        for(Node n : open) {
            if(current == null) {
                current = n;
            } else {
                if(n.g < current.g) {
                    current = n;
                }
            }
        }

        // 2b. Switch it to the closed list
        open.remove(current);
        closed.add(current);

        // If this is the destination, we've found it
        if(current.x == dest_x && current.y == dest_y) {
            found = true;
        }

        // 2c. Handle surrounding squares
        for(final int ax : axs) {
            for(final int ay : ays) {
                final int x = current.x + ax;
                final int y = current.y + ay;
                if(!isNodeInList(x, y, closed)) {
                    Node n = getNodeFromList(x, y, open);
                    if(n == null) {
                        open.add(new Node(x, y, Math.sqrt(Math.pow(dest_x - x, 2) + Math.pow(dest_y - x, 2))));
                    } else {
                        if(n.g < current.g) {
                            n.setParent(current);
                        }
                    }
                }
            }
        }
    }

    canAccessDestination = found;
    System.out.println("This won't get printed.");

    // Save the actual path
    while (current != null) {
        nodes.add(new Point(current.x, current.y));
        current = current.getParent();
    }
    System.out.println(nodes.size());
    inverse_stage = nodes.size() - 1;
}

The code above is supposed to be an implementation of the A* path finding algorithm but it's an infinite loop.

The loop always ends up stuck at n.setParent(current).

It is assumed, in this implementation that all nodes can be walked over.

I am sure that there is a tiny error somewhere but I can't quite find it.


texts:
I have 3 files. A JSON file, a PNG file, and a TXT file. Is there any possible way I can put all three inside a common file with a custom extension? (for example "fileName.abc")

I searched the web a little, and found this which is perfect, and exactly what I need:
https://gist.github.com/MobiDevelop/5514357
Which is a zip solution. But I don't want to compress the files and if the extension is not zip, I would be happier.

Question 1: Can we change a file's extension ("file.png" to "file.abc") and read it as if it had the same extension?

Question 2: How can I put multiple files into same file, just like AAA games do?

Question 3: Can I just create a non-compressed zip file and change the extension? And read it using the class in the link?

Question 4: Is there a better way than question 3? Maybe a third party solution or something?

EDIT: I don't want the files to be compressed because the game will be runned on mobile devices too. And the game might be loading files during gameplay. I am just worried that there might be staggers, fps drops while loading files.


texts: How can I constrain motion to a path formed from multiple splines?

texts:
I want to develop a system to constraint a character movement to a certain path, defined a-priori by the level designer to give some sort of 2D/2.5D look.

Right now I have a list of splines that make a path, I also can project a arbitary point to a specific spline. So what I do is this:

Iterate over all the splines in a path
Find the closest point on all the splines that make a path
And return the point with the minimum distance (thats my current point)

Now one issue that this leaves me with is: how do I find if I am actually out of the current path?

How would you implement this sort of system? I feel my way is not even close to a robust system.

For those of you wondering, lets say I am trying to implement something like Sonic Generations' 2D Segments (just the movement constraints). And by a path I mean like this. Its full 3D environment, but Sonic follows a predefined path.


texts:
I have thought of three steps for doing this:

Acquire the vertex coordinates which will represent the glyph's form
Extrude them
Render

Can you suggest a better method? Can you give me an insight on how to do the first and the second step?

I use FreeType 2.4.10 for text managment.


texts: How to Invite Facebook Users to a Unity Game for Android

texts:
I am currently using the following code to let the player invite other players to my multiplayer game:

FB.AppRequest("Test Message", callback: this.HandleResult);

and

FB.AppRequest("Test Message", null, null, null, null, null, null, callback: this.HandleResult);

When tested on an Android phone, it only brought up a Facebook dialog box for the player to choose his/her friends. Clicking "Send" would close the dialog box, but no message whatsover would be received on the target person's Facebook.

I used to do:

FB.Mobile.AppInvite(new Uri("xxxx"), callback: this.HandleResult);

but I understand this has been obsolete, invoking only a black blank screen.

I applied for a 'user_friends' Facebook permission but was told it was not required.

Both 'Single Sign On' and 'Deep Linking' have been enabled on the Basic Settings page at Facebook Developer.

What else should I try?

I tried to print out the result of the callback function which looks like this:

public void HandleResult(IResult result){
    string r = "";
    if (result == null) return;
    if (!string.IsNullOrEmpty(result.Error)) r += "Error Response: " + result.Error + "\n";
    else if (result.Cancelled) r +=  "Cancelled Response: " + result.RawResult + "\n";
    else if (!string.IsNullOrEmpty(result.RawResult)) r += "Success Response:" + result.RawResult + "\n";
    else r+= "Empty Response\n";
    r+=result.ToString();
    GameObject.Find("FBText").GetComponent<Text>().text = r;
}

and obtained the following:

Success Response: {"request":"415323562654670","callback_id":"2","to":"3XXXXXXXXXXXXX"}
Facebook.Unity.AppRequestResult
AppRequestResult:
   Error: null
   RawResult:{"request":"415323562654670","callback_id":"2","to":"3XXXXXXXXXXXXX"}
   Cancelled: False
AppRequestResult:
   RequestID: 415323562654670
   To: 3XXXXXXXXXXXXX

The request seemed to be successful. However, no invitation was received at the target account.

I am using the latest Facebook SDK -- version 7.15.1.


texts:
DISCLAIMER I don't pretend to know anything about licensing. In fact, everything I say below may be completely false!

Backstory:

  Recently, I've been looking for a decent game engine, and I think I've
  found one that I really like, Cafu Engine.

  However, they have a dual licensing plan, where everything you make
  with the engine is forced under GPL, unless you pay for a commercial
  license. I'm not saying that it's a bad engine, they even say that
  they are very relaxed about the licensing fees. However, the fact that
  it even involves the GPL scares me.

So my question is basicly, how does one escape the GPL.

Here's an example: The id Tech engine, also known as the Quake engine, or the Doom engine, was the base for the popular Source engine. However, the id Tech engine has been released under the GPL, and the Source engine is proprietary. Did Valve get a different license? Or did they do something to escape the GPL? Is there a way to escape the GPL? Or, if you use GPL'd source code as a base for another project, are you forced to use the GPL, and make your source code available to the world. Could some random person take the id Tech engine, modify it past the point of recognition, then use it as a proprietary engine for commercial products? Or are they required to make it open source.

One last thing, I generally have no problem what-so-ever with open source. However I feel that open source has it's place, but that is not in the bushiness world.


texts: How to instantiate seamless scrolling tiles

texts:
I'm trying to create in Unity an "Endless Runner" game, where the player remains stationary on the 0 of the axes while the tiles underneath him scroll with a fixed speed on the Z-Axis.
The script attached spawns 5 tiles at the start while already scrolling at the speed set in the GameManager and then keeps on spawning tiles based on a timer.
The issue I'm facing is the following:
The tiles that are spawned with the timer are too much distant from the starting set of tiles.
How can I calculate the correct distance between the set of the already scrolling tiles and those the script start to spawn after 5 seconds in order to have seamless scrolling?
I'm attaching the script with what I've written so far in the hope that someone knows how to proceed, or perhaps knows a different method. Thanks!
public class TileManager : MonoBehaviour
{
    [SerializeField] private Transform player;
    [SerializeField] private GameObject[] tilesArray;
    [SerializeField] private int tilesToSpawn = 5;
    [SerializeField] private float zPosSpawn = 0f;
    [SerializeField] private float tileLength = 20f;

    public List<GameObject> tilesList;
    private float spawnRate;
    private float timeSinceLastSpawned;

    void Start()
    {
        //scrollingSpeed is -5
        spawnRate = GameManager.Instance.scrollingObjectsSpeed * -1;
        StartSpawnLogic();
    }

    void Update()
    {
        timeSinceLastSpawned += Time.deltaTime;
        SpawnTimer();
        DestroyAfterSpawn();

    }

    private void StartSpawnLogic()
        {
            for (int i = 0; i < tilesToSpawn; i++)
            {
                if (i == 0)
                {
                    SpawnTiles(0);
                }
                else
                {
                    SpawnTiles(Random.Range(0, tilesArray.Length));
                }
            }
        }

    //SPAWN FUNCTION
    private void SpawnTiles(int tileIndex)
    {
        //On Instantiation a list is filled to later dispose of the tiles after they reached a certain point
        tilesList.Add((GameObject)Instantiate(tilesArray[tileIndex], transform.forward * zPosSpawn, Quaternion.identity));
        zPosSpawn += tileLength;
    }

    //TIMER
    private void SpawnTimer()
    {
        if (timeSinceLastSpawned >= spawnRate)
        {
            timeSinceLastSpawned = 0;
            SpawnTiles(Random.Range(1, tilesArray.Length));
        }
    }

    void RemoveObjFromList(GameObject tile)
    {
        Destroy(tile);
        tilesList.Remove(tile);
    }

    private void DestroyAfterSpawn()
    {
        for (int i = 0; i < tilesList.Count; i++)
        {
            if (tilesList[i].transform.position.z <= -20f)
            {
                RemoveObjFromList(tilesList[i]);
            }
        }
    }
}


texts: Making Bigger Touch Space in Node Using SpriteKit And Objective-C

texts:
I am trying to make simple game, but I have a problem. The node is too small. On iPhones with smaller screen size, the finger can't move it. On iPad and on simulator, however, the node can be moved due to larger sizes of the screens. Due to that, I know it's not the code that causes the issue.

Due to the fact that I am using this paddle image on many levels, I create it as separate file so I can implement it anywhere I want within the app.

Here is what I got:

PaddleNode.m

- (id)init
{
    return [self initWithName:@"paddle"];
}

- (id)initWithName:(NSString *)name
{
    self = [super init];
    if (self) {

        self = [PaddleNode spriteNodeWithImageNamed: @"board.png"];
        self.userInteractionEnabled = YES;
        self.name = name;
        self.physicsBody = [SKPhysicsBody bodyWithRectangleOfSize:self.frame.size];
        self.physicsBody.dynamic = NO;
        self.physicsBody.usesPreciseCollisionDetection = YES;
        self.physicsBody.categoryBitMask = paddleCategory;
        self.physicsBody.collisionBitMask = emptyCategory;
        self.currentTouchValue = nil;
    }

    return self;
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
    self.previousTouchesTimestamp = event.timestamp;
    for (UITouch *touch in touches) {
        self.currentTouchValue = [NSValue valueWithNonretainedObject:touch];
    }
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    self.currentTouchValue = nil;
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
    for (UITouch *touch in touches) {
        NSValue *key = [NSValue valueWithNonretainedObject:touch];
        if ([key isEqualToValue:self.currentTouchValue]) {
           CGPoint touchPoint = [touch locationInNode:self.scene];
           CGPoint movePoint = CGPointMake(self.position.x, touchPoint.y);

           if ([self withinParentFrame:movePoint])
               self.position = movePoint;
       }
    }
 }

 - (BOOL)withinParentFrame:(CGPoint)point
 {
    CGFloat offset = self.size.height / 2;
    if (point.y >= offset && point.y <= self.scene.frame.size.height - offset)
        return YES;
    else
        return NO;
 }

P.S. I am learning Objective-C by myself and English is not my first language. So, if it's OK, explain me like you would to little child.


texts: AS3 hittest with a tweening movieclip, what is the best way?

texts:
I'm making a simple game. The character is movable with the arrow keys.
The enemies are moving around the screen with a (classic) tween.

I want to detect collision between the character and the enemies. At first I thought it was working properly, but it also seems to detect a collision on the starting position from the enemies. So even if the enemies are already moving/tweening away from their start position, there's a collision detected between the character and these starting positions. (please ask questions if you don't quite get what I mean)

First method:

addEventListener(Event.ENTER_FRAME, checkIfHitTest);
function checkIfHitTest(Event)
{
      if(player.hitTestObject(enemies))
      {
        trace("yes");

      }
      else
      {
           trace("no");

      }
}

This didn't work properly because it seems to detect the collition even if the enemy moved away from the starting point. (Probably because the ENTER_FRAME but correct me if i'm wrong)

My question to you: What's causing the detection and what is the best way to detect collision between a tweening movieclip and a movieclip wich is movable with the arrowkeys?


texts:
I'm making a small text browser RPG game using PHP, MySQL and Java Script (and jQuery). All the items are saved in the MySQL database.

Every now and then a character have to make a skill roll (Talk, Climb, Sneak, etc. ), but I have the following problem - some of the items give passive bonuses to some skills. Let's say we have Official Suit item, it gives +1 to Talk rolls and One time use only - automatic success on a Talk roll.

My problem is the following - how can I implement a function for every item, that gives the bonuses or other options when the appropriate roll is made. I want when the player click the Talk option, a function to be run that makes the Talk roll and searches character's inventory for items that give him bonuses to that roll. If it sees that the player have such an item, let's say it's the Official Suit, it runs the item's function which gives the +1 Talk bonus and if the roll fails, the function gives an option to use the special ability of the item for automatic success.

So what is the best way to do this? Keywords to each item or some other way? I can't think of a scalable solution.


texts: Undefined reference error when trying to access a component using ECS

texts:
I'm trying to access the x and y values from PositionComponent in my MovementComponent but I get this error and I just can't figure out why I get this.

in my Entity class I've got a function GetComponent() that looks like this:

template<typename ComponentType>
ComponentType* Entity::GetComponent() {
    for(unsigned int i = 0; i < m_components.size(); i++) {
        if(ComponentType* cmp = dynamic_cast<ComponentType*>(m_components[i])) {
            return cmp;
        }
    }
    return NULL;
}

m_components is a vector of Component* that looks like this:

std::vector<Component*> m_components;

My MovementComponent looks like this, and I get an error for some reason here:

void MovementComponent::MoveRight() {
    m_ContainingEntity->GetComponent<PositionComponent>()->x++; //I get the error at this line.
}

Error:
undefined reference to `PositionComponent* Entity::GetComponent()'

What did I do wrong? I've got a feeling that the solution is really simple and that I just didn't pay much attention.

Entity.h:

#ifndef __ENTITY_H__
#define __ENTITY_H__

#include <vector>
#include <cstddef>

class Component;
class ECSManager;

class Entity {
public:
    void AddComponent(Component* cmp);

    template <typename ComponentType>
    ComponentType* GetComponent();

private:
    friend class ECSManager;
    std::vector<Component*> m_components;
};

#endif // __ENTITY_H__

Entity.cpp:

#include "Entity.h"
#include "Component.h"

void Entity::AddComponent(Component* cmp) {
    m_components.push_back(cmp);
    cmp->m_ContainingEntity = this;
}

template<typename ComponentType>
ComponentType* Entity::GetComponent() {
    for(unsigned int i = 0; i < m_components.size(); i++) {
        if(ComponentType* cmp = dynamic_cast<ComponentType*>(m_components[i])) {
            return cmp;
        }
    }
    return NULL;
}

MovementComponent.h:

#ifndef __MOVEMENTCOMPONENT_H__
#define __MOVEMENTCOMPONENT_H__

#include "Component.h"

class MovementComponent: public Component {
public:
    void MoveRight();
    void MoveLeft();
private:
};

#endif // __MOVEMENTCOMPONENT_H__

MovementComponent.cpp:

#include "MovementComponent.h"
#include "Entity.h"
#include "PositionComponent.h"

void MovementComponent::MoveRight() {
    m_ContainingEntity->GetComponent<PositionComponent>()->x++;
}

void MovementComponent::MoveLeft() {

}


texts:
Well I'm trying to create a pong clone using SDL and I had some problems with the frames and some times the ball would go through the paddles despite the fact that at other times the collision worked perfectly. So I searched it a bit and I came to the conclusion that it was because in one frame the ball was already through the paddle and in another frame the ball was not or something like this. So thought that if I would manually adjust the position of the ball, like move it a couple of pixels away the moment it hits a paddle or the walls too, this would solve the problem. But now when the ball goes right past a paddle its movement is getting weird and it goes right in the playing field.  for reference also some code if you want to look it . I feel bad for doing the whole collision like these but I couldn't think some other way. Please enlighten me if there are better ways to do it that I can avoid the frame problem I mentioned above. Here is the code that handles the ball's movement :

   void Ball::move(float xLeftPaddle, float yLeftPaddle,float xRightPaddle, float yRightPaddle, Uint32 deltaTicks)
{

    y +=  yVelocity * ( deltaTicks / 1000.f );
    x +=  xVelocity * ( deltaTicks / 1000.f );

    if(   y + BALL_HEIGHT > SCREEN_HEIGHT )
    {
        x = x-1;
        y = y-1;
        yVelocity = -yVelocity;

    }
    else if( y < 0 )
    {
        x = x+1;
        y = y+1;
        yVelocity = -yVelocity ;
    }
    else if(x + BALL_WIDTH >= xRightPaddle && y <= yRightPaddle + PADDLE_HEIGHT && y >=yRightPaddle  )
    {
        x = x-1;
        y = y-1;
        xVelocity = -xVelocity;

    }
    else if( x <= xLeftPaddle + PADDLE_WIDTH && y <= yLeftPaddle + PADDLE_HEIGHT && y >= yLeftPaddle)
    {
        x = x+1;
        y = y+1;

        xVelocity = -xVelocity ;
    }
    else if(x < 0 || x > SCREEN_WIDTH)
    {
        x = SCREEN_WIDTH/2;
        y = SCREEN_HEIGHT/2;
    }

}


texts: Fade or Cutout Render Mode, least performance expensive?

texts:
I would like to optimize my WebGL Unity game, so I was wondering if I have a plane with a texture of say a mountain for background, what render mode for its material be least expensive? Fade or Cutout?

Thanks in advance!


texts: Calculating the flavour of a dish in a cooking game

texts:
I'm currently working on a game that sees players cook dishes and are scored on their performance. To determine whether a dish is good or not, I will be looking to see if these elements are balanced:

Salt
Fat
Acid

A dish is made up of multiple ingredients and each ingredient will have its own salt, fat and acid levels. Adding too much or too little of an element (e.g. over-salting) results in a weaker score for the player.
There are also a few other factors that affect the salt, fat and acid balance:

The number of ingredients (adding more ingredients should reduce saltiness, fattiness and acidity)
Acid can reduce the saltiness and fattiness of a dish.
Salt can reduce the acidity of a dish.

This idea comes from Samin Nosrat's book Salt, Fat, Acid Heat. Below is an image from her book where she breaks down 4 popular salads and shows how each of the ingredients affects each element. If the player was to recreate "The Caesar" salad, they should get a perfect score for balancing all those ingredients but if they created a salad with just bacon and anchovies it should be considered too salty.
Texture is another element that the player needs to balance but this won't need to be calculated in the same way as the other elements. My plan here is to check if the player is making a salad it should have some crunch to it, whereas if they are making a roast the meat should be tender.

Given a set of ingredients, I would like to calculate whether the dish is balanced or not. The game will probably have 100s of ingredients and I would like some advice on how to best calculate these elements, score the player and balance the many ingredient combinations a player can come up with.


texts: Is a degree in game development really more beneficial than one from computer science?

texts:
I need help in deciding what major to choose (I will graduate high school in a year). I have little to no experience in programming, but I'll use my spare time to learn it.
I narrowed down my options to 3 majors, Comp Science, Game dev and cyber security.
I've always enjoyed games and have been curious of how I could make one, but I'm quite worried about the job potential in the  country I'm living in, where the large game companies are not here yet.

If I take majors like cyber security or comp science, will I still be able to work in game development?


texts: Attaching a swinging object to a rolling object?

texts:
I am new to Unity and attempting to create a platform that hangs down under a roller that runs on rails. I've gathered my objects and come so far but I can't for the life of me work out how to attach the platform to the roller on top without the rope connecting them getting wound up on the roller as it goes along.

Is there a way to make sure only the roller turns but the rope attached just follows it vertically and horizontally?


texts: Order array of points in counter clockwise

texts:
I happened to see an answer to "Sort array of points in clockwise", could you please elaborate the 4th point of that answer:

sort points relative to their a value, using qsort for instance.

How do I do the above step?

I'm looking for an algorithm to sort list of points in counter-clockwise.


texts:
Currently I have refined voxels, I want to smooth it to achieve accurate projection. After some web search, I came across smoothing algorithms such as Catmull-Clark, Doo-Sabin etc. Along with this, I read one should need the connectivity information to use smoothing algorithm on the outer face of voxel and the connectivity information can be established using the Half edge data structure.
I understand that I need to feed voxel data to Half edge data structure so that I can proceed with a further step but the thing is I didn't get proper idea to use CGAL's Half edge data structure. Moreover, the documentation didn't help me much. Can someone help me to figure this out?.

For example, I have taken sphere as input geometry (First Image). After voxelization, I used intersection algorithm to identify boundary cells which represent actual input geometry as you can see in the above image. Either we can take voxels outside boundary or inside the boundary for projection. Since projecting inside voxels on the surface mesh is quite easy. So directly by using ray shooting on refned voxels, I identified those voxels which are inside boundary voxels. Inside voxels also represents geometry which also looks like in middle image.
From middle Image, we can see that the size of the cells varies from one to another. I want to identify outermost faces from it so that I can use a smoothing algorithm to eliminate Cartesian front to achieve accurate projection.


texts: Are minecraft LANS and servers Filtering Enabled?

texts:
Non-filtering enabled means any given client can make changes and the server will replicate them. This is faster but opens doors for hackers and exploiters. Filtering enabled means the client provides user input, and the server decided what to do accordingly. This idea came from Roblox, but I wonder if Minecraft servers are filtering enabled?

In other words: Is Minecraft Filtering Enabled?


texts: libgdx - Trying to load ttf font using asset manager

texts:
I tried to load a ttf font using an AssetManager like this:

FreetypeFontLoader.FreeTypeFontLoaderParameter freeTypeFontLoaderParameter = new FreetypeFontLoader.FreeTypeFontLoaderParameter();
freeTypeFontLoaderParameter.fontFileName = "fonts/zrnic.tff";

FreeTypeFontGenerator.FreeTypeFontParameter freeTypeFontParameter = new FreeTypeFontGenerator.FreeTypeFontParameter();
freeTypeFontParameter.minFilter = Texture.TextureFilter.Linear;
freeTypeFontParameter.magFilter = Texture.TextureFilter.Linear;
freeTypeFontParameter.flip = false;
freeTypeFontParameter.size = 62;

freeTypeFontLoaderParameter.fontParameters = freeTypeFontParameter;

game.assetManager.load("myFont62.ttf", BitmapFont.class, freeTypeFontLoaderParameter);

But I get

  Couldn't load dependencies of asset: myFont62.ttf


texts: 3D objects with animated bones Monogame in the year 2017, is it possible?

texts:
I've been working on a game for quite some time now and suddenly it seems that I've hit the great wall of..

In the earlier XNA there were possibilities to use animation exported with the 3D object .fbx files, but this was in the old XNA with SkinningData and AnimationPlayer etc.

I can't use these old samples that I've found on the Internet.
How can I in the year 2017 animate an animated 3D object exported from Blender .fbx animate it in Monogame by the use of them bones?

I'm using Monogame in C# VS2017 but the Microsoft.Xna.Framework.Content.Pipeline.Processors and everything else doesn't exist.

The closest thing to an animation that I've made is to split up my object into pieces in Blender and animate each part with CreateTranslation and CreateRotation.. But that's old school to do it that way.

Or, I misunderstood the whole thing?

I'm not going to use Unity.


texts:
I would like to make a tileable texture with UV noise in Unity Shader Graph only, but I have a problem.
After creating simple noise from UV, I want to rotate it by 90 degrees, but the node Rotate (as well as Rotate About Axis) doesn't rotate my UV (like a picture in PS), instead it changes the colors in it from black & white to red (yellow, green, ...) & black.
Could you tell me please, how to fix it?

Some context :
Based on the answer https://gamedev.stackexchange.com/a/23631 , I want to rotate the noise three times (so 0° + 90° + 180° + 270°), multiply them and thus normalize the edges to make the texture tileable.
Instead of it, even at 0° rotation the color of noise is changed to yellow somehow and the multiplication is everything but not the result I want.
That's how I wanted to do it:


texts: Filling a 2D polygone with N points more or less equally distanced

texts:
Following challenge: having any number of connected 2D faces forming virtually a polygone and filling the polygone with a variable number of points equally distanced to each other.

So here is a sample 2D object with any number of faces, all connected to each other, forming virtually a polygone:

Here is what I would like to calculate (in JavaScript or Python or pseudo): a variable number of points inside the faces, equally distanced to each other.

Some notes:

The points distance to each other doesn't need to be 100% the equal.
Prioritized points are at the borders of the faces
I should be able to define the targeted number of points, but it doesn't need to be exactly that number of points, can be more or less.
Any ideas how to approach?


texts:
I have a question about the GUI implemented by Thinmatrix. For positions we have to use values between [-1, 1]. This is probably because the origin of the screen is the center and then we have a 1 by 1 grid.
Is there a possibility to change this up, and reposition the origin to for example the top left corner, and make the screen a lot bigger to use absolute coordinates instead of values between [-1, 1]

Thanks,


texts: Creating a simple countdown timer in unity

texts:
Hello's I was looking for a way to do a countdown timer in unity and stumbled across this solution :
public float timeRemaining = 10;

private void Update()
{
    if (timeRemaining > 0)
    {
        timeRemaining -= Time.deltaTime;
    }
    else
    {
        WinGame();
    }
}

Which at first seemed pretty elegant and easy to use, however, I was thinking about it, and wouldn't this be inconsistent for players with different FPS?
For example, if the player has 60 FPS vs 30 fps it would take longer for the player having 60 FPS to reach 0 on time remaining.


texts: LibGDX - Level management on a level-based game

texts:
I'm new to LibGDX and android development in general and am trying to do a puzzle game. Being a level-based game, i'm trying to make it so in every level a certain number of blocks (just rectangular sprites) appear in a certain position / rotation, like in the image linked below:

https://i.gyazo.com/52e6c71e1f05ab4529e0fec9d4f80bd7.png

I've doodled some levels already but i'm really not sure about how to make the blocks's rearrangement over the levels.
How exactly should one manage this? As the position of the blocks won't be random i was thinking about reading from files the information from every level (x, y, rotation, colors, etc. for every block) but to do that i would have to manually organize every level's blocks properties information (to then save), and, considering it would have atleast 100+ levels, it would take too long... Other than that, i could have them as plain assets but having an asset for every single level doesnt't look like an efficient solution either. Do you have any tips, please?


texts:
Lets say I make a height map and I want to make it out of CUBES to use in my game. I dont want to generate anything procedualy, I just want to cubify a height map. So I just want a static mesh.
I also want to LOD it, so I have a 1024 version, a 512 version, and a 256 version.
Btw I am using Blender and UE4.


texts:
I created an installer for my XNA demo in the hopes that people could just download it and use it. It runs perfectly on my computer, however on others, it installs fine, but the demo doesn't run and has to close. The included dependencies are:

DotNetFX35
WindowsInstaller3_1
and XnaFxRedist31

The Demo also makes use of a number of text files which contain path lookup tables. Could it be that these are not being included? It seems unlikely that this is the issue though as it runs on my machine. It must be a missing dependency I think but I don't know what...


texts: Is there a way to set texture wrap mode as repeat in SDL 2?

texts:
In SDL2, I would like to render a texture on the screen, but with destination rectangle greater than texture size. Instead of stretching the texture, I would like the texture to be repeated as many time as possible.

Here is code I use (pseudo code)

SDL_Rect src = { x = 0, y = 0, w = texture.Width, h = texture.Height };
SDL_Rect dst = { x = 0, y = 0, w = texture.Width * 3, h = texture.Height * 3 };

SDL_RenderCopy(renderer, texture, src, dst);


texts: Prevent character's animation from causing its mesh to interpenetrate itself

texts:
I'm making a game with a pretty large group of people that respond to things the user does. They all have the same animator attached, but the animations that play differ using a script with a randomizer.

Now all Mixamo stuff is free I'm making some new and different models to put in my game, these models differ in size and shape, just like humans do. My previous setup was pretty much two models with the textures changed, so the animations were acting the same on all models.

This is now no longer the case with the new models. Hands of the models are moving through their leg mesh (see attached image). I fear I'd have to make separate animations for each model but I'd first like to know if there's maybe another way. I tried adding colliders to the leg and hand of each model, but the animation totally ignores those.

Does anyone know of a way to make sure body parts of my models don't go trough eachother? Or do I have to face the facts and make seperate animations for each model?


texts: SQLite Query from unknown table based on known column value single query

texts:
I'm working on a database to back up my online TCG. It's currently SQLite, but I'm going to transition it to a MySQL database later.

Currently, I have three distinct types of cards with their own unique fields. For example. However, all cards have a single uniqueid that I use to refer to them.

TABLE cards {
    CARD_ID as INT
    CARD_TYPE as INT
    TYPE_ID as INT
}

TABLE creature_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    ATTACK as INT
    DEFENSE as INT
    ELEMENT as INT
    FLAGS as INT
    MANA_COST as TEXT
}

TABLE spell_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    SPELL_TYPE as INT
    ELEMENT as INT
    MANA_COST as TEXT
}

TABLE mana_cards {
    CARD_ID as INT
    TYPE_ID as INT
    NAME as TEXT
    FLAVOR as TEXT
    ELEMENT as INT
}

I'm trying to figure out how to build a query that will allow me to get all fields from a specific table without knowing the table I need to pull from ahead of time.

Basically, I want to be able to supply CARD_ID, query the cards table, and use the CARD_TYPE and TYPE_ID to return the row from creature_cards where CARD_TYPE is 1, spell_cards where CARD_TYPE is 2, and mana_cards where CARD_TYPE is 3.

I'm currently doing this through two separate queries and doing the logic on the backend, but I'm wondering if there's a way to get the data all in one query, because my queries can be quite time consuming.

Would it just be better to jam all card fields into one table, rather than keeping them in three separate tables?


texts: How to use multiple UV maps with ShaderLab (Unity)

texts:
I want to layer one texture over top of another on the same mesh, but map the textures to different UV maps.

The example for Detail Maps in the Surface Shader Examples looks almost identical to what I want, but it seems that it uses the same UV map as the albedo texture, multiplied by 2.

I will admit I am very new to ShaderLab, but I am willing to put the work in and research: I just haven't seemed to be able to find the right documentation for what I want to do, or at least I do not understand how to use it.

I have achieved this result in blender this way, though I understand obviously there isn't a 1:1 conversion here.

I also have it working with ShaderGraph, which is neat, but I need it to work using the internal Unity shader for the project I am working on, so unfortunately ShaderGraph is out.

My understanding is that I would declare the UV maps under the Input struct like

struct Input {
    float2 uv_MainTex : TEXCOORD0;
    float2 uv2_Detail : TEXCOORD1;
};

and then grab the textures from the Properties input by doing

sampler2D _MainTex;
sampler2D _Detail;

and then use the inputs similarly to the _MainTex call which is

fixed4 c = tex2d(_MainTex, IN.uv_Detail).rgb * _Color;

I have also seen this answer but it doesn't really seem to solve the problem for me, it still doesn't seem to access my second UV map.

I do know that there is some confusion with how UV maps are used in HLSL vs. in Unity. Generally speaking I'm not concerned about overwriting UVs with lightmaps or stuff like that, and if that is an issue I can just add dummy maps when I export from blender to put my custom UV map as the 4th index.

My question is: how do I make one image map use a certain UV Channel and a second image use a second UV channel? Currently my setup is basically just a standard Lit Shader that I added the properties for the detail map to.

Right now it is only displaying the _MainTex on UV0.

Code in full here.


texts: Importing 3d model with multiple skeletons

texts:
I have created an animated butterfly in 3ds Max and try to export it in ".fbx" format to use in XNA, however as soon as I compile, i get the following Errors:

Warning   1 Multiple skeletons were found in the file. The first skeleton, named "Left.Wing" has been moved to be a child of the scene root. The other, "Right.Wing", will be ignored. Fragment identifier "Right.Wing".

Error 2  Vertex is bound to bone "Right.Wing", but this bone is not present in the skeleton.

Which is confusing since I have the bone Right.Wing . . and I use it to animate the butterfly

I have seen a few possible solution for Blender but none for 3Ds max it would be really helpful if someone could help me out with this


texts:
I was making a game and I did the side scrolling like this: if the player get past 150, the player stops moving and the background starts moving. But thats very annoying with placing objects in the game. Isn't there a better way to do this? I do not want to use cocos2D.

Thanks!


texts: Bitmap drawn with Graphics.DrawImage flickers

texts:
I am working on a space invaders clone using bugs as aliens. Everything works ok but the bug bitmap flickers on the screen.

    public void Form1_Load(object sender, EventArgs e)
    {

    }
    int x = 0, y = 0;
    private void Form1_KeyDown(object sender, KeyEventArgs e)
    {
        if(e.KeyCode == Keys.Left)
        {
            x-=5;
            if(x<=-350)
            {
                x = -350;
            }
        }
        if(e.KeyCode == Keys.Right)
        {
            x+=5;
            if(x>=375)
            {
                x = 375;
            }
        }
        if (e.KeyCode == Keys.Space)
        {
            if (y <= -530)
            {
                y = 0;
            }
        }
    }
    private void timer1_Tick(object sender, EventArgs e)
    {
        y -= 5;
        Invalidate();
    }
    protected override void OnPaintBackground(PaintEventArgs e)
    {

    }
    private void Form1_Paint(object sender, PaintEventArgs e)
    {
        Bitmap bug_one = new Bitmap("bug_one.bmp", true);
        Bitmap ship = new Bitmap("ship.bmp", true);
        Bitmap bullet = new Bitmap("bullet.bmp", true);
        e.Graphics.Clear(this.BackColor);
        e.Graphics.DrawImage(ship, 350 + x, 530);
        e.Graphics.DrawImage(bullet, 375 + x, 520 + y);
        e.Graphics.DrawImage(bug_one, 350, 0);
        e.Graphics.Dispose();
    }


texts: forward rendering and multiple shadow maps

texts:
I have two light sources on my scene. I created two fbo's which store depth textures for these lights. A render loop looks like this:

bind fbo1
save depth values for first light
unbind fbo1

bind fbo2
save depth values for second light
unbind fbo2

enable additive blending

bind first depth texture
render scene
bind second depth texture
render scene

disable additive blending

For one light source the program works fine. For many light sources I use an additive blending to acumulate lighting results but then some objects become transparent (for example when an object which is further away from the camera is drawn before an object which is closer to the camera). How to resolve that problem ? How should I accumulate lighting effects for many light sources (many shadow maps) ? P.S. I use OpenGL/GLSL 3.3+


texts: How to pass content through the project's structure efficiently?

texts:
so following situation. I have a project which is structured something like this.

Game1 -> GameManager -> Module (multiple instances)

During runtime units are being spawned in each instance of the Module class. Those Units require spritesheets for animation. Let us say each unit has a "Move", "Attack" and "Die" state, each using a individual spritesheet. This makes three Texutre2D instances per unit and with 5 different units this adds up to 15 different Texture files. Those are being passed to the unit's constructor on creation.

As I am loading those textures in Game1's LoadContent method I have to pass them the entire way to the Module class which then uses those textures to instaciate units.

Game1.LoadContent(15x textures) -> GameManager(15x textures) -> Module(15x textures) -> Unit(3x textures)

Imo this has several disadvantages:

As far as I can judge all those 15 textures are being held in memory of the Module classes the entire time. I would like to avoid
that.
Also passing 15 textures through the project's entire structure makes the classes unreadable and ugly.
I've got the overall feeling that this is not the way things should be done here.

In order to avoid problem #2 I created a class, its only purpose is to hold all textures that are needed in Module.cs. I called the class AnimationCollection. It holds Texture2D variables and the according getters and setters. So now my Project looks like this.

Game1.LoadContent(new AnimationCollection(15x textures)) -> GameManager(AnimationCollection) -> Module(AnimationCollection) -> Unit(AnimationCollection)

While this does seem to solve problem #2 the other problems remain. Are there other options on how to handle this problem? I could think of something like loading all content in the Module Class itself, but I never saw this before. I always load my stuff in Game1.LoadContent().

Any ideas, suggestions or expert knowledge is highly appreciated.

Thanks in advance!


texts: Java Scrolling 2d Block game - Optimise my code?

texts:
I have a 2d game where you look down from above and can scroll up, down, left and right using a viewport and a much bigger map.

I have been having trouble drawing a rectangle around the block under the cursor but finally cracked it more through luck than anything else but ended up with this code. Can you help me optimise it and simplify it?

int blockwidth=gridsize-2;

//Draw coloured blocks
for (int x=0;x<sizex;x++){
   int thex=-(int)locationx+(x*gridsize);
        for (int y=0;y<sizey;y++){
        int they=-(int)locationy+(y*gridsize);
        //if (thex>-blockwidth && thex<800){
            g.setColor(new Color( tiles[x][y][1]));
            g.fillRect(thex,they,blockwidth,blockwidth);
        //}
    }
 }

Especially this piece

//Cursor co-ords updated
cursorx=(int)locationx+(int)GameInput.mousex;
cursorx=(int)cursorx/gridsize;
cursorx=-(int)locationx+(cursorx*gridsize);

//Draw on screen cursor
        g.setColor(Color.yellow);
        g.drawRect(cursorx,cursory,blockwidth,blockwidth);


texts: Repositioning and resizing when i change the size of my window

texts:
I am trying to write a game.

When someone resizes the window of my game, I need all the graphics i have drawn on the screen to reposition correctly so that the ratio of the graphics' width and height remain correct and that the new position determined by x and y, have been adjusted for the new size screen.

In the following image, the top left corner is 0,0... all coordinates / widths / heights are measured from this point.

What do I need to do to x, y, width and height from the variable width and height of my screen in order to keep this aspect ratio correct?

SIDE NOTE: the aspect ratio of the screen will always be 16:9!


texts: How to efficiently render a large terrain mesh?

texts:
Recently I've been stuck on a problem thinking about the best way to generate a terrain into my game. In another projects I normally used heightmaps, so all the core-work was based on the engine used, but now this cannot be done because the terrain has millions of specific polygons that must be drawn accurately. Also, many of them cannot be parsed from the Y vector (because of polygons hidden beneath), that is, a heightmap is not useful here. In this case I had to use a COLLADA object.

Someone told me to manually divide the model inside a software like Blender, but unfortunately this is also not possible because these terrains are created in chunks in another software and loaded after into the game (that's the idea). Therefore this would be a big work to be obliged to manually slice them everytime.

Thus, since a week I've been studying about how could I solve this problem and procedurally load this mesh, the terrain, accordingly to the camera frustrum, saving as much performance as possible. I came accross many documents about procedural mesh generation and I think that my problem could be solved by mapping the mesh into octrees. This is BIG work, at least for me, and that's why I'm here, because I don't want to risk taking the wrong path without before hearing from experienced people.

In short, I have millions of vertices and indices that together form the terrain, but for obvious reasons I cannot draw them at the same time. It's needed some kind of procedure. What's the best way to do that, to treat a big mesh as a terrain? Is there any specific book about that? Is there a best way to implement it?

Sorry for any kind of mistake, I'm very novice on this area.


texts: Which library to choose between SDL and GTK for C game Development (Begginer)

texts: I've been programming in C it's been some time, now I want to get into game development but I'm not sure which GUI library should I use between SDL or GTK? Is it worth sticking up with C or should I switch to C++ (taking out the learning time barrier) ? What will C++ give me that C won't when developing simple 2D games. I am not willing to switch to any other language such as "Java, python, etc" for I still want to use the low level memory management capabilities that C and C++ give. I am also not willing to use a Game Engine to learn game development.


texts: I've completed my mobile game - now what?

texts:
After months of development, I've finally finished my mobile app, but I have no idea what to do next. I want to publish my app to the Google Play Store and the App Store, yet I don't know how. I've done tons of research and every single website shows different methods and requirements. I've seen that I'm supposed to have some kind of license, a specific certificate, and all these other connections that I'm really confused on how I'm supposed to get them, and where to even start. I've gotten as far as getting Apple Developer and Google Developer, but that's basically it. I just want a simple step-to-step guide. I've already looked on StackExchange for an answer, but all have slightly different questions, such as marketing the app and updating the app, but nothing on how to get it out there.

I'm using Unity as an engine and X-Code via my Mac to test my app on my iPhone.

I appreciate any help in advance. Thank you!