texts: How to export 3D models that consist of several parts (eg. turret on a tank)?

texts:
What are the standard alternatives for the mechanics of attaching turrets and such to 3D models for use in-game?  I don't mean the logic, but rather the graphics aspects.

My naive approach is to extend the MD2-like format that I'm using (blender-exported using a script) to include a new set of properties for a mesh that:

is anchored in another 'parent' mesh.  The anchor is a point and normal in the parent mesh and a point and normal in the child mesh; these will always be colinear, giving the child rotation but not translation relative to the parent point.
has a normal that is aligned with a 'target'.  Classically this target is the enemy that is being engaged, but it might be some other vector e.g. 'the wind' (for sails and flags (and smoke, which is a particle system but the same principle applies)) or 'upwards' (e.g. so bodies of riders bend properly when riding a horse up an incline etc).
that the anchor and target alignments have maximum and minimum and a speed coeff.
there is game logic for multiple turrets and on a model and deciding which engages which enemy.  'primary' and 'secondary' or 'target0' ... 'targetN' or some such annotation will be there.

So to illustrate, a classic tank would be made from three meshes; a main body mesh, a turret mesh that is anchored to the top of the main body so it can spin only horizontally and a barrel mesh that is anchored to the front of the turret and can only move vertically within some bounds.

And there might be a forth flag mesh on top of the turret that is aligned with 'wind' where wind is a function the engine solves that merges environment's wind angle with angle the vehicle is travelling in an velocity, or something fancy.

This gives each mesh one degree of freedom relative to its parent.  Things with multiple degrees of freedom can be modelled by zero-vertex connecting meshes perhaps?  This is where I think the approach I outlined begins to feel inelegant, yet perhaps its still a workable system?  This is why I want to know how it is done in professional games ;)

Are there better approaches?  Are there formats that already include this information?  Is this routine?


texts: High school-level geometry book focusing on game dev for struggling student?

texts:
Here's the situation.  My brother, a freshman in high school, isn't doing too well in geometry.  Partially because he doesn't do half the work, but partially because he seems to have genuine difficulty with the material.  So then I thought, since geometry is so useful in game dev, why not get him a book that presents geometry concepts in that light so that he can better grasp them?

Note that he doesn't actually want to make video games, so coding is not important, only an understanding of geometry that'll get him through the rest of the year.  He does like video games, however.  A book in game-focused geometry would serve as supplementary to his schoolwork, not as a substitute.  To be concise, this is exactly what I need;

2D only!  3D is not relevant here!
Not much focus on programming (or it can at least be bypassed).
Good for high school freshmen who are just trying to get a B and get out.
Direct applications are important, but if the explanations are super clear then this can be forgiven.  For instance, http://tinyurl.com/83e9wsu I've skimmed this book and can safely say that it'll be great for his required Algebra II and Trig course next year, even though its relation to game development is pretty much in name only.


texts: How to make progress vertical bar increase instead of decrease

texts:
I have a script for a vertical progress bar using filled image but the image decreases (basically you can see the full image when the game starts and then it goes down, like a health bar) but since it's a progress bar I need it to increase (at the end I should see the complete image, not at first).
This is the code:

public class ProgressBar : MonoBehaviour {

public Image Bar;
public float max_progress = 100f;
public static float cur_progress = 0f;

void Start () {
    cur_progress = max_progress;
}

void Update () {
    Bar.fillAmount = cur_progress / max_progress;
}

And I have ProgressBar.cur_progress -= 0.4f; in the bullet script because it should increase everytime you kill an enemy.
I tried writing += instead of -= but it doesn't work (the image is filled and it doesn't increase or decrease), and i think that is not incorrect so I don't know what the problem is. Thanks in advance.


texts: Play two different audio sources depended on code behind

texts:
How can I play two different audio clips in Unity depended on the code behind? Into my object I've added two audio sources namely 'Player GunShot' and 'outOfAmmo'.

Into the same object I've also added a C# script whit this code:

public currentBullets = 1;

private AudioSource gunAudio;
private AudioSource outOfAmmo;

void Awake()
{
    gunAudio = GetComponent<AudioSource>();
    outOfAmmo = GetComponent<AudioSource>();
}

void Update()
{
    if (currentBullets == 0)
    {
        outOfAmmo.Play();
    }
    else
    {
        gunAudio.Play();
    }
}

Can this code give any problems because in the Awake methode? I've not defined with audio source the variable must be. So which source go he take to play?


texts: What's the use of bones in a 2D skeletal animation?

texts:
I'm trying to implement a renderer using a scene graph and skeletal animation. As far as I know the bones in a skeletal animation just represent a connection between two joints. However, if a Joint knows its parent- and child-Joints what would you even need bones for?

Also, why would you need a separate class, Skeleton to represent a 2D entity (whatsoever) when the Skeleton is just an array of joints? Isn't that just a waste of memory? Am I missing something?


texts: How can I specify which enemies to spawn for each round in a tower defense?

texts:
I am making a TD game in Unity, and I would like to know the most common approach to spawning enemies each round. I have more than 200 rounds per map, just like Fieldrunners.

Is it some kind of hardcoding, say for 25 rounds and then repeat the same waves with harder enemies, or maybe logic/algorithm based on rounds, where it'll give number of enemies and type of enemies which will spawn in that round.

I have 8 type of enemies. I want to implement a function/equation which inputs round number and outputs "number of enemies" and "enemy type" keeping the difficulty level which is round numbers.

for e.g if input: 50th round, output: enemy type1, large no. of enemies,
if the input: 2nd round, output: enemy type 1, less number of enemies


texts: How do I get roblox studio on a Chromebook?

texts:
I have seen Youtube videos of people having roblox studio on their chromebook, but I have tried to install it and it didn't work.
How can I get it to work?


texts: What is the best (or a good) approach to "code" difficult level

texts:
I've to decide how to code enemy spawn: quantity and time.
What's a good approach to do that ?

Maybe a class like this ?

class Level {
   int   levelNr ;
   int   soldierQty; // number of enemy soldier
   int   aircraftQty; // number of aircraft
   float maxTimeToComplete;
   ...
   ...
}

Then, in main code

   Level[100] levels;

   levels[0].levelNr = 1;
   levels[0].soldierQty = 5;
   levels[0].aircraftQty = 3;
   levels[0].maxTimeToComplete = 10; // 10 seconds
   levels[1].levelNr = 2;
   etc etc etc

Is it a good approach ?
Is there a different way I haven't thought ?

Thanks


texts: Unity - warning: animations neck and head have scale

texts:
I always get this warning if I import my model to unity:

Clip 'soldier_idle' has import animation warnings that might lower retargeting quality:

Note: Activate translation DOF on avatar to improve retargeting quality:

    'neck' has scale animation that will be discared.

    'head' has scale animation that will be discared.

Even though there are in fact no scale animations on the bones neck and head as you can see in my blender dopesheet.

So why is this warning showing?


texts:
Ok so I have a idea for a neat GPU driven curve renderer, and I realised that the vertex shader can be hardwired to generate points of the curve segment (to be rendered as a line strip) without sending any vertex positions - gl_Position could be set completely procedurally.

That said I'd still need to specify a "t" value per point via vertex attributes.

Is it possible to specify attributes (ie via glVertexAttribPointer) without specifying vertices? Or does the GL need "space" in the buffers for vertices - even if they aren't initialized.


texts: Level design - modular vs single project

texts:
I'm working in Blender and UE4 for a while now...

I always have the dillema of how to create my levels. My two ideas are:
a) modular - like lego blocks. Create a wall, a floor, wall with hole for a window etc inside blender, and then, in UE4 make a level out of them. The advantage here is that I can arrange them however I want. The disadvantage is - I always have a problem getting the elements to fit properly. Even if I scale one element up or down, everything else starts falling apart.

b) single project - make a whole object like a room or house in blender. Then everything connects nicely, but I'm always worried that it will be harder to edit, and I usually end up messing something. For example, whole house looks great, but inside the game a window is way too high, or the doors are too narrow to go through.

My question:
What should I do - should I stick to one method and try to fix the disadvantage? If yes, how would I do that? Is one of the methods considered "better" or the "industry standard"?


texts: Android: Make game look the same on all devices

texts:
I'm trying to get my android application to look the same on all screen devices. I assume I have to do something regarding the density, I just can't figure it out. And while I have seen very similar questions to this I'm not getting clear answers or I'm just not understanding things resulting in inconsistent results.

So how do I get, for example, my game to look exactly the same on a Samsung Galaxy 7 as on an LG tablet?

Side note: I have looked into scaling the Canvas but can't quite figure out how to do this correctly.

Example

package com.haas.ryan.example;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.view.SurfaceHolder;
import android.view.SurfaceView;

/**
 * Created by Ryan on 8/4/2017.
 */

public class Drawing extends SurfaceView implements SurfaceHolder.Callback {
    private Rect rect;

    public Drawing(Context context) {
        super(context);
        getHolder().addCallback(this);
        rect = new Rect(100, 100, 500, 500);
    }

    public void surfaceCreated(SurfaceHolder sh) {
        Canvas canvas = sh.lockCanvas();
        draw(canvas);
        sh.unlockCanvasAndPost(canvas);
    }

    public void surfaceDestroyed(SurfaceHolder sh) {}
    public void surfaceChanged(SurfaceHolder sh, int format, int w, int h) {}

    public void draw(Canvas canvas) {
        super.draw(canvas);
        System.out.println("call");
        Paint p = new Paint();
        p.setColor(Color.RED);

        canvas.drawRect(rect, p);
        invalidate();
    }
}

Device 1 Screenshot

Device 2 Screenshot

While it's a lot harder to tell on the emulator (my bad I chose 2 phones, should'be chosen a tablet) you can see that the rectangles don't take up the same amount of relative space. In fact on the larger screen the rectangle is actually smaller.


texts:
I'm developing a little game for fun and I wrote a pathfinding system based on the A* algorithm. What is the best or correct way to deal with unavailable paths?

A* by default will go through every node on the grid until it either finds the target node or it has exhausted all of them. This can become problematic if certain areas are cut off into "islands" and A* tries to find a path there.

The obvious solution might be to flood fill regions and check in advance, but the problem is that I plan for my world to be a bit dynamic - new areas might appear, some areas which are accessable at one point might not be later, etc.

Another solution I've read about is that I can limit the amount of nodes it's allowed to search before it gives up, but this sounds a bit hacky and something I'd like to avoid if possible if there are better ways, because it means that there could be a very long and complex path to the target but it'll still not find it just because of this limit.

So how should I do it? I appreciate any help here, fellow devs!


texts: How to use NoSQL REST API of Gamesparks in my Unity project?

texts: Gamesparks has a documentation of the API but I am not sure how to send https requests to use that API.


texts: change direction navmesh agent on collision encounter

texts:
I have one player and many enemies. The enemies are following my player through the navigation mesh. Sometimes enemies get stuck because there is another enemy in-front of them. You can say both are in line.

Is it possible that when one enemy collides with other enemy in-front of it to change direction so that it avoids colliding with one another?


texts:
Pistols and machine guns are easy - you can just have bullets flying in a certain direction, so I already implemented that. A shotgun, on the other hand, does damage to anything in a certain area that looks like a cone. How should I implement that? I have a couple suggestions here, but I could use some advice:

Split a bullet in multiple little bullets, that do less damage by themselves, but fly in a similar direction (a closer enemy is more likely to be hit)
Not use bullets - just have a particle effect of a shotgun shot and calculate how much damage enemies get based on position/orientation etc.
Have a big invisible bullet (a cube for example) that damages things, as well as a particle effect that will make it look like it's actually a shotgun shot.

Thanks in advance!


texts: How can I refer to a recipe defined in one function from elsewhere in my code?

texts:
I want to access the variable recipes defined in this code below.

Unfortunately I have to define my recipes inside  storage.loadGame(session, function(currentGame) {... because I need to make use of the currentUser variable available inside that function.

Once I'm outside of that function, I don't know how to access my recipes anymore.

rPositivityWORLD: function(intent, session, answer) {
    storage.loadGame(session,
       function(currentGame) {
         var currentUser = currentGame.data.UserName;
         var recipes= [
           "<seak>hey </speak>" + currentUser + "<speak> i know that you can do it, also just one more thing thank you</speak>",
           "<speak>testing </speak>" + currentUser + "<speak> testing</speak>",
           "<speak>testing </speak>" + currentUser + "<speak> testing 2</speak>"
         ];
 return recipes; // so i did try changing it to this,let's see what will happen.
       }
    );

    var indexList = [],
    ANSWER_LENGTH = 2,
    recipe = storage.loadGame.recipes;

    var index = recipe.length;
    if (ANSWER_LENGTH > index) {
        ......
    }
 }


texts: OpenGL RTT FrameBuffer question and Rendering to texture while sampling it

texts:
What i need to do:

Blur the selected texture and pass the texture to another effect for postprocessing.
Notice that i want one texture passed all over.

How do i want to do this:

Bind the FBO ( with texture to be blurred attached as colorbuffer )
Change the FBO viewport size to match the texture size
Enable the shader
Bind the texture
Render viewport sized quad with the texture and output to that texture via FBO colorbuffer
Unbind texture
disable shader
Disable fbo
...
pass that texture to another effect..

What i have already done:

A FBO with ColorBuffer attached ( the texture i want to blur ),
The shader
All the other reqd stuff..

What's the problem?

When i want to blur texture and i bind that texture as a color buffer to my FBO, and then pass the texture via uniform to the shader while rendering to sample it (and blur), the results are not stored. Seems like FBO can't have the same texture stored as output and sample it at the same time ( kind of understandable ).

Question:

Is this normal behavior ? How do i approach 'blur a selected texture' so that i can pass one texture over to another effect to work on it ?

I can imagine a 'dummy' texture within the effect class to which FBO renders to and then it gets copied to a texture that was requested to be modified..
Any better option ?

Thanks for shedding a bit of light on this, i think i need some logic help in here.


texts:
I'm new to unity, and written code in general, but I haven't been able to change the value of a vector3.

public Vector3 VARIABLE = (5f, 5f, 5f)


texts:
I'm writing a map editor for a game built with Unity (5).

I want to reuse as much of the resources from the game as possible. That means textures and meshes.

I know they are somewhere in the assets files, but I need to be able to extract that data during runtime since I cannot (and do not want to) redistribute those files.

Additionally, given that the game receives frequent updates, I need to be able to calculate the offsets each time the editor is started. I also need to know how the textures connect to the objects in the game.

In order to do that, I need to know what the structure of assets file is, or at least find a way to extract them all and then use hex editor to figure out how they're put together.

I know there is a devxdevelopment tool that can do the latter, but I don't really have any money to spend on this.

Can you give me any info or pointers that would enable me to figure this out?


texts: What should I do with global high scores when the game has a major update?

texts:
I have a game that people have been playing for several years now. The game has a global high score list, and there has been some fierce battles among the players for the top positions.

I now want to make a major update to the game, but the changes I have in mind will bring the maximum theoretical score down to about 80% of what it currently is. This is just an estimate, of course, I haven't gotten very far into the update, but it will definitely come down. I should also note that this game has no logical, absolute maximum score because it is based on things like time and resources used as well as kills.

So the question is, what do I do with the current high scores when I release the update? It doesn't seem right to leave it because no one will ever be able to take the high spots, and new scores won't really compare to old ones. I don't think I should wipe it because a lot of people worked really hard to get there. Any suggestions?

Edit to add:

I also don't think I can adjust the current score values because they are a sum of many small games, and the user can replay those to get an increase to the total. An adjustment would make a confusing mismatch.


texts: Unity mesh collider detecting collision on object empty inside

texts:
I'm trying to get my first 3D game done with Unity. In this game the character will be flying through some rings.

I made the ring asset with MagicaVoxel, exported it in .obj and reimported in Unity withouth problems. I've set a rigidbody and a box collider on the character model and a mesh collider withouth rigidbody to the ring and I've also set Convex and added the default mesh of the ring.

The problem is that whenever I try to go inside the ring, I can't because I collide even with the empty part inside it. I'm not sure on how to made Unity collide only with the external part, but as far as I can see in the editor I'm using, I've no setting for it. I'm using Unity 5.3.4f1.

Can someone please explain me how to solve this problem?

Thank you very much.

EDIT

I'm sorry, I forgot to mention that I'm aware I can unset the ring mesh Convex property and get it to work. The problem of this solution, though, is that whenever I put adjacent rings I can glitch through them even if there's no space to fit. So basically I need a solid collider with Convex only on the external part of the ring and with empty space to fly through on the inside. Is this possible somehow?


texts: How can I get a reference to an actor that's already in a scene in Unreal?

texts:
I'd like to know if there is a way to get a reference to the instance of an Actor (written in c++) in the scene from a blueprint even if it's not in the scene, or at least without making a new one using that Actor as base class.

I know there's a method to get all the objects in the scene, but it wouldn't be that cool to iterate over each one of them, so i absolutely want to avoid something like this.

Basically, i have a class called ABoard, that inherits from an AActor where i got some methods to deal with the board itself. Also i have some blueprints that will show the MainMenu, and someother stuff, and what i want to do, is to call a method in the ABoard from one of these blueprints to be able to set up some stuff, like: "Play as single Player, whatever it is". But, i cannot do this because (of course) the blueprint does not have a reference to the object/instance in the scene i'm talking about.

Since i'm relatively new to Unreal Engine, i have no idea how to solve this kind of problem.


texts: Approaches for storing grid-like information

texts:
I am drawing this simple grid on my NodeJS server:

var grid = [];

for(var x = 0; x < 20; x++){
    grid[x] = [];
    for(var y = 0; y < 20; y++){
    grid[x][y] = 0;

    }
}

console.log(grid);

The outcome looks like this:

I know, pretty right?!

0 is supposed to indicate FREE, thus if a player requests to move to a field with 0, he will!

The problems come when I want to add more then just Free/Occupied, for instance I would like to give each Array Element an ID number for the Client Updates, or certain features on the field to be stored.

I tried to assign { something: N, something2: N}

But thought it looked rather performance expensive in the long run. (On a big Grid)

I read about using a single Object for several elements, but I cannot find this any more..

Should I perhaps use an Array of Objects, or an Additional Array inside each X,Y element?

Any performance / convenience / anything goes   tips are welcome :D

Edit:
Thank you for the ideas so far, I was now thinking to perhaps using Strings. Storing Variable_A + "," + Variable_B   and then later using the .split to use the information. Any thoughts on this?


texts: Selecting Dictionary item based on custom classes instead of keys

texts:
I am attempting to write my own path finding code for a game I'm working on that will implement a form of the A* algorithm.  I store my nodes of the path finding system as a class called nodes and add these to a dictionary with their position in world space as the key for the dictionary.  Here's the problem.  At one point I need to test the dictionary and return from it the node with the lowest "f" value.  I came across the morelinq MinBy function with seemed promising, but so far have not had any luck getting it to work. Here is a stripped down version of the code:

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

public class GMove : MonoBehaviour
{

    public Dictionary<Vector3, Node> vectorNodesOpen = new Dictionary<Vector3,Node>();
    public Dictionary<Vector3, Node> vectorNodesClosed = new Dictionary<Vector3,Node>();

    private KeyValuePair<Vector3, Node> currentNode = new KeyValuePair<Vector3,Node>();

    private bool goal;
    private bool findingPath;

    void Start()
    {
        goal = false;
        findingPath = false;
    }

    public void addNodes()
    {
        //several nodes get added to the dictionary based on the A* algorithm
        //ending way point and beginning waypoint are stored as Vector3
    }

    public class Node
    {
        public int h { get; set; }
        public int g { get; set; }
        public int f { get; set; }
        public Vector3 pos { get; set; }
        public Vector3 parentNodeVector { get; set; }
    }

    void Update()
    {
        if(findingPath)
         while (!goal)
            {
                currentNode = new KeyValuePair<Vector3, Node>(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);  //This is the line in which I'm attempting to get the node in the open list with the smallest f value.
                vectorNodesClosed.Add(vectorNodesOpen.MinBy(x => x.Value.f).Key, vectorNodesOpen[vectorNodesOpen.MinBy(x => x.Value.f).Key]);
                vectorNodesOpen.Remove(vectorNodesOpen.MinBy(x => x.Value.f).Key);  // remove current from open.

                if (currentNode.Value.pos == waypointEnd)   // if current node = end position we are done.
                {
                    goal = true;
                }

                addNodes(currentNode.Value.pos, waypointEnd);  //Add and update nodes
    }

}

The line that is giving me trouble is the first line inside the while loop.

I need a way to return the Dictionary item with the smallest "F" value, this would be pretty easy if it were an integer but the F value resides in the Node class.  I don't have to use MoreLinq,  I would be happy to do it any other way that someone can come up with.  Cheers!

*One more note:  the code above is incomplete in an effort to minimize it down to only what is necessary to understand the problem more complete code can be provided if necessary.


texts: Component based architecture: "pure" or some inheritance?

texts:
(I asked a similar question, but it had more questions inside it and I feel it wasn't clear enough, so I'm opening a new one).

Until recently I implemented all my games using an inheritance hierarchy. Those were simple games.

For example:

          Entity
          /    \
      Movable  Static
      /  \        /  \
    Orc  Mage   Tree  Wall

This worked for simple games.

However recently I read about 'entity component systems'. Using this approach, a class doesn't inherit from another class in order to receive functionality. Instead it is composed with it, which allows for more flexible designs.

My question is this:

I know that each component is a class (derived from a common base class).

However, there is one thing I don't understand: In the 'component system' approach, is there one class that all entities are instances of - and the only difference between entities is the components they contain?

For example: There is a class Entity. All entities in the game are instances of this class.

The only differences between them is that they are composed with different Component objects.

For example:

Component aiComponent = new AIComponent();
Component movementComponent = new MovementComponent();
Component physicsComponent = new PhysicsComponent();
Component rangedAttackComponent = new RangedAttackComponent();

Entity orc = new Entity();
orc.addComponent(aiComponent);
orc.addComponent(movementComponent);
orc.addComponent(physicsComponent);

Entity shootingCastle = new Entity();
shootingCastle.addComponent(aiComponent);
shootingCastle.addComponent(rangedAttackComponent);
shootingCastle.addComponent(physicsComponent);

All of this as opposed to my old approach:

Orc orc1 = new Orc();
ShootingCastle castle1 = new ShootingCastle();

As you can see, both orc and shootingCastle are instances of the Entity class. But they are composed with different components.

Is this how 'entity component systems' are supposed to be? No inheritance hierarchy at all? Or is there still a basic inheritance hierarchy, but most of the logic is inside components?


texts: Why is Cinemachine Virtual Camera locking my camera position to the Origin?

texts:
I want the camera to follow a character as he moves around.  So I did the following:

Position the camera behind and slightly above the character.
Add a Cinemachine Brain component to the camera.
Create a GameObject containing a Cinemachine Virtual Camera component.  Set its LookAt and Follow properties to the character to be followed.
Run the game.

I expect for the camera to follow the character, more or less maintaining the relative position and orientation I had set for it. (ie. more or less as if the camera object was parented to it, but smoother.)
If I use the Cinemachine Free Look camera, this is basically how it works, except that it only deals with following and I have to maintain the orientation manually with the mouse.  But if I use Cinemachine Virtual Camera, because I don't want to deal with the free look part of it, for some bizarre reason it locks the position of the GameObject containing the camera to (0, 0, 0)!  And I don't just mean it moves it there; it's stuck there!  If I go into the Inspector and change the position at runtime, it instantly changes back to (0, 0, 0).
What can cause Cinemachine Virtual Camera to do this?  And how can I make it stop?


texts: Why do most game devs prefer OGL for OS X and D3D for Windows?

texts:
Today I decided to check what Diablo 3 developers used to do graphics: OpenGL or Direct3D? My mind was completely blown: For Windows, they've used D3D and for OS X they've used OGL.

I did some research and found that most game developers prefer the same method. This choice doesn't make sense to me. Writing one game engine with OpenGL for OS X and then rewriting same for Windows with D3D seems a lot of unnecessary work. Wouldn't it be easier to just take OpenGL and make a game engine that works on both operating systems?


texts:
So I was just looking through an old game I had made for android, and was second guessing how I was sub-classing enemy for each particular enemy in my game.  My enemy class had all kinds of properties, like sprite speed size and different bools that related to the state of the enemy...etc.  But then for each enemy in the game I created a sub-class from enemy, and all I did was set all those properties to a specific value.  Something like this:

public class Ninja extends Enemy
{
     public Ninja(Vector2 pos)
     {
         super(pos);
         this.speed = 10;
         this.sprite = Content.Ninja;
         this.size = spriteSize.Medium;
         this.hitPoints = 200;
         //..etc
     }
}

That was basically the whole class.  Looking back it seems like a waste of making a class at all, it left me with nothing else to change about that enemy, but just a convenient way to declare them.  Is this common practice?  I suppose it is nice to have all these stats grouped into 1 place, but it seems like a small amount of information to have for a whole class, maybe I'm just over-thinking this.  Does anyone else ever do similar things in their games?  Maybe it would be better to just make a static method somewhere that generates a Enemy with these stats called like CreateNinja, and save myself the clutter of having a whole class for it.  What do you guys think?


texts: Collision detection of convex shapes on voxel terrain

texts:
I have some standard convex shapes (cubes, capsules) on a voxel terrain.  It is very easy to detect single vertex collisions.  However, it becomes computationally expensive when many vertices are involved.

To clarify, currently my algorithm represents a cube as multiple vertices covering every face of the cube, not just the corners.  This is because the cubes can be much bigger than the voxels, so multiple sample points (vertices) are required (the distance between sample points must be at least the width of a voxel).  This very rapidly becomes intractable.

It would be great if there were some standard algorithm(s) for collision detection between convex shapes and arbitrary voxel based terrain (like there is with OBB's and seperating axis theorem etc).

Any help much appreciated.


texts:
I am attempting to do something like the following:
http://blogs.msdn.com/b/shawnhar/archive/2007/06/12/embedding-content-as-resources.aspx
(Access the content via a DLL)

However, I need to maintain the folder structure of the fonts and images. I have attempted to add the folders to the resources file, but it doesn't add the folder if I drop it in the resources file in VS. I am thinking I might need to embed the content as just a regular folder, and each file will need its property to be set to embedded resource, but I need to use it in another assembly.

I looked at: http://zacharysnow.net/2010/07/03/xna-load-texture2d-from-embedded-resource/
but I think I can only do that with textures. I need to do it with fonts as well.

I looked at: https://stackoverflow.com/questions/859699/how-to-add-resources-in-separate-folders and that doesn't seem to help me much.

Whats the best way I can embed my resources in another assembly, while maintaining my content loading strings?


texts: How do I draw a scene with 2 nested frames

texts:
I have been trying for long time to figure out this:
I have loaded a model from a directx file (I am using opengl and Java) the model have a hierarchical system of nested reference frames (there are not bones). There are just 2 frames, one of them is called x3ds_Torso and it has a child frame called x3ds_Arm_01. Each one of them has a mesh. The thing is that I can't draw the arm connected to the body. Sometimes the body is in the center of the screen and the arm is at the top. Sometimes they are both in the center. I know that I have to multiply the matrix transformation of every frame by its parent frame starting from the top to the bottom and after that I have to multiply every vertex of every mesh by its final transformation matrix. So I have this:

public void calculeFinalMatrixPosition(Bone boneParent, Bone bone) {
    System.out.println("-->" + bone.name);
    if (boneParent != null) {
        bone.matrixCombined = bone.matrixTransform.multiply(boneParent.matrixCombined);
    } else {
        bone.matrixCombined = bone.matrixTransform;
    }

    bone.matrixFinal = bone.matrixCombined;
    for (Bone childBone : bone.boneChilds) {
        calculeFinalMatrixPosition(bone, childBone);
    }

}

Then I have to multiply every vertex of the mesh:

public void transformVertex(Bone bone) {

    for (Iterator<Mesh> iterator = meshes.iterator(); iterator.hasNext();) {
        Mesh mesh = iterator.next();

        if (mesh.boneName.equals(bone.name)) {
            float[] vertex = new float[4];
            double[] newVertex = new double[3];
            if (mesh.skinnedVertexBuffer == null) {
                mesh.skinnedVertexBuffer = new FloatDataBuffer(
                        mesh.numVertices, 3);
            }
            mesh.vertexBuffer.buffer.rewind();
            while (mesh.vertexBuffer.buffer.hasRemaining()) {
                vertex[0] = mesh.vertexBuffer.buffer.get();
                vertex[1] = mesh.vertexBuffer.buffer.get();
                vertex[2] = mesh.vertexBuffer.buffer.get();
                vertex[3] = 1;

                newVertex = bone.matrixFinal.transpose().multiply(vertex);
                mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[0]));
                mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[1]));
                mesh.skinnedVertexBuffer.buffer.put(((float) newVertex[2]));

            }

            mesh.vertexBuffer = new FloatDataBuffer(
                    mesh.numVertices, 3);
            mesh.skinnedVertexBuffer.buffer.rewind();
            mesh.vertexBuffer.buffer.put(mesh.skinnedVertexBuffer.buffer);

        }

    }

    for (Bone childBone : bone.boneChilds) {

        transformVertex(childBone);

    }

}

I know this is not the more efficient code but by now I just want to understand exactly how a hierarchical model is organized and how I can draw it on the screen.

Thanks in advance for your help.


texts: Latency difference between DirectSound and XAudio2

texts:
As far as I understand the WDM, DirectSound drivers cannot be hardware accelerated on Windows Vista and newer. Is XAudio2 affected as well?

Or in other terms: in latency terms is it definitely better to use XAudio2 instead of DirectSound?

I'm asking this because I want to go back to DirectSound for my next game to simplify deployment (XAudio2 requires a COM registration, which requires admin privileges and therefore an installer, and also causes trouble on emulated environments), but if there is a difference in latency, then I'll stay with XAudio2.


texts: Difference between the terms Material & Effect

texts:
I'm making an effect system right now (I think, because it may be a material system... or both!). The effects system follows the common (e.g. COLLADA, DirectX) effect framework abstraction of Effects have Techniques, Techniques have Passes, Passes have States & Shader Programs.

An effect, according to COLLADA, defines the equations necessary for the visual appearance of geometry and screen-space image processing. Keeping with the abstraction, effects contain techniques.

Each effect can contain one or many techniques (i.e. ways to generate the effect), each of which describes a different method for rendering that effect. The technique could be relate to quality (e.g. high precision, high LOD, etc.), or in-game-situation (e.g. night/day, power-up-mode, etc.). Techniques hold a description of the textures, samplers, shaders, parameters, & passes necessary for rendering this effect using one method.

Some algorithms require several passes to render the effect. Pipeline descriptions are broken into an ordered collection of Pass objects. A pass provides a static declaration of all the render states, shaders, & settings for "one rendering pipeline" (i.e. one pass).

Meshes usually contain a series of materials that define the model. According to the COLLADA spec (again), a material instantiates an effect, fills its parameters with values, & selects a technique. But I see material defined differently in other places, such as just the Lambert, Blinn, Phong "material types/shaded surfaces", or as Metal, Plastic, Wood, etc.

In game dev forums, people often talk about implementing a "material/effect system". Is the material not an instance of an effect? Ergo, if I had effect objects, stored in a collection, & each effect instance object with there own parameter setting, then there is no need for the concept of a material... Or am I interpreting it wrong?

Please help by contributing your interpretations as I want to be clear on a distinction (if any), & don't want to miss out on the concept of a material if it should be implemented to follow the abstraction of the DirectX FX framework & COLLADA definitions closely.


texts: XNA SpriteBatch.Draw with rotation, scaling and origin?

texts:
I use a 1x1 pixel 2d texture as source for SpriteBatch.Draw. The texture is scaled and rotated around an origin. The left image is only scaling. The right one scaling + rotation around the origin at the bottom center. I need the right image as result.  i.e. scaled to 5x10 and rotated around 2.5x10

The problem is with the 1x1 texture the draw starts to act strange if the origin parameter is outside the source texture. And as long as the origin is limited to a max of 1x1 its not possible to rotate around the bottom center of the scaled texture.

Why does the origin behave strangely if it is outside the source texture? With strange I mean the texture moves much more then the origin value set.  i.e. if its origin x=10 the texture moves much more then 10 pixels.


texts: How can I create a "wireframe" texture for a sphere in SceneKit?

texts:
I've been struggling to figure this out. I would like to have a sphere in SceneKit that looks like this:

I think the easiest way would be to create a mostly transparent texture with the wireframe lines. I need some help figuring out how to create this texture.

I've been doing some trial and error with colored lines to try to figure this out, but it's a mess and I don't seem to be getting anywhere.

Eventually I want to procedurally generate the wireframe texture in a CALayer, but first I need to figure out where to draw the lines.


texts: TileMapRenderer in libGDX not drawing anything

texts:
So I followed the tutorial on the libGDX wiki to draw Tiled maps but it doesn't seem to render anything.

Here's how I setup my OrthographicCamera and load the map:

camera = new OrthographicCamera(Gdx.graphics.getWidth(), Gdx.graphics.getHeight());

map = TiledLoader.createMap(Gdx.files.internal("maps/test.tmx"));
atlas = new TileAtlas(map, Gdx.files.internal("maps"));
tileMapRenderer = new TileMapRenderer(map, atlas, 8, 8);

And here is my render function:

Gdx.gl.glClearColor(0, 0, 0, 1);
Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);

camera.update();
tileMapRenderer.render(camera);

Also I did pack the tile map using the TiledMapPacker.

I'm completely stumped... am I missing anything obvious here?

EDIT:

While debugging I noticed that the TileAtlas seems to be empty, which I guess shouldn't be the case, but I have no idea why it's empty.


texts: Scaling transforms by time, Eigen Decomposition of Affine Transforms

texts:
I posted this question in mathematics, but that sight gets flooded with homework problems... 8 views total, most of them me.
Plus, I think this question is more geared to game development anyway.
I am making a 3D graphics processor using VB.Net.
I want to do an airplane game.
I want the plane(s) movements to be scalable by time, so that the appearance is the same regardless of how fast the game-loop is running. And so the amount of matrix & trig operations needed per frame is minimized.
Below is a 2D example of what I am trying to achieve.

I'm trying to do eigen-decomposition so a can scale transform A by time:
\$\begin{align}
[A]_{t_0} =& [P][U][P^T]\\
[A]_t =& [P][U]^{(\frac{t}{t_0})}[P^T]
\end{align}\$

I figure out a complex movement (like turning left) using many small
iteration steps at the start of the program.
Solving for the largest eigen-vector & its value using the power iteration
Other stuff to find the other eigen-vector(s) & values (still haven't
nailed that down yet)
Now, with this transform-decomposition for the turn-left operation for T seconds of
game time, I can compute turn-left transforms for any time duration quickly and easily.

Ran into problems fast with a simple translation matrix that does not decompose. Then I saw this.
This guy apparently did it but did not show how. I know it's going to involve complex eigenvalues (if you got things rotating). I'm not sure how to handle those. And it is going to involve separating the translation part, which I also don't know how to do.
Here is 2 examples that I would like to see how to solve:
Simple X translation
\$
\begin{bmatrix}
1 & 0 & 0 & 30 \\
0 & 1 & 0 & 0 \\
0 & 0 & 1 & 0 \\
0 & 0 & 0 & 1
\end{bmatrix}
\$
Rotating and translating
\$
\begin{bmatrix}
-4.52E-07 & 0 & -1        & 19.1 \\
0         & 1 &  0        & 0 \\
1         & 0 & -4.52E-07 & 19.1 \\
0         & 0 & 0         & 1
\end{bmatrix}
\$
The whole point is to avoid doing hundreds of movement iterations at every game frame.
The example shown has an easy solution for scaling by time, rotating around the arc center by x*dt.
But, when I start doing combinations of 3D rotations like TURNING-UP while also TURNING-RIGHT while also ROLLING (cork-screwing in circle) it is going to be extremely time consuming figuring how to scale these movements by time.
I want the computer to do all the math.


texts: XNA: Classes with Texture2D to be treated as one

texts:
Summarised Problem:

I have an Animation class that I want to be able to treat as a Texture2D field when need be. I do not want to inherit from the class or its parents. I'd rather not create a parent class of both the animation class and a 'container' for a Texture2D, though that may be the only way to achieve what I want.

Code:

public class Animation : IComponent
{
  public Texture2D texture => frames[currentFrame];

  public Texture2D[] frames;
  public byte currentFrame { get; protected set; }
  /// <summary>
  /// Frame time in milliseconds;
  /// </summary>
  public ushort interval;
  public bool looping;
  public bool animate;

  protected ushort progress;

  /// <param name="interval">Time until frame is succeeded.</param>
  /// <param name="loop">Whether to loop frames.</param>
  /// <param name="start">Whether to start cycling through frames.</param>
  public Animation(Texture2D[] frames, ushort interval, bool loop, bool start)
  {
    this.frames = frames;
    currentFrame = 0;
    this.interval = interval;
    looping = loop;
    animate = start;
  }

  public void Update(ushort milliseconds)
  {
    if (looping)
      currentFrame = (byte)((progress += milliseconds) % interval % frames.Length);
    else
      currentFrame = (byte)((progress += milliseconds) % interval);
    progress %= interval;
  }
}

It's an extremely simple class that is subject to change. Its purpose is to stand in for a Texture2D for external handling of spreadsheets and whatnot. It is going to be used in an ECS but probably not as a component as I have it now.

So, for instance, I'd like to be able to put it as a stand in for a Texture2D in draw calls (can be done with the 'texture' property it has) and also be kept in the same field and be cast to treat it as the animation class again.

If anyone thinks there's a much superior implementation of this please let me know.

If there's a way I could do something like this that would be perfect:
spriteBatch.Draw(Anim as Texture2D, Vector2.Zero, Color.White);


texts: Intel GPU running faster than Nvidia GTX 1060

texts:
My app in its current state renders only 2 triangles to the screen using OpenGL.
I am using std::chrono::steady_clock for frame counting.

With Intel graphics, I hit 1000fps and with my GTX 1060(6GB) I am getting an absurd frame rate of 480fps.

I have used the Nvidia Optimus Enablement method to force renders on my GPU(reference: http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf)

Why could this be happening? My shaders are under 60 lines of code, there seems to be nothing that is lagging my GPU from my CPU performance.


texts: I'm still learning DirectX from a book. It says that a graphiccards can only handle 15 lights. I'm just a bit confused , there are a lot of games using more lights, or are this just some alpha blending  tricks or what ever?


texts: transformation before the perspective divide but after projecting perspectively

texts: My problem is that I would like to confine a scene render to a (possibly rotated) rectangle without using glViewport(). I don't want to use it to save, if possible, some cycles that would otherwise be spent on state switching. Also, there is the tantalizing possibility of rotating the scene render, which is not possible with glViewport... Is it possible to confine a scene render to this (possible rotated) rectangle in this way?


texts: Help with understanding how the gamecontroller script works

texts:
I'm trying to understand the concept of game controllers and what all they're used for in different types of games.  Are they mainly to control how the game operates?  For instance, if I had an RPG that had a questing system, would it be the game controller that manages that?  So what all should I consider when building a game controller?  Is it everything that doesn't involve user input?  Can anyone explain this to me, or at least point me in the direction to find this information?

To clarify, I'm not talking about physical game controllers, I'm talking about the game manager script you add to your game attached as a game object.


texts: How do I make a racing car turn more smoothly when traversing waypoints?

texts:
In a racing game, I have set up waypoints for the player to follow.

I have added many waypoints to give an illusion of curved movement.

However, the player car turns instantaneously when passing each point, which is especially jarring because the camera is following their rotation.

How can I make the player's movement a more natural curve?

I'm using C# in Unity.


texts: Given a triangleIndex how do you find the global position of a mesh vertex - Unity

texts: For Unity's mesh system - Given a triangleIndex how do you find the global position of a mesh vertex (of a meshfilter on a gameobject)?


texts:
I have Unity Pro 4.6.1 and I am trying to make a cube move with the arrow keys. Here are the barriers before I move the cube:

And here's when I move the cube (the problem):

I don't want the cube to go through the blocks, just inside them. Here is my moving code:

#pragma strict

static var selectedId : int;

static var speed : int = 5;

function Update () {

     if (Input.GetKey (KeyCode.UpArrow)) transform.Translate (Vector3(0,0,1) * Time.deltaTime*speed);
     if (Input.GetKey (KeyCode.DownArrow)) transform.Translate (Vector3(0,0,-1) * Time.deltaTime*speed);
     if (Input.GetKey (KeyCode.LeftArrow)) transform.Translate (Vector3(-1,0,0) * Time.deltaTime*speed);
     if (Input.GetKey (KeyCode.RightArrow)) transform.Translate (Vector3(1,0,0) * Time.deltaTime*speed);
}

How do I fix this?

EDIT: I modified my move code but it still goes through things:

#pragma strict

var speed : float = 10.0;

function Update () {
    var horMovement = Input.GetAxis("Horizontal");
    var forwardMovement = Input.GetAxis("Vertical");

    if (horMovement) {
        transform.Translate(transform.right * horMovement * Time.deltaTime * speed);
    }
    if (forwardMovement) {
        transform.Translate(transform.forward * forwardMovement * Time.deltaTime * speed);
    }
}


texts: Communicating with Collision System in ECS

texts:
I have read tons of articles and forums threads about ECS but still can't understand how anything in engine should communicate with Collision System. Let's say I have Input System that handle keyboard input and then at some point it want to move player character forward. Before doing this I should ask Collision System if there would be a collisions after that move and only if no - change position.

My current approach is to have requestTranslation function in CollisionSystem that take translation function and object like this:

moveForward(){
    V3.CollisionSystem.requestTranslation(this.mesh, function(object){
        object.translateZ(-this.movingSpeed);
    }.bind(this));
}

What do you think about this approach? How good/bad it is? What are know alternatives?


texts: What client front-end options can I use to make a Facebook game?

texts:
I have been requested to make a port of an iOS game for Facebook.

The game itself is fairly simple, it is a puzzle game using a 2d array for a grid with XML passed from a server for loading objects onto the the grid, to create levels.
The game will ask questions at stages which will be passed to my server and stored for research purposes.

I have looked into both Flash and HTML5/js both of which I have little to no experience in (I'm experienced in Java/C#/Ruby + Rails).

Javascript seems like a nightmare from what I have read, even looking into javascript game engines, but at least it is free.

My backend will most likely be rails for handling server logic.

Is javascript for programming games really a problem for simple games on Facebook?
Are js game engines worth using? Does anyone have any experience with them?
Would prevention of cheating be possible with a js/rails game, do server side checks work?*
Are there any alternatives for a front end for someone with C#/Java/Ruby background?**

I've never seen any Unity or Java apps on Facebook (I don't use it much) and as this is a research project is for my university, I would like to avoid licensing issues.


texts: How to write on a Tilemap using a C# script?

texts:
I loaded my tileset asset TileSheet.png using the Tile Palette (Window -> 2D -> Tile Palette).

This created the folder "grass_tiles" with multiple asset files, one named "TileSheet_168.asset".

My goal is to write a script that randomly generates grass tiles within my 128 x 128 tile map.

I envision the code looking something like this:

tilemap.SetTile(new Vector3Int(x, y, 0), "TileSheet_" + TileNum + ".asset);

...where TileNum is a randomly generated integer between 1 and 750 (assuming that's what SetTile even does).

Current code:

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

public class drawMap : MonoBehaviour {
    public Tile grassTile;
    public Tilemap ChessMap;

    // Start is called before the first frame update
    void Start()
    {
        RenderMap(GenerateArray(128, 128), ChessMap, grassTile);
    }

    public static int[,] GenerateArray(int width, int height)
    {
        int colorControl = 0;
        int cellFig = 0;
        int[,] map = new int[width, height];

        for (int x = 1; x <= map.GetUpperBound(0); x++)
        {
            cellFig = x / 16;

            if (Mathf.Floor(cellFig) == cellFig) {
                if (colorControl == 0) { colorControl = 1; } else { colorControl = 0; }
            }
            for (int y = 1; y <= map.GetUpperBound(1); y++)
            {
                if (colorControl == 0)
                {
                    map[x, y] = 0;
                }
                else
                {
                    map[x, y] = 1;
                }
                Debug.Log("Map Coordinates x: " + x);
                Debug.Log("Map Coordinates y: " + y);
                Debug.Log("color: " + colorControl);
            }
            if (colorControl == 0) { colorControl = 1; } else { colorControl = 0; }
        }
        return map;
    }

    public static void RenderMap(int[,] map, Tilemap tilemap, TileBase tile)
    {
        //Clear the map (ensures we dont overlap)
        tilemap.ClearAllTiles();
        //Loop through the width of the map
        for (int x = 0; x < map.GetUpperBound(0); x++)
        {
            //Loop through the height of the map
            for (int y = 0; y < map.GetUpperBound(1); y++)
            {
                // 1 = tile, 0 = no tile
                if (map[x, y] == 1)
                {
                    tilemap.SetTile(new Vector3Int(x, y, 0), "TileSheet_" + TileNum + ".asset);
                }
            }
        }
    }
}

Where I need help is the loading of the asset, referencing the asset, and setting of the asset.

I only need this script once, because after it's done, hopefully the GameObject can remember (as if I used the Tile Palette tool).


texts: Slick UnicodeFont displays in different location depending on the screen size?

texts:
I am using the Slick2D library to draw text. The text draws perfectly, however it is in the wrong location!

I could easily draw it in the correct location, however the problem is that the "correct location" is very different depending on the size of the screen - And my game needs to be able to have the screen size changed.

Here is the render method for the text:

 public static void render() {
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    glDisableClientState(GL_VERTEX_ARRAY);
    glDisableClientState(GL_NORMAL_ARRAY);
    glUseProgram(0);
    glBindBuffer(GL_ARRAY_BUFFER, 0);
    glMatrixMode(GL_PROJECTION);
    glLoadMatrix(orthographicProjectionMatrix);
    glMatrixMode(GL_MODELVIEW);
    glPushMatrix();
    glLoadIdentity();
    glDisable(GL_LIGHTING);
    font.drawString(0, 0, "OMG ITS TEXT!", Color.green);
    glEnable(GL_LIGHTING);
    glPopMatrix();
    glMatrixMode(GL_PROJECTION);
    glLoadMatrix(perspectiveProjectionMatrix);
    glMatrixMode(GL_MODELVIEW);
}

So, how can I set the text to be in the middle of the screen irrespective of screen size?

Thanks!


texts: Starting Couroutine in newly activated gameObject

texts:
I'm working on a UI system that animates an element's properties using coroutines. Every element that should be animated has a component called AnimatedUIElement which provides the function Enter().
The function Enter() is basically starting coroutines depending on the chosen animation settings, but only after calling Enable(), which sets the gameObject active with gameObject.SetActive(true);, updates its component references and makes the element interactable.
AnimatedUIElement also defines an Exit() function acting similar, but disabling the element after the animation.

public class AnimatedUIElement : MonoBehaviour {
    private CanvasGroup canvasGroup;
    // ...

    public void Enter() {
        // ...
        TriggerEntry();
    }

    private void TriggerEntry() {
        PlayChildrenEntry(); // Calls Enter() on all animated Children
        Enable();
        StartCoroutine(SomeAnimation(...));
    }

    private void Enable() {
        gameObject.SetActive(true);
        Init();
        canvasGroup.interactable = true;
        canvasGroup.blocksRaycasts = true;
    }

    private void Init() {
        canvasGroup = GetComponent<CanvasGroup>();
        // ...
    }

    private IEnumerator SomeAnimation(...) { ... }

    public void Exit() {
        // Similar to Enter, but disabling the element
    }
}

Now I want to open the options panel by clicking a button in the game's UI. The panel is inactive (unticked) in the beginning, while the AnimatedUIElement component is enabled.

UI Hierarchy: Options Button calls Enter() on Options Panel.

The desired setup in the Button Component calling OptionsPanel.Enter() and MainPanel.Exit()

But clicking the button throws the following exception:

Coroutine couldn't be started because the the game object 'Main Menu Button' is inactive!
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
AnimatedUIElement:AnimatePosition(Vector2, Vector2, Single, AnimationCurve) (at Assets/Animated UI Elements/AnimatedUIElement.cs:265)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:93)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
AnimatedUIElement:PlayChildrenEntry(Transform) (at Assets/Animated UI Elements/AnimatedUIElement.cs:219)
AnimatedUIElement:TriggerEntry() (at Assets/Animated UI Elements/AnimatedUIElement.cs:79)
AnimatedUIElement:Enter() (at Assets/Animated UI Elements/AnimatedUIElement.cs:73)
UnityEngine.EventSystems.EventSystem:Update()

In this stack trace you can see that the Options Panel did not start coroutines as no animation was defined in its component, but called Enter() on its children, which are animated.

Using debug logs I found out that, while Init() is called immediately after Enter(), Awake() is called after the coroutines (which happen later in the program flow) throw errors. This makes it seem like the object is not available instantly after calling setActive(true).

Is there an explanation and possibly a fix for this behavior?


texts: An evaluation of game UI, based on certain usability criteria?

texts: Is there a resource online which has made the effort to evaluate game user interfaces and estimate their usability (by genre)? (something like what Nielsen does). In-game reviews in magazines unfortunately do not always present an objective and quantifiable point, based on established heuristics or criteria


texts: Sprite not being destroyed after being walked on (Phaser 2.4.6)

texts:
I've been developing a game for not long in the Phaser framework so I may be a little nooby so be warned.
I have a timer that runs whenever an update is called and it would set the sprite I walked on to a tanish-brown and then destroy it after half a second (500), give me one point and close the loop:

//This is where it calls the collision handler in the update() function. First line of it too.:
game.physics.arcade.collide(player, layer, testgame.prototype.collisionHandler, null, this);
//move player and stuff
//This is where the timer starts in the update() function
var st = game.time.create(false);
var stc = 0;
obj2.frame = 4;
st.loop(Phaser.Timer.SECOND / 8, function() {
  obj2.destroy();
  setScore(score += 1);
  st.stop();
  return;
}, this);
st.start();

But it would just give me a point and (not)close the loop.
I'm using arcade physics and each sprite is 32x32 while the player is 64x64.
I'm also using tilemaps, not just creating the level from code.
Thanks in advance.


texts: How can I improve the performance of this rendering code?

texts:
I've created a practice application for rendering triangles/squares/cubes using VBOs. This is mainly so I can get it right before upgrading a 3D block world game I've written that currently is using display lists to cache block rendering.

I have a 3D cube rendering with an interleaved VBO and I recreated a basic chunk/block system that does the following:

Loads chunks in a 10x10 area
Each chunk creates its own float buffer and adds 16x16x16 cube vertices, colors, texture coordinates.
Each chunk then is rendered via its own VBO.

The VBO rendering code, called per-chunk, looks like this:

interleavedBuffer.flip();

glGenBuffersARB(ib);
int vHandle = ib.get(0);

glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_COLOR_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);

glBindBufferARB(GL_ARRAY_BUFFER_ARB, vHandle);
glBufferDataARB(GL_ARRAY_BUFFER_ARB, interleavedBuffer, GL_STATIC_DRAW_ARB);

glVertexPointer(3, GL_FLOAT, 32, 0);
glColorPointer(3, GL_FLOAT, 32, 12);
glTexCoordPointer(3, GL_FLOAT, 32, 24);

glDrawArrays(GL_QUADS, 0, vertexCount);

glBindBufferARB(GL_ARRAY_BUFFER_ARB, 0);

glDisableClientState(GL_COLOR_ARRAY);
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);

ib.put(0, vHandle);
glDeleteBuffersARB(ib);

clear();

This method renders everything perfectly, however it suffers from performance problems. A few chunks of 16x5x16 are fine, 60 fps. Increasing them to 16^3 and loading 10x10 chunks, the performance drops to 8fps.

I'm preparing to use VBOs on a game that loads at most 20x20 chunks of 16x128x16 dimensions so I need resolve this performance issue.

What are my choices?

I have yet to look into interfaced/indexed VBOs. I've heard those are good choices when rendering many of the same thing?
My game currently uses display lists to cache chunk rendering, and I only refresh that cache when a block change is made that requires it. Is there something similar I can do with VBOs?

For reference, my code for the chunk loading and chunk rendering can be perused.


texts: How to create a wind tunnel / sky diving effect like in Fortnite?

texts:
I am using Unity and I want to create a sky diving effect, as if you were looking directly down while falling and have the wind fly past you. My guess is I have to do something with the particle system. How can I do this?

An example is this video of Fortnite https://youtu.be/JFHs3uNJ9Cw?t=23s, you can see the wind flowing from the characters hands and feet.


texts: MonoGame Cross-Platform Conditional Compilation Symbols

texts:
What are the possible compiler directives for MonoGame?

For example, XNA contained directives for WINDOWS, XBOX/XBOX360, and WINDOWS_PHONE.

I've also seen DIRECTX and OPENGL, but when would you need to leverage those?

Supported Platforms:

PC
Windows 8 Store App
Linux
Android
OUYA
Mac
iOS
Playstation Mobile


texts: Trying to use stencils in 2D while retaining layer depth

texts:
This is a screen of what's going on just so you can get a frame of reference.

The problem I'm running into is that my game is slowing down due to the amount of texture swapping I'm doing during my draw call. Since walls, characters, floors, and all objects are on their respective sprite sheet containing those types, per tile draw, the loaded texture is swapping no less than 3 to 5+ times as it cycles and draws the sprites in order to layer properly.

Now, I've tried throwing all common objects together into their respective lists, and then using layerDepth drawing them that way which makes things a lot better, but the new problem I'm running into has to do with the way my doors/windows are drawn on walls. Namely, I was using stencils to clear out a block on the walls that are drawn in the shape of the door/window so that when the wall would draw, it would have a door/window sized hole in it.

This is the way my draw was set up for walls when I was going tile by tile rather than grouped up common objects.

first it would check to see if a door/window was on this wall. If not, it'd skip all the steps and just draw normally. Otherwise
end the current spriteBatch
Clear the buffers with a transparent color to preserve what was already drawn
start a new spritebatch with stencil settings
draw the door area
end the spriteBatch
start a new spritebatch that takes into account the previously set stencil
draw the wall which will now be drawn with a hole in it
end that spritebatch
start a new spritebatch with the normal settings to continue drawing tiles

In the tile by tile draw, clearing the depth/stencil buffers didn't matter since I wasn't using any layerDepth to organize what draws on top of what.

Now that I'm drawing from lists of common objects rather than tile by tile, it has sped up my draw call considerably but I can't seem to figure out a way to keep the stencil system to mask out the area a door or window will be drawn into a wall. The root of the problem is that when I end a spriteBatch to change the DepthStencilState, it flattens the current RenderTarget and there is no longer any depth sorting for anything drawn further down the line. This means walls always get drawn on top of everything regardless of depth or positioning in the game world and even on top of each other as the stencil has to happen once for every wall that has a door or window.

Does anyone know of a way to get around this? To boil it down, I need a way to draw having things sorted by layer depth while also being able to stencil/mask out portions of specific sprites.


texts: How to Save boolean properly on Playerprefs?

texts:
I want to make a shop system if I buy the items, the items will be saved on Playerprefs, no need to buy again when I restart or re-open the game, for that I already make it to setInt but I don't know when I call getInt. I tried to call it in the start method with a new int index but it doesn't work.
This my script
for store the itemsType
[System.Serializable]
public class m_ShopItem
{
    public Sprite theIcon;
    public int price;
    public bool isBuyed=false;
}

Then I make it list
public List<m_ShopItem> ShopItemsList = new List<m_ShopItem>();
 [SerializeField] GameObject ShopPanel;
    [SerializeField] Transform theContent;
    GameObject g;
    Button buyBtn;
    public GameObject itemTemplate;

void Awake()
    {
        if (Instance == null)
            Instance = this;
        else
            Destroy(gameObject);

        for (int i = 0; i < ShopItemsList.Count; i++)
        {
            // Create a different PlayerPrefs for each Item in the Shop.
            PlayerPrefs.SetInt("isBuyed" + i, ShopItemsList[i].isBuyed ? 1 : 0);
        }
    }

    private void Start()
    {

        for (int i = 0; i < ShopItemsList.Count; i++)
        {

             g = Instantiate(itemTemplate, theContent);
            g.transform.GetChild(0).GetComponent<Image>().sprite = ShopItemsList[i].theIcon;
            g.transform.GetChild(1).GetComponent<TextMeshProUGUI>().text = ShopItemsList[i].price.ToString();
            buyBtn = g.transform.GetChild(2).GetComponent<Button>();
            ShopItemsList[i].isBuyed = PlayerPrefs.GetInt("isBuyed" + i) == 1 ? true : false;
            if (ShopItemsList[i].isBuyed)
            {
                DisableBuyButton();
            }
            buyBtn.AddEventListener(i, OnShopItemBtnClicked);
            Debug.Log(ShopItemsList[i].isBuyed);
        }
    }
    void OnShopItemBtnClicked(int itemIndex)
    {
        if (m_shopManager.Instance.HasEnoughCoins(ShopItemsList[itemIndex].price))
        {
            m_shopManager.Instance.UseCoins(ShopItemsList[itemIndex].price);
            //purchase Item
            ShopItemsList[itemIndex].isBuyed = true;
            PPlayerPrefs.SetInt("isBuyed" + itemIndex, ShopItemsList[itemIndex].isBuyed ? 1 : 0);

            //disable the button
            buyBtn = theContent.GetChild(itemIndex).GetChild(2).GetComponent<Button>();
            DisableBuyButton();

            //add avatar
            m_Profile.Instance.AddBallType(ShopItemsList[itemIndex].theIcon);
        }
        else
        {
            //NoCoinsAnim.SetTrigger("NoCoins");
            Debug.Log("You don't have enough coins!!");
        }
    }

    void DisableBuyButton()
    {
        buyBtn.interactable = false;
        buyBtn.transform.GetChild(0).GetComponent<Text>().text = "PURCHASED";
    }

but the result is the same I have to rebuy when going to the main menu or restart the game.
Can anyone tell me what's wrong with my script?


texts: In Unity, why does my Hose particle system only show up in the scene preview?

texts:
I added particle system package from assets, selected hose particle system and put it in the scene. When I select 'Water Shower', it works in the scene preview, but on play, it just appears and vanishes in a fraction of a second. I set Looping, Play on awake enabled already, no result.

I also get the same result in a separate otherwise empty project.

Is this the problem with the prefab or there is something else I need to set to make it work properly?

I am trying to use hose particle system to create fountain like effect. I have used Steam particle system from same package, and it renders in play mode fine.

I know this is similar to this StackOverflow question.  I have already tried the solutions provided there, and the asker also has not yet marked answer as a solution.

I've also made a video of what is happening.


texts: How do I create a simple clickable button?

texts:
I've tried to attach this function to the play button.

public void Play () {
    Application.LoadLevel("Scene1");
}

I've created an empty Game Object and attached my script to it. But when I go to the OnClick() method in the Play button and try to select my Play() method can't find it, there is only a bunch of useless functions that do nothing to help me load the level.

And apparently most tutorials and forum posts suggest doing it this way, but it doesn't work for me.

Other posts say that you can assign the OnClick()-method in your script and show how to assign the function, but no one remembered to mention how to get the button object to which I could assign the function.

I'm new to unity and this problem is getting very frustrating. I'm using the free version of Unity for now.


texts:
Given a situation where I have a pool of X people of different scores (ranks) S with game size N. How do I partition the pool into N sized games where the standard deviation of ranks for each games is minimized?

(quality of the game is inversely proportional to STD of ranks)


texts: How to achieve an GPS-Based game like "Parallel Kingdom"

texts:
I'd like to use Google Maps, in my game, much like "Ingress", "Pokémon GO" and "Parallel Kingdom".
When I take a deeper look into the Android API/Google Maps API, and dozens of forums, I noticed that it's very hard to display sprites or even animations using the Google Maps API. Someone said that you need to layer stuff. Someone else said it's better to use game engines for that. No one tells me how to begin. I opened Android Studios and made a new Google Maps project. I compiled and ran the app. There is the map, so I guess I have completed the first step.
How do I combine the Google Map with an extra view or LibGDX layer for displaying sprites? How manage this with a multiplayer server?
I am wanting to set my map up like "Parallel Kingdom", which you can see, below.


texts: Unity build does not launch and leaves no logs/errors

texts:
I have released my first title Audio Infection ( https://store.steampowered.com/app/911580/Audio_Infection/ ) for a bit over a year ago. Recently 1 user has so far encountered an issue where the game does not launch. He is the only user that encounters this problem.

He has this issue on both Win 7 and Win 10. His system specs are fine and his drivers are up-to-date. The game does not leave a log file, rather it looks like it is unable to boot. There are no Windows error reports on it either. I watched it through Discord screenshare because I could not properly understand his issue.

I had asked a few other random people to test my game and demo (he has the issue with both, the demo and full version) however no one else (including me) is able to reproduce this behavior.

At this point I have tried:

updating Unity from 2018 to 2019 (no change in behavior)
added manual logging (with no results)
updating drivers (on his system)
installing Visual C++ (on his system)
empty project with Unity sample scene (he was able to load the sample scene!)
deleting crashhandler.exe (used to fix similar issue in the past based on older threads)
modifying files
deleting and downloading the files

What else can I try in order to figure out what is causing the issue? I am honestly clueless. Since the sample project was able to boot on his system there is definitely something wrong with the build on my end. However he is the first person with this issue. It doesn't even get to the point of launching on his system and it can't be found in the memory either. It is almost as if Windows is blocking it from launching, however that is not the case. But the result is very similar to that.

There is a free demo on the store page available in case you want to see if it boots on your system. It works for both VR and non VR systems. When no VR devices are detected all VR related contents are disabled. This has been thoroughly tested and worked on loads of different Windows systems with different specs, with VR and no VR.

Once again, there are no errors, no logs, the build doesn't even make it to that point, yet that exact same build works for literally everyone else on various systems. I am absolutely clueless about what to do in order to resolve this issue. Any help/advice or pointers towards the right direction are greatly appreciated!

PS: he is not a troll, I have known this guy for a long time now and he genuinely wants to support me.


texts: Get polygons points from an array of 0 and 1

texts:
I have an 2D array containing 1 for walls or 0 for empty cells.

I can draw my maze by iterating through the map, placing a wall when map[x][y] is equal to 1 but I want to get the points of the different polygon formed by the 1 in order to have minimum draw call.

But I'm not sure about the Maths and I don't know how to proceed.

Would you please give me some hint ?


texts: Accurately record and play back game sessions in an MMO - timing issues?

texts:
In order to detect and reproduce bugs in an MMO, recording game sessions on the server can help.

How can such recording and replay of the data be implemented to be accurate, i.e. be 100% deterministic / produce exactly the same result on each replay?

I intend to record timestamped incoming messages as the only data necessary, if possible.
The playback would use the database snapshot as present at the beginning of the recording.

Details about the MMO

mainly I/O driven (act on incoming network messages plus simple periodic AI)
2D
C++ and Lua, RDBMS for storage.
Clients send updates at around 1-3 times per second due to the simple nature of the MMO

In particular, consider timing issues:

If run-time for computations on playback differ from the run-times when recorded, frame times will also differ and can for example affect the movement of NPC units (move 3px instead of 1px).

How to make sure that in the replay AI has the same time constraints compared to when recorded? Fixed time-step? Record the time deltas between each frame and on replay make sure those deltas determine the actual frame time?


texts: The ship "shudders" in scrolling Asteroids

texts:
In my Asteroids game the user can scroll through space. When scrolling, the ship is drawn in the centre of the window. I use interpolation. I scroll the window uing glOrtho, centering it around the centre of the ship. On my first machine (7 years old, Windows XP, NVIDIA), I am doing 50 updates and 76 frames per second. This is smooth. My other machine an old compaq laptop (Pentium III) with Linux and Radeon OpenGL driver delivers 50 updates and 30 frames per second. The ship regularly seems to "shudder" back and forth when at maximum thrust. When you position the mouse cursor beside the ship it is obvious that its relative position in the window changes. Also, the stars seem blurred into short "lines".

Playing the game in non-scrolling mode, the ship moves within the window, glOrtho is therefore not called repeatedly and there is no problem.

I suspect a bug in my positioning of the ship and the window but I have dumped out these values and they seem to only go forward, not forward-back-forward. The driver does support double buffering. I guess if it is my bug I need to slow the frame-rate down to debug properly. My question: is this an obvious driver bug or is the slower machine uncovering a bug in my stuff and if so, some debugging tips would be appreciated. I am drawing in world co-ordinates and letting OpenGL do the scaling and translation so if I had a quick way of verifying what pixel co-ordinates OpenGL produces for the ship centre, that would help clarify this.


texts:
I just finished getting movement/jump animation for a player sprite in Xcode using Cocos2D. The basic movement algorithm is a timer that updates every 0.01 sec, changing the sprite position to (sprite.position.x + xVel, sprite.position.y + yVel). Each time a movement button is tapped, the appropriate velocity (initialized to 0) is changed to whatever speed I choose, then a stop movement button returns the velocity to 0. It's not an ideal solution but I'm very new at this and stoked to at least have that working with little help from the internet.

So I may not have explained that perfectly, but it is in fact working to my satisfaction in Xcode's iPhone Simulator, however when I build it for my device and run it on my phone, the sprite's movement speed is noticeably slower than in Xcode. At first I thought it must have to do with the resolution of the iPhone 4, making the sprite's movement path twice as long, but I found that if I pull up the multitask bar, then return to the app the speed will sometimes jump back to normal. My second theory was that the code is just inefficient and is bogging the processes down, but I would see this reflected in the frame rate wouldn't I? It stays at 59-60 the whole time, and the spritesheet animation runs at the correct speed.

Has anyone experienced this? Is this a really obvious issue that I'm completely missing? Any help (or tips for optimizing my approach to movement) would be much appreciated!


texts:
I want to generate a maze with the following properties:

The maze is non-perfect. Means it has loops and multiple ways to reach the exit.
The maze should be random. The algorithm should output different mazes for different input parameters
The maze doesn't have to be braided. Means dead-ends are allowed and appreciated.

I just can't find the right resources on google. The closest i found was this description of the different types of algorithms: http://www.astrolog.org/labyrnth/algrithm.htm. All other algorithms were for perfect mazes.

Can anyone give me a website where i can look this up or maybe an algorithm directly?


texts:
I've been following a tutorial on making a free camera for a 3D model. What the camera class does is allow the player to move and rotate in respects to the model's current position using the right thumbstick of an XBox360 controller.

Here is the code:

http://pastebin.com/xb4eznMi

Can someone explain to me how to connect this to my model in my Game class?


texts: How can I factor momentum into my space sim?

texts:
I am trying my hand at creating a simple 2d physics engine right now, and I'm running into some problems figuring out how to incorporate momentum into movement of a spaceship.

If I am moving in a given direction at a certain velocity, I am able to currently update the position of my ship easily (Position += Direction * Velocity).  However, if the ship rotates at all, and I recalculate the direction (based on the new angle the ship is facing), and accelerate in that direction, how can I take momentum into account to alter the "line" that the ship travels?  Currently the ship changes direction instantaneously and continues at its current velocity in that new direction when I press the thrust button.  I want it to be a more gradual turning motion so as to give the impression that the ship itself has some mass.

If there is already a nice post on this topic I apologize, but nothing came up in my searches.  Let me know if any more information is needed, but I'm hoping someone can easily tell me how I can throw mass * velocity into my game loop update.


texts: How to create a shining sun in OpenGL ES 2 (on Android)

texts:
Let's say I created a space scene in OpenGL ES 2 similar to this one:

At the moment my sun is just a small texture similar to the one in the image that I place somewhere far, but it obviously looks very static. How would I make my sun shine & look alive?

EDIT: This is just an example image and all I care about is the sun. In my implementation the lighting and everything else is fine, but the sun itself (which is just a texture at the moment), doesn't "animate"/shine at all. I'm trying to find out how to make my sun shine and look like it's alive.


texts: Calculating a smooth velocity of interaction touches

texts:
I have a touch game and it would be beneficial to be able to know the "velocity" of each touch on the screen.  Let me explain.

Right now I am already subtracting current touch position from previous ones to get a dt, however this is not working well. Sometimes the dt will show up as 0 even though the finger is moving.

What would be a good way to measure a smooth velocity of each touch considering that it can release, or touch back down at any moment?

I already have  method to track the position of each finger, I just need a way to get a smooth velocity.


texts: Procedural generation of seabeds / underwater terrain

texts:
There are a lot of resources available for procedural content generation when it comes to terrain, which is above sea-level.

For a naval simulation, I now need to procedural generate terrain below sea-level. My first idea was to just use standard techniques (like fractals) but maybe somebody knows good resources about this topic?

Thanks.


texts: Can't load vector font in Nuclex Framework

texts:
I've been trying to get this to work for the last 2 hours and I'm not getting what I'm doing wrong...

I've added Nuclex.TrueTypeImporter to my references in my content and I've added Nuclex.Fonts & Nuclex.Graphics in my main project.

I've put Arial-24-Vector.spritefont & Lindsey.spritefont in the root of my content directory.

_spriteFont = Content.Load<SpriteFont>("Lindsey"); // works

_testFont = Content.Load<VectorFont>("Arial-24-Vector"); // crashes

I get this error on the _testFont line:

File contains Microsoft.Xna.Framework.Graphics.SpriteFont but trying to load as Nuclex.Fonts.VectorFont.

So I've searched around and by the looks of it it has something to do with the content importer & the content processor. For the content importer I have no new choices, so I leave it as it is, Sprite Font Description - XNA Framework for content processor and I select Vector Font - Nuclex Framework And then I try to run it.

_testFont = Content.Load<VectorFont>("Arial-24-Vector"); // crashes again

I get the following error

Error loading "Arial-24-Vector".

It does work if I load a sprite, so it's not a pathing problem. I've checked the samples, they do work, but I think they also use a different version of the XNA framework because in my version the "Content" class starts with a capital letter.

I'm at a loss, so I ask here.

Edit:

Something super weird is going on. I've just added the following two lines to a method inside FreeTypeFontProcessor::FreeTypeFontProcessor(
    Microsoft::Xna::Framework::Content::Pipeline::Graphics::FontDescription ^fontDescription,
    FontHinter hinter, just to check if code would even get there:

System::Console::WriteLine("I AM HEEREEE");
System::Console::ReadLine();

So, I compile it, put it in my project, I run it and... it works! What the hell?? This is weird because I've downloaded the binaries, they didn't work, I've compiled the binaries myself. didn't work either, but now I make a small change to the code and it works? >_>.

So, now I remove the two lines, compile it again and it works again. Someone care to elaborate what is going on? Probably some weird caching problem!


texts: C++ How to implement a spatial hash (for a 2d Game)

texts:
I feel kind of silly for asking this question, but are there examples or tutorials on how to implement a spatial hash (grid/cell-based partitioning), preferably in C++?

I'm stuck and I have no idea how to tackle this problem. I've searched all over but all I get are people saying "gosh that's easy to do", which I'm sure is true if you've seen another implementation or have done so yourself.

Instead of quadtrees I'd like to have a spatial hash to query areas of my game which has a very large world.

Thinking it probably wouldn't even have to account for sizes, merely points, as the type of game mine is that isn't that big of an issue. And if it is, I could always add that.


texts: StartCoroutine inside TriggerOnEnter2D isn't working

texts:
I am new to this, but I need help with a CSharp script. I need to collide with the desired object, pass the game to be 1.6 in TimeScale. After passing 8 seconds in the game, change back to 1 TimeScale, and try to call a Coroutine does not work. I really appreciate your help!

The code:

void TimeSet(){
    Time.timeScale = 1.6f;
}

IEnumerator Normal (){
    yield return new WaitForSeconds(8f);
    Time.timeScale = 1f;
    Debug.Log ("Ready");
}

void OnTriggerEnter2D(){
    TimeSet ();
    StartCoroutine ("Normal");
}


texts: Getting a uint color array from a portion of a Texture2D

texts:
I'm currently using the Farseer tools to create a body from a Texture2D. However, my texture is a spritesheet and I need to get the uint array containing the colors from a portion of the full Texture2D.

Let's say may texture is 200x200 big and I need to get the colors in the Rectangle(20, 20, 40, 40). I know that there is a GetData() overload and I'd imagine I have to call it like this:

        uint[] subData = new uint[40 * 40];
        polygonTexture.GetData(0, new Rectangle(20, 20, 40, 40), subData, 0, 40*40);

However, I always get a System.NotImplementedException, probably due to MonoGame. Is there another easy way to do this? Or do I have to create a Subtexture and then get the Colors from that subtexture?


texts: "High" Quality Pixel Art Games (varying the scale factor)

texts:
Currently I'm developing a pixel art game and I was looking through the different styles to see which one would be the best for my game. The classic style is to draw all sprites/textures at a 1x scale offscreen to an image and then when you render the frame, scale the image up some amount to fit the window. The smaller the textures, the more pixelated the graphics look.

However, I also saw games like Realm of the Mad God, and I was wondering how they do their drawing. The game is mostly pixelated, with some exceptions. Most notable are the high quality shadows, high quality text and the very thin black outlines on all the sprites. I was wondering how this can be achieved. The only thing I can think of is the scale everything separately (game elements x3, outlines x1, shadows x1, etc...) so you can mix pixelated elements with high quality textures. Is this the right approach? What would this look like in LibGDX and game development in general?

Realm of the Mad God example.

One last thing, if anyone knows, could you tell me which of these two styles Terraria uses, and if its the first style, what the "base" scale is? (resolution of the game screen at 1x scale)


texts:
From what I understand about time based Euler Integration is that you will set a number of pixels you want your object to move in the space of second and then the value will be regulated based on the frame-rate of the machine your running the game on.

What I'm having issue with is this

 You will set your acceleration

 acceleration = 30;

Then that acceleration will be added to the velocity and multiplied by the time
   which would be say  0.0166667 if the frame-rate is 60fps which will cut down the
   velocity to the appropriate number for that frame which would be 0.50001

velocity += acceleration * dt;

but then when you add the velocity to the position it yet again multiplies the result by 0.0166667 which leaves you with 0.0833366667

position += velocity * dt;

What I'm trying to get is that instead of the 30 pixels per second I initially intended for the character to move I will need to put in an acceleration value of 1800.

I was wondering why this is done instead of simply multiplying the acceleration by the dt and leaving it at that ?


texts: What is the most efficient technique for range detection?

texts:
I have a bunch of patrolling enemies that fire projectiles when the player is in projectile range - a specific radius. Which method is the most efficient and elegant?

overlapSphere
sphereCast
triggers
square magnitude
anything else?

I am using Unity.


texts:
I'm continuing to port an OpenGL app from Visual Studio 2012 to XCode 5.

The only major issue I'm having is mouselook. It "doesn't work" under OSX (Mavericks).

Here's the (pseudocode):

Pre-update, executed at the start of the frame:

void Dispatcher::PreUpdate(GameTime &time)
{
    m_currentKeyboardState = m_nextKeyboardState;
    m_previousMousePosition = m_currentMousePosition;

    GetMousePosition(m_currentMousePosition);
}

Post-update, executed, well, after input processing, at the end of the frame:

void Dispatcher::PostUpdate(GameTime &time)
{
    m_previousKeyboardState = m_currentKeyboardState;

    if (m_captureMouse)
        RecenterMouse();
}

Method to recenter the mouse:

void Dispatcher::RecenterMouse()
{
    glfwSetCursorPos(m_window, m_windowSize.x / 2.f, m_windowSize.y / 2.f);

    GetMousePosition(m_currentMousePosition);

    if (m_previousMousePosition != m_currentMousePosition)
        cout << "Mouse: " << m_currentMousePosition.x << "," << m_currentMousePosition.y << endl;

    m_previousMousePosition = m_currentMousePosition;
}

And, jut for completeness:

void Dispatcher::GetMouseMotion(Vector2 &movedBy)
{
    if(m_captureMouse)
    {
        movedBy.x = (m_currentMousePosition.x - m_previousMousePosition.x);
        movedBy.y = (m_currentMousePosition.y - m_previousMousePosition.y);
    }
    else
    {
        movedBy.x=movedBy.y=0;
    }
}

If m_captureMouse is true, and m_previousMousePosition != m_currentMousePosition, the y delta is always 1, no matter how far I've moved the mouse. (Actually, using the trackpad, but should be indentical.)

This code works perfectly under Win7, but never returns anything other motion than (0,1) under OSX.

Suggestions? I've seen other questions regarding glfw and osx, but no solutions.

EDIT

It's worth noting if I turn off mouse capture (which basically does everything but recenter the mouse at the end of the frame), mouselook works correctly but, of course, the cursor is free to wander outside of the window, which doesn't really work for a first-person app.


texts: System.Net.Http.dll and Unity 2018.2.1, 2.2, 2.3 are conflicting, assembly reference keeps being deleted in VS 2017, any suggestions?

texts:
I'm looking for some suggestions on how to fix a strange bug i've been getting with System.net.http.dll.

For the record, builds work fine as i have the mcs.rsp file in the /Assets/ folder with "-r:System.Net.Http.dll" inside. The problem lies with Visual Studio and it's relation to Unity. I can add the reference to the dll by selecting "Analyzers" then hitting "Project" and Adding the dll found in:

C:\Program Files\Unity\Hub\Editor\2018.2.2f1\Editor\Data\MonoBleedingEdge\lib\mono\4.7.1-api\System.Net.Http.dll

But VS changes the reference instantly to:

C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework.NETFramework\v4.7.1\System.Net.Http.dll

Then after a short amount of time, the reference i made just gets automatically deleted.

I've tried clearing the VS Cache inside of AppData/Local/ as well as clearing everything but the Asset Folder in my unity project (including obj, library, .CSPROJ, .sln files etc.)
But to no success.

Im using .NET 4.x in the project and it builds fine, its just that the VS reference keeps being deleted. so when it comes to "Attaching to Unity" i can't execute until i re-assign the "temporary" assembly reference.

I've tried updating VS, Reinstalling it as well as unity 2018.2.1 and Unity2018.2.2 to no success.

I'm all ears.

UPDATE: Problem has been fixed in 2018.3


texts: Can you call a method from the script of all instantiated prefabs of a cetain object?

texts:
I am currently trying to recreate chess and the problem I am having is that I need to instantiate all of the pawns in a loop (I could write it out but it seems inefficient) and I need to be able to call a method from all of the pawns to look for a check (I'll probably use raycast but I haven't gotten to that yet). How can I go about calling the method that looks for checks from all of the instances of the pawn?
I'm pretty new to unity so please go easy on me if I said something dumb


texts: Causes of Scene Build File Size Bloat in Unity

texts:
We are developing racing game for android and iOS.
Our problem is final game build size is getting more than 100+ mb.
So here is what we tried,

to reduce it by compressing textures.
Reducing "Max size" to 512 and 256
Reduced .FBX size

All is well n good though the final "scene" size for each scene is more than 8mb.
I am not sure why scene size is that much? I would like to know what are the things that causes unity scene size to occupy that much memory?


texts: How to find the participation id corresponding to a sender id

texts:
I am creating a real time multiplayer game in unity 3d using Google Play Game Services. In my function where I deal with the positioning of players based on information that is sent from other players, I get a sender id. The sender id is a long string of characters that does not match any participation ids. My participation ids are just strings such as "Player 1234." I keep the participation ids in an array so I can reference them and compare them to the sender of the information that I am receiving so I know which player it is from.

If the sender id and participation id are two different things, how do I make the connection between the two?

Here is a link to the tutorial I have been following for Google play services in unity:
https://www.raywenderlich.com/87042/creating-cross-platform-multi-player-game-unity-part-2


texts: transform.Rotate needs to change axis of rotation

texts:
So I'm making a game in Unity. After many failed attemps from either being bored of the idea, or something going wrong and me giving up I think (hope) that will be the good one.

I have made a simple racing game with a track and a car. I am using transform.Translate to move it, but when I use transform.Rotate to turn it goes around the x axis. How do I change the axis it goes around? I cant find anything online.

            if (Input.GetAxisRaw("Horizontal") > 0.5f)
    {
        transform.Rotate(Vector3.right * Time.deltaTime * handling);
    }
    if (Input.GetAxisRaw("Horizontal") < -0.5f)
    {
        transform.Rotate(Vector3.left * Time.deltaTime * handling);
    }
    if (Input.GetAxisRaw("Vertical") > 0.5f || Input.GetAxisRaw("Vertical") < -0.5f)
    {
        transform.Translate(new Vector3(0f, Input.GetAxisRaw("Vertical") * moveSpeed * Time.deltaTime, 0f));
    }

Thanks for any help you can give me.


texts: Best way to load multiple TextureRegion from multiple bitmaps in AndEngine

texts: I've seen a lot of examples of AndEngine usage where some bitmaps are mapped into some TextureRegions and loaded into an Atlas. But what if I have a lot of bitmaps, where each bitmap is a sprite sheet, with several sprites for a given entity? How can I extract multiple texture regions from each bitmap and load all that into a single Atlas?