texts: An API independent way of managing video memory?

texts:
I'm developing a game. The game architecture is very modular. I have a "Graphics Engine", which uses either a Direct3D or OpenGL renderer. However the user does not have access to the renderers directly. Instead the "Graphics Engine" class is used, which uses a renderer interface.

I also have a resource management system. As for now, the renderers are respoinsible for allocating and releasing video memory. That couples my design in a bad way, since the "Graphics Engine" has undesirable logic for transferring resources between the RAM and the VideoRam through sending signals to the "Renderer". I want the resource management system to be responsible for allocating video memory.

I want to decouple the "Renderer" and "Graphics Engine" classes as much as possible, and make the renderer only responsible for rendering. Is there a way to obtain a universal pointer to a Video RAM buffer, and use it to render with both renderers?

My problem is basically that I can only obtain OpenGL or Direct3D handles, which can be used only from the relevant API. And the "Graphics Engine" should not know which renderer it uses.


texts:
I have some issues with detecting the collision when OnTrigger2d, as you can see in my screenshot below, that actually too far from the object.

this my script
private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.tag == "Obstacle")
        {
            anim.SetBool("isDeath", true);

            _GameManager.instance.GameOver();
        }
    }

    private void OnTriggerExit2D(Collider2D collision)
    {
        if (collision.tag == "Obstacle")
        {
            anim.SetBool("isDeath", false);

        }
    }
```


texts:
I'm working on a multiplayer game, I created a custom C# server using TCPListner.

I can't figure out how to send a players position to the server from the client side. I also couldn't figure out how to broadcast the position received from the client side to the rest of the players. Can someone help me with this?


texts: Do I have too many colliders on my screen?

texts:
I'm running into a situation where my frame rate drops from 70 FPS (on my desktop computer) down to 5 FPS (on my iphone) and I'm trying to understand why.  At the moment, I'm only drawing simple tiles, with box colliders attached to them, on the screen...

I've read that colliders are very expensive to have and I have 2400 of them on the screen at any given time.  My questions are...

Do you think it's the number of colliders that are causing the slowdown?
If so, what are some ways I can optimize this?
If not, what do you think the problem is?

Thanks so much for your wisdom!
Also, it's worth noting that I'm using 2D Toolkit in Unity for drawing.
UPDATE: I just removed all the colliders in the scene and I'm still experiencing the slowdown.  Your thoughts?


texts: What rotation needs to be applied to align mesh with expected axis of target?

texts:
I'm using LWJGL and JOML to create a 3D view of hexagons whose positions lie on a torus.
I have a number (NxM) hexagons, whose centres and normals I have calculated to be placed on the torus to completely cover the torus surface, but in the "game" engine I'm using I need to convert each item being rendered to a position and 3 rotation angles. I'm struggling to go from the 3 normals of the item to the 3 angles.
EDIT: Subsequent to posting this I have got some way in creating a matrix with the angles and converting to Euler angles, everything is now turned according to those angles, but they aren't facing directions I expect.
The background
I'm trying to create a visualisation of a Conway Game of Life using hexagons but instead of a simple plane, mapping each hexagon onto a Torus.
I've done the maths to calculate the centres of every hexagon, and the 3 direction unit vectors that they need to point to, when in their places around the torus.
For illustrative purposes, here's a view of the torus and 2 hexagons that would lie on it (not real, this is just me mocking it up in Blender)

What I'm struggling to understand is how to rotate the single mesh for a hexagon to its calculated normals at the position I want to place it.
i.e. How do I rotate some "unit" hexagon mesh (loaded from an OBJ file exported from Blender) to point in the direction of the 3 normals I've calculated they should be for each hexagon around the torus.
I have read a similar question here, but I'm struggling to get from the idea of the 4d rotation matrix to how I convert that to a Vector3f for rotations. I have the 3 vector normals, could create the 4d matrix, but I need a Vector3f (the rotations about x/y/z) to the mesh is drawn correctly.
My code is here. I'm following this guide for using LWJGL to create GameItems (my hexagons) and position/rotate them from a loaded obj file mesh, but as I say, I'm struggling to calculate the rotation Vector3f needed to point in the same direction I've calculated.
Here's the code section relevant to the problem at hand:
    val mesh = loadMesh("/conwayhex/models/simple-hexagon.obj")

    hexGrid.hexAxes().forEach { (location, axis) ->
        // axis is a Matrix3f with my 3 normals at the centre of the hexagon, e.g
        // cX  cY  cZ
        //  0  -1   0
        //  0   0  -1
        //  1   0   0

        val gameItem = GameItem(mesh)
        gameItem.position = location
        gameItem.scale = 0.2f // TODO: calculate this according to the torus size

        // what rotation do I give this?
        // How do I calculate it from the given axis for the current item?
        gameItem.rotation = Vector3f(30f, 30f, 30f)

        gameItems += gameItem
    }

The output of the application given the above static 30 degree rotation is:

Can anyone help me unserstand how I apply the rotation to my items so they align to what I've calculated they should be?


texts: What is the best way to check if there is overlap between player and static, non-collidable items in bullet physic engine

texts:
I'd like to add non collidable objects (eg: power ups, items, ...) in a game world using Bullet Physics Engine and to know if there is collision between player and them.

Some info : there is a lot of items (> 1000), all are box shapes and they don't overlap.

Here is things i have tried :

btDbvt* bvtItems = new btDbvt(); //btDbvt is a hierachical AABB tree, used by Bullet
foreach(var item ...)
{
    btDbvtVolume volume = ... //compute item AABB;
    bvtItems->insert(volume, (void*)someExtraData);
}

Then, to find collisions between items and player :

playerRigidBody->getAabb(min, max);
btDbvtVolume playervolume = ... //compute player AABB
bvtItems->collideTV(bvtItems->m_root, playervolume, *someCollisionHandler);

This works fairly well (and its very fast), however, there is a problem : it only check items AABB against player AABB. That loss of precision is acceptable for items but not for player which is not a box. It would actually need another check to make sure player really collide with item but i don't know how to do this in Bullet. It would have been nice to have a function like this :

playerRigidBody->checkCollisionWithAABB();

After doing trying that, I discovered that a btGhostObject exist and seems to have been made for that.

I changed my code like this :

foreach(var item...)
{
    btCollisionObject* ghostObject = new btGhostObject();
    ghostObject->setCollisionShape(boxShape);
    ghostObject->setCollisionFlags(ghostObject->getCollisionFlags()
                                   | btCollisionObject::CF_NO_CONTACT_RESPONSE);
    startTransform.setOrigin(...); //item position
    ghostObject->setWorldTransform(startTransform);
    dynamicsWorld->addCollisionObject(ghostObject, btBroadphaseProxy::SensorTrigger,
                   btBroadphaseProxy:: CharacterFilter);
}

It also works ok, but there is a huge fps drop (almost ten times slower) which is not acceptable. Maybe there is something missing (forget set a flag) and Bullet is doing extra job for nothing or maybe all that ghostObjects are polluting broad phase and ghostObject is not the right thing for that.

Any help would be appreciated.


texts: How can I save a global high score for all players in AS3?

texts:
I am developing a game in which I want to make a scoring system where the global high score is stored and shared by all players.

I am using Flash and ActionScript 3. Until now I've used SharedObject.getLocal("savename") for saving score individualy but I cant figure out the way to store a common high score for all players.


texts: Error(45,74): Identifier 'collision' is not declared in the current scope

texts:
func _physics_process(delta):
    direction = Vector3(0, 0, 0)
        if Input.is_action_pressed("ui_left"):
            direction.x += 1
        if Input.is_action_pressed("ui_right"):
            direction.x -= 1
        if Input.is_action_pressed("ui_up"):
            direction.z += 1
        if Input.is_action_pressed("ui_down"):
            direction.z -= 1
        direction = direction.normalized()
        direction = direction * speed * delta
        if velocity.y > 0:
            gravaty = -20
        else:
            gravaty = -30

        velocity.y += gravaty * delta
        velocity.x = direction.x
        velocity.z = direction.z

        velocity = move_and_slide(velocity, Vector3(0, 1, 0))

        if is_on_floor() and Input.is_key_pressed(KEY_SPACE):
            velocity.y = 10
        var hitCount = get_slide_count()
        if hitCount > 0:
            var collision = get_slide_collision(0)
        if collision.collider is RigidBody:
            collision.collider.apply_impulse(collison.position, -collision.normal)


texts:
I added some tiles to some object layers in my tiled map and now I want to draw them in game.
I tried to render everything with

mapRender.render();

but the tiles doesn't show up.
Then I tried to render just one object layer and all of its objects with

mapRenderer.renderObjects(tiledMap.getLayers().get(0));

but it wasn't working.

Ingame:

Tiled:

Could someone please tell me how to make the tiles show up?
Thank you very much!


texts: Raycasting tutorial / vector math question

texts:
I'm checking out this nice raycasting tutorial at http://lodev.org/cgtutor/raycasting.html and have a probably very simple math question.

In the DDA algorithm I'm having trouble understanding the calcuation of the deltaDistX and deltaDistY variables, which are the distances that the ray has to travel from 1 x-side to the next x-side, or from 1 y-side to the next y-side, in the square grid that makes up the world map (see below screenshot).

In the tutorial they are calculated as follows, but without much explanation:

//length of ray from one x or y-side to next x or y-side
double deltaDistX = sqrt(1 + (rayDirY * rayDirY) / (rayDirX * rayDirX));
double deltaDistY = sqrt(1 + (rayDirX * rayDirX) / (rayDirY * rayDirY));

rayDirY and rayDirX are the direction of a ray that has been cast.

How do you get these formulas? It looks like pythagorean theorem is part of it, but somehow there's division involved here. Can anyone clue me in as to what mathematical knowledge I'm missing here, or "prove" the formula by showing how it's derived?


texts: Monogame - Load SpriteFont using .spritefont file without using the Pipeline Tool

texts:
There is a way to load a sprite-font without using the Monogame Pipeline tool?

I am creating a Game-Engine using Monogame, i cant use the Monogame Pipeline tool because the way that Game-Engine manage the Content Files is different, and it needs to read the source file, not the .xnb file that Monogame Pipeline tool create.


texts: State of art shadowing technique for OpenGL on isometric terrain?

texts: What's the most efficient way of creating shadows for object on a isometric terrain with OpenGL and JOGL? Note that this terrain is not flat and is not heightmap generated. Think it as another model. However objects' shadows on other objects is just nice to have.Objects must drop shadows just on the terrain.


texts: Game Either Runs Poorly or at Different Speeds

texts:
I'm making a simple 2D shooter game using C++ and SDL2. For my main game loop, I used the code from the famous Fix Your Timestep article. The problem is that, because I'm using a fixed delta time, the game's objects move at different speeds depending on the hardware of the computer it is being played on. On more powerful PCs, the game runs very fast, and on weaker PCs, it runs slowly.

I was able to get around this problem by removing the if (frameTime > .25) { frameTime = .25; } statement, however this caused, paradoxically, the game to run poorly on computers with more powerful CPUs. I'm not limiting the FPS, and so when I run the game on a powerful PC, it starts off running at around 1500 FPS, but then the FPS quickly drops to unplayable levels, all while using up a significant percentage of the CPU power. On weaker PCs, however, the game runs just fine.

My question is, how do I balance these two issues so that the game runs at an acceptable framerate, while also making sure that the game objects move at the same speed, regardless of the hardware it is being played on? The game runs at a low resolution and uses very simple graphics, so it should be able to run smoothly even on weak PCs.


texts: How do I properly light characters in a Unity scene?

texts:
I made a game prototype and want to improve some of rendering the visuals through light baking (which I'm new to). While I was mostly able to do this in my environiments, I'm having issues doing this for my characters in Unity. Previously, they came out with odd-ish dark shadows in places as they were affected by light and dull colors. After I begin light baking though and adding Light probes in areas that my characters would be extremely light, especailly on the skin areas. It doesn't look good at all.

Alternatively, without using light probes, it looks like this.

I'm genuinely confused on how to properly light these characters if I can't get a middle ground of proper lighting. Can anyone help me try to understand this and solve this problem?


texts: How do I make a tile passable in one direction only?

texts:
I want that my character can jump through some of the tiles, like Mario does in this video:
http://www.youtube.com/watch?v=zIPYzbNrNhc

In this video, Mario jumps up through orange platforms, but does not fall down through them.

How can I do that with Farseer?


texts: What technique should I use to implement the following type of "diggable" terrain?

texts:
I'm trying to replicate a certain game mechanic from the game Diggles.
This game takes place in a vertical cross-section of the earth and allows the player to dig tunnels and caves into the environment.
You can see this bevhaviour in action in the following Let's Play on Youtube.

https://www.youtube.com/watch?v=3lIN37JyNTU&t=7m40s

My question is: How can I implement such a modifiable terrain?

My first idea would be to keep a copy of the vertex and index buffer in memory, modify it accordingly and send it to the gpu each time it is modified. However, this seems very inefficient considering the size of the map and how often it would need to be updated.


texts: Changing contents of level depending on which character was selected

texts:
I'm trying to create a character selection menu in Unity, where each character has their own version of the level that follows.

There are about 10 characters. Each character has a different location where they spawn in the level, and each enemy has a different spawn position as well, depending on which character was selected.

What I have been doing is to create separate levels (scene files) for each character. Then in the character selection menu, I load the level depending on the level selected by the user.

This seems to be a lot of code and data repetition, as the scene is the same in all levels; it's just that the spawn positions and enemies are different.

Is there any way have only one level scene, and get the spawn position and enemy spawns based on the character?

This is the code I have so far in GameManager.cs:

public GameObject enemy;
public Transform enemySpawnPoint;

public GameObject player;
public Transform playerSpawnPoint;

public static GameManager instance;

private void Awake()
{
    if (instance == null)
    {
        instance = this;
    }
}

void Start()
{
    StartCoroutine("SpawnEnemies");
    SpawnPlayer();
}

IEnumerator SpawnEnemies()
{
    while (true)
    {
        yield return new WaitForSeconds(1.0f);
        SpawnEnemy();
    }
}

public void SpawnEnemy()
{
    Vector3 enemySpawnPos = enemySpawnPoint.position;

    Instantiate(enemy, enemySpawnPos, Quaternion.identity);

}

public void SpawnPlayer()
{
    Vector3 playerSpawnPos = playerSpawnPoint.position;

    Instantiate(player, playerSpawnPos, Quaternion.identity);

}

...and the character selection script:

public void Level1()
{
    SceneManager.LoadScene(1);
}

public void Level2()
{
    SceneManager.LoadScene(2);
}

// ...

public void Level10()
{
    SceneManager.LoadScene(10);
}

Now the issue is, if I want to make any changes in one scene, like the skybox or background color, I will have to open all the other level scenes and make the changes.

Another thing is that if I want to add new levels, I will have to do the same thing, which seems like a lot of repetition.

Is there some way to set the enemy prefab, enemy spawn positions, player prefab and player spawn position once the character has been selected?

For example, if the user clicks on level1, all the preceding variables are set automatically and so on.....


texts: How do you have the clothing mesh hide the body mesh underneath?

texts:
How do you have the clothing mesh hide the body mesh underneath, to prevent odd patches of body from sticking out in tighter modular clothing?
Is there some sort of shader trick that can have the clothing always render "in front of" the mesh?


texts: Workflow for authoring hitbox data for a 2D fighting/platformer game

texts:
I understand that collisions in fighting games are detected using hitboxes and hurtboxes associated with specific frames of the animation

I am looking for techniques to author the data for these hitboxes to use in my Java platformer game (I'm not using a pre-existing engine)

I have a single hitbox for the character working, but as I add animations with sprites of variable sizes, I need to move from a single static hitbox to something that fits the animation frames.

So far I've considered:

Manually picking position & size numbers for each frame, and typing them out in a text file like a JSON data structure asset to load into my game.

This works for short animations, but seems like it wouldn't scale to larger animation sets of 30-100 frames each.
Automated image segmentation with rectangles. I wrote an algorithm which divides the image into n rectangles with their transparent parts trimmed.

However, it is far from optimized, and may produce inappropriate results. It cannot be relied to automate the task.

What method can I use to create suitable hitboxes for a large number of animation frames?


texts: Mathematics behind Phong shading and additive blending

texts:
I'm confused about the mathematics behind additive blending used in conjunction with Phong shading. Intuitively, it seems like you would need to use a floating-point framebuffer and some sort of tone-mapping to achieve the actual approximation of many lights. Since the lighting values are computed as diffuse + specular, multiple lights can be encoded as:

finalColor = ambient
for light in lights:
  finalColor += light.specular + light.diffuse

Now, suppose you have multiple white lights shining on a perfectly diffuse, but mostly red sphere. The more lights you add, the closer the final rendered sphere should get to the actual color of the sphere. In this case, if you use an 8-bit RGBA framebuffer, then rendering with glBlend(GL_ONE, GL_ONE) will actually cause the sphere to reach a white color in the limit, similar to the effect outlined in this question.

My question is twofold:

Is my intuition here correct?
If so, how do you combat this situation? If not, why not?


texts: How can I instantiate my variables in Boo?

texts:
I have a Player Attributes class:

import UnityEngine

class Stat ():
    public current as int
    public max     as int

class PlayerAttributes ( MonoBehaviour ):
    public Name          as string
    public level         as int
    public hp            as Stat = Stat()
    public ep            as Stat = Stat()

public strength      as int   // How accurate and how much damage with melee attacks
public dexterity     as int   // How accurate and how much damage with ranged attacks
public vitality      as int   // How many hit points he has
public power         as int   // How much damage his energy attacks deal
public resistance    as int   // How much defense he has against energy attacks
public agility       as int
public speed         as int   // How fast character attacks

public meleeAtk      as int
public rangedAtk     as int
public defense       as int
public powerAtk      as int
public powerDef      as int
public initiative    as single

public exp         as Stat = Stat()

def SetInitialStats (
            name       as string,
            strength   as int,
            dexterity  as int,
            vitality   as int,
            power      as int,
            resistance as int,
            agility    as int,
            speed      as int,
            exp        as int
          ):
   self.level      = 1
   self.Name       = name
   self.strength   = strength
   self.dexterity  = dexterity
   self.vitality   = vitality
   self.power      = power
   self.resistance = resistance
   self.agility    = agility
   self.speed      = speed
   self.exp.max    = self.level * (self.level + 1) * 500
   AddExp(exp)

def AddExp ( experience as int ):
   exp.current += experience

   while exp.current >= exp.max and level < 99:
     exp.current -= exp.max
     exp.max      = level * (level + 1) * 500
     level       += 1
     IncreaseStats()

def IncreaseStats ():
   strength   += 1
   dexterity  += 1
   vitality   += 1
   power      += 1
   resistance += 1
   agility    += 1
   speed      += 1

   meleeAtk   = (level * 7) + strength
   rangedAtk  = (level * 7) + dexterity
   defense    = (level * 2) + agility
   powerAtk   = (level * 7) + power
   powerDef   = (level * 2) + resistance
   initiative = 20 + ((speed * level)/1500)

   hp.max     = ((level * 5) + vitality) * 10
   hp.current = hp.max

   ep.max       = ((level * 5) + power)
   ep.current = ep.max

Jut anything simple really. Well I read in the docs to not use constructors with MonoBehaviour, but I try instantiating my variables with the Start() function which is SetInitialStats (...)

So In another script in the Start() function I call it up like this

    Player = PlayerAttributes.SetInitialStats('Robo', 20, 21, 19, 20, 18, 22, 22, 57000)

I get the warning: ' An instance of type 'PlayerAttributes' is required to access non static member'

Not sure what else I can do to setup my beginning stats.

I got this to work I Unityscript which worked with a constructor without MonoBehaviour so I don't know where else to go from here. I would like to stay using Boo.


texts:
I'm looking for physics engines that doesn't use time steps. I don't think time steps are reliable, and I don't like how without tweaking the engine a bullet going too fast can pass through a wall without colliding it. Moreover I suspect they do a lot of unnecessary computations.

I thought of a physics engine concept where all the movements are represented by forces and movement beginning time. In such an environment as long as no event occur the engine would not do any computation.

I imagine the following:

I shoot a bullet in space, an object is created representing its physics properties.
The engine compare the bullet trajectory with other's to find if it's gonna collide with an other object.
It finds a collision, in 3 seconds.
An callback is programmed to trigger in 3s to process the collision.
In the meantime if no other event occur (like shooting an other bullet, changing an object trajectory, etc...) no other computation is done.

Does such an engine exists?
Is there a name to this technique?
Have you ever tried using this approach?


texts: Using multiple textures in Monogame HLSL Effect shader?

texts:
My Monogame HLSL shaders only successfully sample one texture (besides the screen). Any additional textures I try to sample end up with the same texture data as the screen.

I've found people with similar issues as me, such as this thread. However, I'm unsure of what they've done to remedy the problem. Any solutions I've seen in other threads don't work.

C#

Lighting.Parameters["NightTexture"].SetValue(night);
Lighting.Parameters["SunsetTexture"].SetValue(sunset);

HLSL

float4x4 World;
float4x4 View;
float4x4 Projection;

Texture2D NightTexture;
sampler2D NightSampler = sampler_state
{
    Texture = <NightTexture>;
};

Texture2D SunsetTexture;
sampler2D SunsetSampler = sampler_state
{
    Texture = <SunsetTexture>;
};

sampler TextureSampler : register(s0);

float4 main(float4 position : SV_Position, float4 color : COLOR0, float2
texCoord : TEXCOORD0) : COLOR0
{
    // Different Grading
    float4 day = tex2D(TextureSampler, texCoord);
    float4 night = tex2D(NightSampler, texCoord);
    float4 sunset = tex2D(SunsetSampler, texCoord);

    float4 col = lerp(day, night, .5);
    col = lerp(sunset, col, .5);

    return col;
}

technique Technique1
{
    pass Pass1
    {
        PixelShader = compile ps_5_0  main();
    }
}

Note: The code is abbreviated to show the issue. When executed, the SunsetTexture and TextureSampler both have correct data, but the NightTexture copies the TextureSampler's data.

Any ideas how to fix this?


texts: Can open source games be published on Steam?

texts:
Many free and open source software licenses have conditions in them that ban bundling it with proprietary modules, although, in case of the GPL at least, there are some exceptions for drivers and necessary libraries.

Can open source games be published on Steam without violating the licenses?

I know there are some free software available on Steam, such as Blender (using the GNU General Public License), the Godot engine (using the MIT license), and SuperTuxKart (which is currently in Steam Greenlight).

What permissive license is best for publishing on Steam?


texts: Get an exponential number between two numbers

texts:
Bit of a math question here...

lets say I want to supply a number (any number) and I want the result to be clamped between 0 and 1.

For instance, see the following graph.

Is there a way that when a number larger than 1 is supplied, that it returns a number that is still within those bounds (0 - 1), but still resulting in a number larger than any smaller supplied numbers that came before it (for instance, a supplied 2 would be a slightly larger number than a supplied 1.5)?

Thanks for your help!


texts:
I am trying to get a sprite to position itself at the center of the screen but nothing seems to be working for me.
I'm trying

Viewport viewport = graphics.GraphicsDevice.Viewport;
logoPosition = new Vector2((viewport.Width - towerImage.Width) / 2,
                           (viewport.Height - towerImage.Height) / 2);

and

spriteBatch.Draw(towerImage, centre, null, Color.White, 0, baseOrigin, 1.0f, SpriteEffects.None, 0);

This is my first time using XNA and I don't really have a clue what I'm doing.


texts: How can I make an movieclip move in a circular path with GTween? it's straightforward to have something move with various easing effects in a line or a curve, but I would need a complete circular path.


texts: Trouble with SAT style vector projection in C#/XNA

texts:
Simply put I'm having a hard time working out how to work with XNA's Vector2 types while maintaining spatial considerations. I'm working with separating axis theorem and trying to project vectors onto an arbitrary axis to check if those projections overlap, but the severe lack of XNA-specific help online combined with pseudo code everywhere that omits key parts of the algorithm, googling has left me little help.

I'm aware of HOW to project a vector, but the way that I know of doing it involves the two vectors starting from the same point. Particularly here:

http://www.metanetsoftware.com/technique/tutorialA.html

So let's say I have a simple rectangle, and I store each of its corners in a list of Vector2s. How would I go about projecting that onto an arbitrary axis? The crux of my problem is that taking the dot product of say, a vector2 of (1, 0) and a vector2 of (50, 50) won't get me the dot product I'm looking for.. or will it? Because that (50, 50) won't be the vector of the polygon's vertex but from whatever XNA calculates. It's getting the calculation from the right starting point that's throwing me off.

I'm sorry if this is unclear, but my brain is fried from trying to think about this. I need a better understanding of how XNA calculates Vector2s as actual vectors and not just as random points.


texts:
I struggle with efficiency in code, and I want to start my game off on the right foot.

I have a game that I'm making a 4 x 4 map of 'tiles' that a user can build their 'town' on.  To keep track of the tiles, I'm planning on simply having a size-16 array of the type of my 'mapTile' enum. EX:

enum MapTiles { defaultTile, homeBase, farm1, farm2 /*...and so on...*/ };
static MapTiles playerMap[] = MapTiles[16] { /* ... default map setup ... */ };

Is there a way that is more efficient or more easy-to-extend way to implement such a map?

I'm using Unity and C# mostly, though i'm willing to work with any Unity-capable language if you have a clever answer.


texts: how to change value of variable only once?

texts:
I am building simple platformer game in which the player hops on to platforms and the speed of platforms increase per time. This is an endless game and depends on the high score system.

But, the problem is whenever I change the speed of the platform it changes per frame and it increases like 0.1f, 0.2f, 0.3f, and so on.
For eg:- my default speed of platforms is 0.1f and whenever the player collides with that platform, I want it to change to 0.2f but since, I did this in update function in unity, it changes 0.1f ,0.2f,0.3f constantly.

My code is:-

public class destroyTime : MonoBehaviour {
    public float startTime = 3f;
public MoveTheTiles movethetiles;
    // Use this for initialization
    void Start () {

    }

    // Update is called once per frame
    void Update () {
        foreach (Transform child in transform) {
            if (child.tag == "Player" ) {
                startTime -= Time.deltaTime;
movethetiles.move += 0.1f;`//Problem is here!`
                if (startTime <= 0) {
                    startTime = 3f;
                    child.transform.parent = null;
                    Destroy (gameObject);
                }
            }
        }
    }
}


texts: How do I get the camera's local XYZ axis in Direct X 11?

texts:
I'm currently working on quaternion rotation and I have them working, but it seems to be using the world XYZ axis to rotate around, which is an issue as the camera rotates itself around an axis.

Similar to the last image, how do I rotate the camera around its local XYZ axis rather than the world XYZ?

Edit:

The camera now rotates around its local axis, but when doing so, it does not change its values in world space. I can hold a key down and it will rotate around the correct axis, but once I release the key it will snap back to its original position before the rotation began. What must I do to allow the local changes to be applied to world space?


texts: Is it possible to duplicate assets in AssetForge? For instance, if I build a house and want to duplicate the entire house to another spot with it.


texts: Phong shading blows out things close to white [OpenGL]; is there a way around this?

texts:
I'm doing per-pixel lighting using the Phong shading model.

In pseudo code this looks like:

vec4 ambientColor = light.ambientIntensity * material.diffuse;
vec4 diffuseColor = light.diffuseIntensity * material.diffuse;
vec4 specularColor = light.specularIntensity * material.specular;
finalColor = (ambientColor + diffuseColor + specularColor);

And you can add in a shadow map or light attenuation easily. Even color the light via the light.xIntensity values.

My problem is that I have a cloud texture that's all white values with varying levels of alpha. This is textured on a sphere. When rendering, what happens is that at the very appex of the light, i.e. the point closest to the light source the following seems to be happening:

When my light.ambientIntensity is at 0.2,0.2,0.2,0.2 I get an ambientColor on the whitest parts of the texture is say 0.2,0.2,0.2,0.2 and on the darkest parts of the texture could be 0.2,0.2,0.2,0.0.
With a light.diffuseIntensity of 1,1,1,1 I will get diffuseColor ranging from 0,0,0,0 (when we're nowhere near the light, i.e. the other side of the sphere) through to 1,1,1,1 when we're on the tip closest to the light and the diffuse color of the material is also full white.
I can skip specular here. Because the end result is now 1.2,1.2,1.2,1.2. The problem is that I'm now losing some detail because any values that should have been 0.8,0.8,0.8,0.8 are now full opaque white.

I understand that this would be desirable under some situations, like using HDR, but in this particular case it's not the result I want.

I'm using OpenGL 4.4 but I assume this problem and a solution is API agnostic.


texts:
I am having a little problem in my draughts game. Lets say my red piece (moving through AI) has arrived at the border of black pieces and now it has become a king, lets assume it is at index 2. Now when its next AI's turn, this piece moves to index 5, thats ok. But on next turn it moves to index 2 and then this transition between index 2 and 5 continues in every turn. I can't figure out whats wrong. I have revised my generate_moves() and it seems ok. Any idea what can be wrong? – My evaluation function is as follows:

public double Evaluation(int type, int aBoard[]) {

  double reds, blacks, ret=0.0;
  int loop;

  for(reds=blacks=loop=0;loop<32;loop++) {
    switch(aBoard[loop]) {
                case 2: //redKingType:
                  reds+=1;
                case 0://redType:
                  reds+=1;
                  break;
                case 3://blackKingType:
                  blacks+=1;
                case 1://blackType:
                  blacks+=1;
                  break;
                default:
                  break;
    }
  }
  switch(type) {
              case 0://redType:
              case 2://redKingType
                if(reds==0) {
                  return 0.0;
                }
                if(blacks==0) {
                  return 24.0;
                }
                ret=reds/blacks;
                    return ret;
              case 1://blackType
              case 3://blackKingType
                if(reds==0) {
                  return 24.0;
                }
                if(blacks==0) {
                  return 0.0;
                }
                ret=blacks/reds;
                   return ret;
              default:
                break;
  }

  return ret;
}

Note: I know this a very simple evaluation function ,but please consider the fact that I am doing this for the first time, under a hard  deadline.


texts:
I am attempting to create a simple 2d level editor using xna and winforms.

I have used the app hub win form samples as a starting point. At first I was having trouble with the mouse coordinates but after setting the mouse handle to the control,  it is working fine.

But now I want to implement scaling into the editor. I want the level editor to always be 720p. I have accomplished this by rendering to a render target set to 720 and then draw this using sprite batch to the back buffer. This also works great with letter boxing to keep the right ratio. I used the technique detailed here https://stackoverflow.com/questions/7591466/xna-resize-window-without-increasing-resolution.

However because of the letting boxing my mouse coordinates are now wrong again. Can someone help work out how to solve this? I tried getting the size of the letter box and subtracting that from the mouse coordinates but that didn't work.

Has anyone got any suggestions?


texts:
I recently tried out Swift. I found it to be awesome. But I'm unable to find any libraries for game development as I'm on Linux. Everything seems to be made for MacOS & iOS development.

There were one or two SDL bindings on Github. But they were not ready for 'public consumption' as listed on their pages. An option is to use Glfw. But then I would have to use OpenGL for everything.

Is there any game development library you know? Even simple to use graphics libraries will be helpful to me.

If possible, please make a list of useful gamedev related libraries you know of in Swift. Thanks!

EDIT: Please don't list MacOS only libraries. As I said before, I'm a Linux user and am looking for libraries that I can use on Linux.


texts: How does billboarding 3D sprites affect performance?

texts:
I was reading the Unity manual on trees and one of the claims made is as follows:

  Unity uses optimisations (eg, billboarding for distant trees) to maintain good rendering performance...

I was planning on doing my own billboarding for a game I'm building anyway, so knowing that I'm going to gain a performance advantage is good to know.  However, when I tried looking a little deeper at how billboarding is done in Unity, I found these sources:

http://wiki.unity3d.com/index.php?title=CameraFacingBillboard
http://answers.unity3d.com/questions/20697/how-to-create-billboarding-planes.html
http://answers.unity3d.com/questions/52656/how-i-can-create-an-sprite-that-always-look-at-the.html

Which all show that the way to do billboarding is to do a transform on the object each frame to make it face the camera. (I can't find much about billboarding in the official Unity documentation).

How does billboarding affect performance? Why would there be a performance boost if you have to transform "dense forests with thousands of trees" before each frame? Does unity have a native billboarding shader built in? If not, wouldn't billboarded sprites require, at the very least, the same amount of rendering power as other objects being drawn in a 3D scene?


texts: How to determine polygon based on point lists?

texts:
I have several lists of interconnected points. They are ordered so I can connect them together. Using these interconnected points I'd like to find the different points and intersection points that form a polygon. I imagine it's something often done in video game but I struggle to find a clear explanation.

Thanks for your help and guidance.

Original point set:

After having connected the points:

Desired polygon to find:


texts: Implementation details of Command Pattern in conjunction with Entity Component System

texts:
I have implemented an ECS where more or less an Entity is just an ID, a Component is just a wrapper for data, and a System holds the logic on operating over different components.
There is an Engine that has a list of the entities, a table of the components and a list of the different types of systems (update and draw systems).

I was working on handling input when I reached a conflict: how I would resolve opposing inputs (for example, pressing left and right at the same time). So I decided to try and implement the Command Pattern to work with the ECS.

But I'm stumped. I'm not sure how to create a command, let's say moveLeftCommand, without knowing the intimate details about each entity that would effect.
Also, since all my logic is in the systems, (if I understand the Command Pattern) it should have an execute function which will carry out the command. How do I populate the execute command if there isn't any logic that "belongs" to an entity?

Thanks for any help!


texts: How do I calculate an offset from an Object based on the Objects Rotation rather than the World Space

texts:
I have a Matrix of a player & I want to create a second location a set distance away from the first location but I want the second matrix to be set a set distance based on the rotation of the first matrix e.g. A player looking in a certain direction fires a gun, I want the bullet to start it's existence out side of the players mesh but in the direction the player is facing.

I've uploaded a video of what's happening:
http://www.youtube.com/watch?v=9aThUZ94Edo

Ideally I would like to just apply the players rotation Matrix to the Offset amount to get the proper offset Matrix, based in the world space co-ordinates to then be able to apply back to the object.

It's obvious at the end of the video that it's wrong when I am able to shoot the player model from his bullet :-)


texts: Which protocol should I use for a networked Pong clone?

texts:
I have to design a Pong game for Android. There are multiple mobiles and a game server. Application is installed in mobile. Mobile 1 (M1) can see the movement of bat and ball of mobile 2 (M2) an vice-versa.

Suppose if M1 hits the ball, all the movements of the ball and bat of M1 can be seen on M2's screen and vice-versa. Now I want to know which protocol I should use and why?

Edited:
how can a server take the initiative to send a message? What are the different methods to do this:  i.e. "push", other,...


texts: How to stop player falling through blocks without bounce

texts: So I have this game and I have applied gravity to it and when I load it up it just falls through the blocks and out of the screen. I have tried the bounce event but it just goes into an endless loop of bouncing.


texts: Pixel perfect clickable picture in OpenGL/C++

texts:
So I have a picture(for easier understanding of problem like this: http://www.lib.utexas.edu/maps/europe/europe_95.jpg).

My goal is to click on any of the countries and get what country I clicked. The picture is full of colors, not just simple lets say Germany is purple. Also if I hover above a country I could also do things, like highlight it, write some text in a bar, etc.

What solutions popped in my mind:

Draw every slice into a mesh, and ray trace the click. (making lots of meshes is a lot of time)
Draw a single quad with texture, make a pixelmap, and get the coordinates clicked, then look up in the table.(I have to make a map for every resolution)

Is there any better way of doing this? Or are there any algorithms for it?


texts: How do I select a portion of the window using Love2d

texts:
I want to be able to divide the window of the game in, lets say, 3 places, and when the mouse (or touch) click one of those places, execute some code.

Do I have to make each portion a button-like object? or is there a way for me to use love.mouse.getPosition() and give different instructions to specifics range of coordinates?


texts: How to achieve hologram projection effect with head tracking

texts:
I want to recreate this:
http://www.youtube.com/watch?v=9xMSGmjOZIg&feature=related

I can take care of tracking the user's head, and in one of the comments I believe the author says that he used a vertex shader to do the work, but what logic do you use to move the vertices to get this effect?


texts: How to do perspective projection “parallax” but without changing the scale or offset of objects?

texts:
Hello everyone I have this problem that I have tried everything I could think of. The problem: I am making a 2D game with parallax effect but I am using 3d space so am not simulating the parallax but letting the perspective projection take care of it for me. now the problem i have my own game editor where I design the levels, in this editor I use just images and I set a Z value for each layer. however I want the layers to show in the game engine exactly as I set them in the game editor, in short I want perspective projection to do parallax but without changing their scale or offset/position.

obvious solution is to scale them up and offset them but the problem how to calculate their offset? with scaling I tried object->Scale(object.Z/view.Z) and seems to return them to their real size but their positions are still wrong. I tried object->setPositionX(object->getPosition().x*(object.Z/view.Z)) and seems to be aligned except they all seems shifted.

I have tried unprojecting and tried to convert from world matrix to screen matrix and find some ratios and so on.

If anyone have any idea or anyway how this could be done in an elegant/mathematical way , I will be most grateful.

Thank you all in advance.


texts: Unity UI Buttons don't work when clicked, don't seem intractable at all

texts:
This is probably a quick and easy fix but I can't seem to get it.
As the title says I've got UI buttons which appear when my character dies, they used to work just fine but now suddenly when doing a full test through they don't seem to work. I've found similar posts where the solution was to disable / enable raycasts, that didn't help. Another user was missing an input module from the event system, mine seems to be there an in check.

The only significant change that I think will have affected my UI buttons was the addition of a joystick and another UI button, i thought perhaps they are blocking the older buttons but I've disabled the joystick and new button, that didn't help, even tried changing the zaxis, that didn't help too.

I'm honestly not sure how to go about testing something like this.

The UI overlay is my canvas, the GameOver object is disabled on start then enabled when the player dies, showing the Gameover text, Button quit and rety, these are the buttons that no longer work.

My button retry's settings, mostly unchanged honestly.

Thanks


texts: Issues with spine animation alpha in iOS

texts:
We are seeing a ton of artifacts and strangeness with alpha on iOS for our spine animation assets. You can see an example of one of these grid-like artifacts here, but we're also seeing pixelation etc.
Does anyone know why this is happening, whether we need to make adjustments or change certain settings to address this issue?


texts: Problems with imported model animation from Blender to Unity

texts:
I've downloaded a free sculpted arm and created my own rig and animation for it in Blender. So here is how it looks like in Blender :

And the model itself looks fine in Unity, but as soon as the animation starts, the vertices are partially glued together like this :

I've simply imported the .blend file for the moment, is there some better way to import this?


texts: What's the maths behind checking line of sight

texts:
I understand in unity there is Phsyics.LineCast(Vector A, VectorB). What's the maths behind doing that, the only thing i can think of is going along the line at small intervals and seeing whether it collides with an object or setting the line as a cuboid with a small width and height but depth equal to vector1-vector2 but then that would be non-axis aligned cuboid collision which seems pretty expensive.
Could anyone help me on this?
EDIT: I just want to know how to draw a line between two objects and see whether another object obstructs that line. That's it. Yes this is in DirectX.


texts: How to access an animation properties from the animator?

texts:
I'd like to change the property speed of an animation from the animator. For example, I'd like the player to be able to reload faster with upgrades. So I have a basic reload animation on the gun animator, and I would like to change its speed depending on the reload speed level the player has. But I can't find how to change this property in C#.

Here is what I have so far :

void Start() {
    gunAnim = gun.GetComponent<Animator> ();
}

void Update() {
    if (Input.GetKeyDown (KeyCode.R)) {
        gunAnim.Play("reload");
        reloadSound.Play();
    }
}


texts: Simple collision resolution in a platformer game

texts:
I want to make a 2d platformer with moving, jumping and wall sliding. How can I make a simple pleasant collision resolution system that works for the following rectangles.
Player is red, platform is black, I want to detect if the player is sliding a wall, or hitting the ground, or doing both ( as in third example). Also take the appropriate response.
Also I have no idea what I am talking about so a little context might help.
These resources helped me:
How to resolve collision:
2D AABBs and resolving multiple collisions
How to detect overlap between aabb vs aabb:
http://noonat.github.io/intersect/


texts: Unity WorldToViewportPoint not giving correct results

texts:
I have a script that places an UI element on the place where a 3d object is in 3d space. I do this in the following way:

public class test : MonoBehaviour {

public Camera MainC;
public GameObject testc;

// Use this for initialization
void Start () {
    var ui = Object.Instantiate((GameObject)Resources.Load("uit"), Vector2.zero, Quaternion.identity);
    ui.transform.SetParent(GameObject.FindObjectOfType<Canvas>().gameObject.transform, false);

    var vertexs = testc.GetComponent<MeshFilter>().mesh.vertices;
    var trs = testc.GetComponent<Transform>();
    var cdc = new Vector2(GameObject.FindObjectOfType<Canvas>().GetComponent<RectTransform>().sizeDelta.x , GameObject.FindObjectOfType<Canvas>().GetComponent<RectTransform>().sizeDelta.y);

    Object.Instantiate((GameObject)Resources.Load("pinksphere"), trs.transform.TransformPoint(vertexs[6]), Quaternion.identity); //bottomright
    Object.Instantiate((GameObject)Resources.Load("pinksphere"), trs.transform.TransformPoint(vertexs[5]), Quaternion.identity); //topleft

    var tl = MainC.WorldToViewportPoint(trs.transform.TransformPoint(vertexs[5]));

    var topleft = new Vector2(tl.x * cdc.x, tl.y * -(cdc.y) );
    ui.GetComponent<RectTransform>().anchoredPosition = topleft;
}

}

But this does not place the UI Element on the desired position. See the following images for more explaination.

in this case i want the TOPLEFT corner of the UI element to be ontop of the pink dot at the TOPLEFT of the whitecube. But as you can see the Y-axis doesnt quite match..

Some extra information about the conditions like canvas used and the prefab settings. See images below:

these are the canvas settings.

this are the Main Camera settings.

and this are the UI prefab settings.

If you need any more information or something isnt clear let me know so i can clarify!
the code is really inefficient and ugly but it is only for testing purposes :)


texts: How to get depth of vertex in 0 - 1 range

texts:
I want to get the depth of vertex in 0 to 1 range(like it done in the shader) and I do it like this

    D3DXVec3TransformCoord(&vertex, &vertex, &wvp);

depth = vertex.z;

It works(sometimes wrong) but when I write This

    if (depth > 1.0f || depth < 0.0f)return false;

Sometimes it returns false. How can I get correct depth for vertex in 0 to 1 range??

I want to compare two vertexes and select the nearest

EDIT

    wvp = worldmatrix*viewmatrix*projectionmatrix;

It works wrong when I zoom in


texts:
The bots have a simple Capsule collider which cannot tilt. Movement is applied across the horizontal axes, gravity is enabled on the rigidbody. It moves up stairs okay with steps roughly 0.2 units high. When the bots speed is too slow or he is moving up steep ramps he gets stuck. I've tried tinkering to fix the problem but to no avail.

    float gravity = currentMovementSpeed * 2f;
    Physics.gravity = new Vector3(0, -gravity, 0);

Here is the problem: https://youtu.be/ypCavT3_As0

What is a simple way to consistently force a collider up ramps and stairs?


texts: How do I clip an image in OpenGL ES on Android?

texts:
My game involves "wiping off" an image by touch:

After moving a finger over it, it looks like this:

At the moment, I'm implementing it with Canvas, like this:

9Paint pTouch;
9int X = 100;
9int Y = 100;
9Bitmap overlay;
9Canvas c2;
9Rect dest;

    pTouch = new Paint(Paint.ANTI_ALIAS_FLAG);
    pTouch.setXfermode(new PorterDuffXfermode(Mode.SRC_OUT));
    pTouch.setColor(Color.TRANSPARENT);
    pTouch.setMaskFilter(new BlurMaskFilter(15, Blur.NORMAL));

    overlay = BitmapFactory.decodeResource(getResources(),R.drawable.wraith_spell).copy(Config.ARGB_8888, true);

    c2 = new Canvas(overlay);

    dest = new Rect(0, 0, getWidth(), getHeight());
    Paint paint = new Paint();9
    paint.setFilterBitmap(true);

    ...

    @Override
    protected void onDraw(Canvas canvas) {
        ...

        c2.drawCircle(X, Y, 80, pTouch);
        canvas.drawBitmap(overlay, 0, 0, null);

        ...
    }

    @Override
9public boolean onTouchEvent(MotionEvent event) {

        switch (event.getAction()) {
            case MotionEvent.ACTION_DOWN:
            case MotionEvent.ACTION_MOVE: {
                X = (int) event.getX();
                Y = (int) event.getY();9
                invalidate();
                c2.drawCircle(X, Y, 80, pTouch);9
                break;
            }
        }
return true;
...

What I'm essentially doing is drawing transparency onto the canvas, over the red ball image.

Canvas and Bitmap feel old... Surely there is a way to do something similar with OpenGL ES. What is it called? How do I use it?

[EDIT]

I found that if I draw an image and above new image with alpha 0, it goes to be transparent, maybe that direction?

Something like:

gl.glColor4f(0.0f, 0.0f, 0.0f, 0.01f);


texts: How to build an iPad game without an Apple device?

texts:
I am an experienced PC/mobile app developer trying to build an iPad app but I don't have access to a physical device. I have a PC and an Android phone (whatever good that is!)

The app is essentially a conversion of a Flash-based software. I'm going to use Adobe AIR to target the iPhone/iPad (Adobe has built support for this natively). I have build an Android app using this process and it has been seamless. Since I'm not going to use XCode (unless needed) and Adobe has an iPhone Simulator integration.

Is there any way I can build an iPad app without a physical iPad/iPhone device? Are there emulators on the PC/MacOSX side that I could use and would I be able to build a functioning app?

What I can do:

Install MacOSX on my Windows machine and turn it into a Hackintosh. Nothing wierd here, it would work like a normal mac and support XCode and everything.
Build the app in Adobe AIR or XCode
Test on a iPad/iPhone Emulator on my Hackintosh or PC

In the worst case I'll have to:

Spend like $400 or whatever and buy a physical iPad/iPhone.
Borrow an apple device from a friend.


texts: Changing texture offset in unity by script

texts: I am trying to change texture offset in a material by a script to create a parallax effect, but it doesn't move a bit no matter what I am trying. Any tips for this case? Or am I missing something?


texts: Separating logic/update from render/drawing code in a single thread using sleep

texts:
I've read that the speed of game objects should not be hindered by FPS but instead should be based on time. How can I seperate the update/draw code to maximize performance without limiting the drawing rate and provide a constant logic update rate based on time?

My current pseudo code is as follows

loop
{
    draw();
    if (ticksElapsed() > 100)
    {
        update();
        ticks+= ticksElapsed();
    }
}

The problem is the drawing code hinders the performance of the update() rate. And it consumes 100% cpu because if sleep is thrown in, it throws off both drawing/logic functions.

I am also using SDL and it doesn't seem to have a vsync option. I've also heard of the terms fixed and variable time-stepping however I'm not sure how that can be done with sleep()


texts: C# - Monogame- Collision Detection Sprite walking through platforms

texts:
I am blanking on the logic here. How do I get it so that my sprite doesn't run through a block. It only repels if the center of the player sprite is higher than the bottom of the block.

But when it is lower, it walks right through. It gets lower because my jump function or my grounded function is a bit funky. Anyway, how do I get it so that a player can't go underneath a block unless the sprite is not touching the block at all.

Here is the collision code in my player class, the one that does the collision detection.

public void checkYCollisions(block[] platforms)
    {

        if (position.Y > 700)//this is my ground with no blocks.
            grounded = true;
        else
            grounded = false;

        float Xradius = Width / 2;
        float Yradius = Height / 2;
        block collidedPlatform = null;
        List<block> collidedBlocks = new List<block>();

        foreach (block p in platforms)
        {
            if ((position.X > (p.position.X - p.Width / 2 - Xradius )) &&
                (position.X < (p.position.X + p.Width / 2 + Xradius )) &&
               (position.Y > (p.position.Y - p.Height / 2 - Yradius  )) &&//on top
                (position.Y < (p.position.Y + p.Height / 2 + Yradius   )))//below

            {
                collidedBlocks.Add(p);

            }
        }
        //collisions work for all side of blocks.
        foreach (block p in collidedBlocks)
        {
            if (p != null)
            {
                if ((position.Y <
                    (p.position.Y - p.Height / 2 /*+ radius*/)))//landing on a block
                {

                    grounded = true;

                }

                else if ((position.Y >
                    (p.position.Y + p.Height / 2 /*- Yradius*/))) //jumping up into a block
                {
                    if (y_vel < 0)
                        y_vel *= -1;
                    //player1.direction.Y = -1.0f * player1.direction.Y;
                }

                 else if ((position.X <
                (p.position.X + p.Width / 1.5 /*+ Xradius*/))) // one of the sides
                 {
                     x_vel *= -2;
                 }

                 else if ((position.X >
                     (p.position.X - p.Width / 1.5 /*+ Xradius*/))) // other side
                 {
                     x_vel *= -2;
                 }

            }
        }
    }

Note that I have tried to remove YRadius in the the if loops at separate occurences, and it works to no avail because my guy will not hit the ceiling.


texts: Algorithm for fitting geometrical 2d shapes like in the android game Six! (or Tetris)?

texts:
In the game Six!, there's a perfectly rectangular tower of geometrical 2d shapes, that you destroy on tap to reach the ground with your player. The easy way would be to design the levels by hand. However, I wondered how to do this with an algorithm, so that you save a lot of time? Any idea?

I use the Godot Engine 3.0, fyi.


texts: How to initiate manually an animation in Unity?

texts:
I have a prefab and I want to control when an animation is initiated. I can't seem to figure out how to do that. I have already created the animation clip, the animator component for the prefab, and the animator controller. The animation works, when I enter play mode in the unity editor (it plays automatically), but I want to control when the animation occurs when providing input (such as pressing on the space bar or clicking on the prefab).

How would I go about doing that?


texts: Formula to measure uv-mapping distortion

texts:
Does anyone know a simple way of calculating (offline) the amount a texture is distorted when mapped to a triangle like the following?

Vertex   Position       UV Coordinates
A        (Ax, Ay, Az)   (Au, Av)
B        (Bx, By, Bz)   (Bu, Bv)
C        (Cx, Cy, Cz)   (Cu, Cv)

I'm expecting two outputs: one scaling factor along each of two perpendicular axes. (These axes may or may not align with the u and v coordinate axes, eg. for a texture that has been stretched diagonally)

For my present purposes I don't need to know the direction of the stretch/compression, just how much of it there is. I do not want a single area scaling factor, because a stretch in one direction plus a compression in the other could cancel out to give a result that is close to equal-area but far from undistorted.

I think I can get this by computing a matrix that maps (Bxyz - Axyz) onto ((Buv - Auv), 0) & (Cxyz - Axyz) onto ((Cuv - Auv), 0) (and the triangle normal onto (0,0,1)), then finding its eigenvalues, but it seems like this should simplify or offer some shortcut. Working out all the intermediates on paper gets pretty hairy.

My searches so far are returning a lot of advice on subjectively dealing with distortion using 3D modelling packages, not analytical methods for measuring distortion.


texts: Multiple render targets and gamma correctness in Direct3D9

texts:
Let's say in a deferred renderer when building your G-Buffer you're going to render texture color, normals, depth and whatever else to your multiple render targets at once.

Now if you want to have a gamma-correct rendering pipeline and you use regular sRGB textures as well as rendertargets, you'll need to apply some conversions along the way, because your filtering, sampling and calculations should happen in linear space, not sRGB space. Of course, you could store linear color in your textures and rendertargets, but this might very well introduce bad precision and banding issues.

Reading from sRGB textures is easy: just set SRGBTexture = true; in your texture sampler in your HLSL effect code and the hardware does the conversion sRGB->linear for you.

Writing to an sRGB rendertarget is theoretically easy, too: just set SRGBWriteEnable = true; in your effect pass in HLSL and your linear colors will be converted to sRGB space automatically.

But how does this work with multiple rendertargets?
I only want to do these corrections to the color textures and rendertarget, not to the normals, depth, specularity or whatever else I'll be rendering to my G-Buffer. Ok, so I just don't apply SRGBTexture = true; to my non-color textures, but when using SRGBWriteEnable = true; I'll do a gamma correction to all the values I write out to my rendertargets, no matter what I actually store there.

I found some info on gamma over at Microsoft:
http://msdn.microsoft.com/en-us/library/windows/desktop/bb173460%28v=vs.85%29.aspx

  For hardware that supports Multiple Render Targets (Direct3D 9) or Multiple-element Textures (Direct3D 9), only the first render target or element is written.

If I understand correctly, SRGBWriteEnable should only be applied to the first rendertarget, but according to my tests it doesn't and is used for all rendertargets instead.

Now the only alternative seems to be to handle these corrections manually in my shader and only correct the actual color output, but I'm not totally sure, that this'll not have any negative impact on color correctness. E.g. if the GPU does any blending or filtering or multisampling after the Linear->sRGB conversion...

Do I even need gamma correction in this case, if I'm just writing texture color without lighting to my rendertarget? As far as I know, I DO need it because of the texture filtering and mip sampling happening in sRGB space instead, if I don't correct for it.

Anyway, it'd be interesting to hear other people's solutions or thoughts about this.


texts: Shared data in multithreaded pathfinding engine

texts:
Imagine a case where you have lots agents in a big world, who frequently need to calculate the shortest/best path from A to B. In this case it seems natural for me to create a pathfinding engine where each path request is performed in a separate thread. Similar to this example.
Requests are stored in a queue, and when there are available threads to perform calculation the request will be taken from the queue and finally moved to a collection of calculated paths.
My problem is: how do you store and update the data that will be shared among all the threads? The threads needs access to some kind of map structure (could be a 2D array), and his data needs to be updated frequently. Using some kind of synchronisation mechanism would be too expensive, since we have several threads frequently reading from the data.
I have come up with two suggestions:

Store the map structure as an array of atomics. This seems like a simple and effective solution, however we will give ourself a limitation: we can only use data that can be stored as an atomic type - which in most cases should be OK.
Create two buffers containing a copy of the data, and keep a reference count for how many threads are currently using the buffer. First update buffer A, then for each new path request we let the thread read from buffer A. When there are no more threads accessing buffer B (RefCount==0) update buffer B and set it as the new active buffer. With this solution we can use any kind of data structure, but it will (depending on the calculation time) be slightly out of sync - which I believe should not be a big problem for pathfinding. If the calculations take a long time, it will be out of sync anyway.

What are your thoughts? I don't have too much experience in the field, so I'm not sure if there are any "popular" solutions to this problem.
Edit
This is what I ended up with (after reading Kromster's answer):

Update the data
Take requests out from the queue and start a thread for each request.
For each frame: check if all threads have finished.
When all threads are done, go back to step 1.

At step 1, all worker threads are idle.
When an agent needs to get a path from A to B, it will call requestPath(from, to), which will return a unique ticket. The ticket has an atomic(modified by pathfinder thread, accessed by agent) indicating whether it is valid or not. When the path has been caluclated, the ticket becomes valid and the agent can call getPath(ticket) to get the path.


texts:
I'm struggling with Mecanim.

My concern is to blend straight/turning animations with strafe animation for a humanoid character.

I downloaded a SampleAsset from unity and took Ethan character as example. The animator uses a blendtree which naturally blend idle/walking/running animations with a smooth turning left/right animations. In this case the Ethan character cannot strafe.

I'm trying to understand how to blend strafe movement with it's actual straight/turning blending motion.

Was I somewhat clear?


texts: OpenGL: Resizing Display and glOrtho/glViewport

texts:
I have researched this question from several sources and have yet to find a firm answer saying that "yes that is correct thinking" or "no, here is how it's done."

I am trying to ensure resolution independence with OpenGL rendering. The way I think I should go about it, is to create a projection using glOrtho with whatever I want the world coordinates to be. For example, glOrtho(-50.0, 50.0, -50.0, 50.0, 1.0, -1.0).  Next, set the viewport to the screen resolution, i.e. - glViewport(0, 0, 800, 600). Finally, whenever the window is re-sized, make a call to glViewport with the updated screen resolution. This will scale your figures.

Is this the correct way to ensure that models take the same proportion of screen-space on different resolutions? Should I be using a projection equal to the resolution as well? I found some answers saying glOrtho should use the resolution of your window while others said it should/can be different.

Thoughts?


texts: How do I create a toggle button in Unity Inspector?

texts:
I want to create a tool similar to Unity's Terrain tool, which has some nice toggle buttons in the inspector:

How can I achieve similar design to this? I know how to create normal buttons and other UI components in the inspector, but I can not find enough information to make the buttons toggle.

So far I have used normal toggles that produce a checkbox:

var tmp = EditorGUILayout.Toggle( SetAmountFieldContent, _setValue );

if ( tmp != _setValue )
{
  _setValue = tmp;
  if ( _setValue )
    _smoothValue = false;
}

tmp = EditorGUILayout.Toggle( SmoothValueFieldContent, _smoothValue );

if ( tmp != _smoothValue )
{
  _smoothValue = tmp;
  if ( _smoothValue )
    _setValue = false;
}

Setting the toggle GUIStyle to "Button" does not produce the wanted result. The text or image content goes on left of the button instead of inside.

var tmp = EditorGUILayout.Toggle( SetAmountFieldContent, _setValue, "Button" );

Also none of the options found in GUISkin does not seem to help.


texts:
I am writing a program, that as input, I have a huge (10^6 elements) 3d mesh (with hexagonal shaped elements), and I want to realtime render it, but not as real-time as a game. It just can show the scene and rotate, zoom and pan. The most important point is, I don't need any special lighting nor any shadows. Also, the objects to render are static, and they do not move. My object hasn't any textures.

I've read about ray tracing methods, but I don't know if there is any good libraries for this purpose, or I have to implement everything by myself.

Thanks a lot.


texts: XNA Monogame GameState Management not deserilaizing

texts:
I am having some trouble serializing/deserializing in a little game I am doing to teach myself monogame.

Basically, I am using the gamestatemnanagement resources common to monogame (screen manager etc). Then I am serializing my screen manager component and all associated screens in the OnDeactivated method:

 protected override void OnDeactivated(Object sender, EventArgs args)
    {
        foreach (GameplayScreen screen in mScreenManager.GetScreens())
        {
            DataManager.SaveData(screen.Level.LevelData);
        }
        mScreenManager.SerializeState();
    }

The Save data bit is to do with something else.

Then I then override OnActivated to de serialize

    protected override void OnActivated(Object sender, EventArgs args)
    {
        //System.Diagnostics.Debug.WriteLine("here activating");
        mScreenManager.DeserializeState();
    }

However, when this runs it just loads a blank screen - it goes into the game initialize and the game draw method, but doesnt go down into the screens initialize or draw methods.

I have no idea why this might be - any help would be greatly appreciated. I am not the only one who has encountered this - I found this post also - https://monogame.codeplex.com/discussions/391117


texts: Dynamic Flow Control in HLSL with Array References

texts:
I'm trying to do lighting calculations for an array of point lights in HLSL. I simply want to pass light direction vectors from the vertex shader to the pixel shader. Here is sample code:

static const int MAXLIGHTS = 8;
float4 g_vLightPosition[MAXLIGHTS];
float4x4 mW : WorldTransform; // model to world
float4x4 mV : ViewTransform; // world to view
float4x4 mP : ProjectionTransform; // view to project

void VS_Lighting( in float4 PositionMS : POSITION0,
out float4 PositionCS : POSITION0,
out float4 Texcoord[MAXLIGHTS] : TEXCOORD )
{
    // view-projection
    float4x4 mVP = mul(mV, mP);

    // world position
    float4 vPosWS = mul(PositionMS, mW);

    // clip space pos
    PositionCS = mul(vPosWS, mVP);

    // compute light direction vectors
    for(int i = 0; i < g_nLightCount && i < MAXLIGHTS; ++i)
    {
        Texcoord[i].xyz = g_vLightPosition[i] - vPosWS;
    }
}

The above code forces the loop to unroll and gives the following warning:

  warning X3550: array reference cannot be used as an l-value;
  not natively addressable, forcing loop to unroll

I would like for this code to be dynamic so as to reduce the instruction count. I understand that the problem is accessing the array in the loop. How can I rewrite this code to prevent unrolling during compilation? I am using ps 2.0 or 3.0.


texts: Common mistakes when developing a game with Socket.io and Node.js

texts: I am not a game developer by trade but am working on a card game (that is real time, not turn based).  I was wondering what the common mistakes are that people make when new to this sort of development so that I can avoid them!


texts:
I want to create a multiplayer game with HTML/JavaScript and only send user input between players. I read some articles for C++, saying that I could not expect floating point to get the same results on different binaries/machines. I expect the situation to be no better in JavaScript.

Do I need to use fixed point? Assuming fixed point is the way, can I calculate e.g. (estimated reciprocal) square roots using floating point functions exposed thru JavaScript, and then apply something akin to rounding to get determinism?


texts: Setting Camera's Viewing parameters manually

texts:
I am working on Context-aware camera in Unity. in this project i have to set parameters of the camera each frame manually depending on what camera sees on the screen. New View (v) direction is given and Up (u) and Right (r) vectors should be such that they minimize torsion with previous frame's u and r. I have deployed the following code to accomplish the given task:

 Vector3 viewNew = -m_Normal;
 Vector3upNew=Vector3.Cross(viewNew,m_CameraPrevTransform.right).normalized;
 Vector3 rightNew = Vector3.Cross(viewNew, upNew).normalized;
         ...
 transform.forward = viewNew;
 transform.up = upNew;
 transform.right = rightNew;

The problem is: it seems like Unity tries to automatically adjust parameters when one of the directions (up, forward, right ) are set. Is there a workaround ? is it possible to get more control of the camera?


texts: Dragging an object and moving it back to it's original position on release?

texts:
I'm making a small game, and I'm trying to add this mechanic where if you click on an object and move it, then you release the object it will snap back to it's original position. Currently, each object has a Vector2f, and I'd prefer that when you release it, it eases back to it's position, is this possible? I've tried to use atan2, but it doesn't work, since it only calculates an angle then keeps moving towards the angle, and doesn't stop.

Here's the code I have for it so far. When the object is released, the initialPosition Vector2f is set to the position that the object is released.

if (moveBack) {
    float angle = (float) Math.atan2(position.y - initialPosition.y, position.x - initialPosition.x);
    position.x += Math.sin(Math.toRadians(angle));
    position.y += Math.cos(Math.toRadians(angle));
}


texts: Where can I find the library for org.newdawn.slick.opengl.Texture

texts:
I started making a game in Java, and someone on stackoverflow recommended me LWJGL.
I found some examples, and they worked. Later I wanted to test sprites and every example that I found that loads images imports org.newdawn.slick.opengl.Texture. I can't find that library anywhere. Is there a better alternative, or where can I find this one?


texts: writing problems with MonoDevelop of Unity 3D

texts:
MonoDevelop was automatically installed by UnityHub.
The text editor poses a lot of problems because you can not insert a specific character
(I position myself, the positioning is not famous and when I insert, it erases the following characters!)

Is there any way to fix this editing problem?
Or
should I install another version of MonoDevelop? If yes, I downloaded his msi file but after I do not know how to install it on my installed Unity

Thank you for your help


texts:
I have a bunch of coplanar points, who sit on plane P. I want to translate the plane to Q with the points upon. Here is what I do:

I take three points from P, say a, b, c. Their centroid is denoted by c(a,b,c).

I pick the local origin as O = c(a,b,c) and local XYZ as:

x = normalize(Oa);
v = normalize(Ob);
z = x.crossProduct(v);
y = x.crossProduct(z);

I apply the same method to their global coordinates on Q, which are d, e, f.

O_ = c(d,e,f);
x_ = normalize(Od);
v_ = normalize(Oe);
z_ = x_.crossProduct(v_);
y_ = x_.crossproduct(z_);

Then, I use the transformation matrix as follows:

Matrix input = [x,y,z];
Matrix output = [x_,y_,z_];
Matrix T = output.multiply(input.transpose());

After this step, I multiply the coordinates of a point p that sit in plane P with matrix T. Of course, before that, I take the vector difference p - O.
The result should be the transformed point minus target origin (q - O_).

Hence, for each p in P, I transform p to its place in Q, which is denoted by q using the following computation:

q = T.multiply(p.subtract(O)).add(O_);

But what I get is, the reflection of the points through an imaginary (I don't know which) axis.

Am I missing some step? Is there a wrong computation?


texts:
I would like to clip a triangle if its bounds lie partially out of a cube. I guess I would need some kind of Triangle Plane intersection code - I'm not well versed with math but I do have the points of the triangle in 3d space (P1, P2, P3).

How do I get the 2 points of intersection of the triangle with one of the planes of the cube?


texts: How to remove a circular dependency as pointed out in a libgdx tutorial

texts:
In this libgdx tutorial, the author says he's not happy with the circular dependency between the game and the screens.

How can this diagram:

be improved to remove that dependency?


texts: How to determine character's foot contact point on a uniform triangle mesh terrain?

texts:
For a terrain that is modelled by a heightmap with a uniform triangle mesh, what are some techniques I could use to determine the contact point of the foot of a character standing on the terrain?

Since the terrain's Y values are altered by the heightmap, they won't be flat any more. As the character moves on the terrain, it has to know at which values of Y-value its foot should be. Conceptually, what are some methods and techniques to determine the contact point of the character's foot standing on the terrain?


texts: How to Enable NVIDIA Ambient Occlusion in my Game

texts:
I have a DirectX11 based game, and I want to enable NVIDIA's built in Ambient Occlusion (that is shown in the NVIDIA control panel, but it grayed out for my application).  Is that possible?  Or do I need to be a big time developer and arrange something special with NVIDIA to get their ambient occlusion to work with my game?

Here is what happens when attempt to enable ambient occlusion in my application:

I've searched and found that sometimes you can override the "not supported" message through the use of an NVIDIA inpector tool, however it looks like the override is only for specific games as shown below:

So my conclusion is either NVIDIA has to enable it somehow, or my game must render in a very specific way, which NVIDIA can pick up on and insert its ambient occlusion calculations into my scene.  Is there any documentation of how this works online, or has anyone gotten NVIDIA's ambient occlusion to work for an application they wrote?


texts: What are good ways to model environment radiance (not irradiance)?

texts:
I'm trying to compile a list with relevant techniques in game development to model scene radiance.
The (probably obvious) candidates I have so far is:

Discreet light source objects in the scene (point ligts, directional lights, area lights etc)
spherical [HDR] bitmap data (mapped to the sphere in various ways. long lat, cube map, oct map etc.)
spherical harmonics
halfspherical harmonics

What other relevant techniques are there to model radiance (not irradiance)?


texts: How to get dynamic RigidBody rotation/tilt on uneven platform?

texts:
I have a rigid body with PolygonCollider2D which has some complex circular shape and I'm using uneven platform.

Im using Following code to move the object forward

CharacterRigidBody.velocity = new Vector2 (speed, CharacterRigidBody.velocity.y);

Problem : The rigid body keeps on rotating when it moves forward.

I want the character to move without rotation on asymmetrical  platform(above).But i don't want to freeze rotation because i want the character to tilt when climbing or decending platform.

My RigidBody2D config(I'm using unity 5.1.2)

Can collider do anything with this problem?


texts: Creating and connecting rooms for a roguelike

texts:
I'm creating a Roguelike and I'm having constant troubles with map generation, it's just something I have a lot of difficulty wrapping my head around.

I currently have my map as a 50x50 square of tiles, which is then cut up into a 6x6 grid. The grid resembles as follows

+---+---+---+----+----+----+
| 1 | 2 | 3 | 4  | 5  | 6  |
+---+---+---+----+----+----+
| 7 | 8 | 9 | 10 | 11 | 12 |
+---+---+---+----+----+----+

etc etc up to 36. I can generate perfectly an identical room into each of these map sections but what I'm actually concerned about is filling a small number of them and connecting them.

Is there a known approach to this? Currently what I'm doing is just looping through the sections, taking a 50/50 coin toss and making a room there but I'm unsure how I can tell where to make paths, what if I have my map set out as follows

+---+---+---+----+----+----+
| 4 |   |   | 1  |    |    |
+---+---+---+----+----+----+
|   |   |   |    | 2  |    |
+---+---+---+----+----+----+
|   |   | 3 |    |    |    |
+---+---+---+----+----+----+

How do I intelligently map between 1 and 2? How do I map between 2 and 3, much less how do I map between 3 and 4?

I'm very new to game development, so please excuse me if this is a silly question


texts: Everything turning black when pitching down

texts:
Just a quick questions about something that's occurring in my world. Every time I pitch my camera downward, everything starts turning black, and if I pitch upward, everything sort of intensifies.

I'm multiplying my normals by the normal matrix in the shader, and I'm multiplying my lights direction by the model view matrix.

If I leave the normal and light dir in world space everything ends up fine.

I thought putting them both in view space would not cause those weird things to happen?


texts: How should loot be distributed across dungeon levels?

texts:
I am making a dungeon crawler; as the player character adventures down through increasingly difficult floors of a dungeon, they collect more valuable treasure.

What is a good algorithm to determine the distribution of treasure? Should each potential item be given a range from one to a million and then be rolled for, or should multiple dice with special value be rolled and an item constituted that way?

For this example there can be an infinitely varied assortment of randomly generated items.


texts: Create a white background for the texture and then blend using GLSL

texts:
I have a transparent png texture and I'd like to create a white background and then blend this on top of that. Is this possible using just GLSL? I can't multiply, add or mix colors because I don't want to overlay the color white. I want it to be in the background of the texture.

I can achieve what I want by creating 2 objects with the exact same dimensions and position, set the color of the object behind to white and the object in the front to the transparent texture. But this seems less than ideal to me.

Any suggestions will be much appreciated!


texts:
I have several mountain models drawing in the background.
See actual screenshot here:

At the very back, you see those grey mountains. Although they are so much in background, it still doesn't seem "in the background".

How can I add a feel of depth to those mountains? I would like see them as far far away.

This is how it looks now, thanks to DarenW


texts: Spawn Array of GameObjects to Array of Transforms

texts:
I have a question regarding spawning an array of GameObjects in Unity. What I want to happen is that when a big enemy dies, it will spawn enemies into their respective Transform positions (i.e., Enemy 1 will spawn in Position 1, Enemy 2 in position 2, and so on).

I suppose I could go on with something like:

// C#

public GameObject[] Enemies;
public Transform[] SpawnPoints;

void KillEnemy()
{
    GameObject enemy1 = Instantiate(Enemies[0], SpawnPoints[0].position, SpawnPoints[0].rotation;
    GameObject enemy2 = Instantiate(Enemies[1], SpawnPoints[1].position, SpawnPoints[1].rotation;
    GameObject enemy3 = Instantiate(Enemies[2], SpawnPoints[2].position, SpawnPoints[2].rotation;

    Destroy(gameObject)
}

But the problems are:
1. I'm aware that the code is expensive to run, especially since I'm doing a 2D game; and
2. It provides no flexibility, meaning if I want a different enemy to use the same code, then I won't be able to do stuff like adding more enemies to spawn (after the first one dies, of course).

So yeah, I hope I get some help with this. Thanks!


texts: Simplistic level system (Math reliant question)

texts:
So I've been checking some games to get ideas for my own. Some designs I've reviewed rely on a few variables like:

Current level
Current exp
Exp to next level

I aim for a simplistic design where there is only an exp variable.

Example:

  Level 1

  Current exp: 0

  Exp to next level: 100

  Level 2

  Current exp: 100

  Exp to next level: 200

  Level 3

  Current exp: 200

  Exp to next level: 400

  Level 4

  Current exp: 400

  Exp to next level: 800

Every level, the exp required for next level doubles.

That's okay. Since I use only an exp variable, I need two formulas:

Formula to calculate the current level
Formula to calculate the exp required for next level

My progress so far:

  Level = floor((exp + 100)/100)

This works for 0 exp (level 1) because floor(0 + 100)/100 equals 1, with 50 exp works fine too:

50 + 100 = 150
150/100
1.5
flooring 1,5 gets us to 1

If we hit 100 exp, we should be now at level 2.

floor((100+100)/100) = 2

Let's see level three.

floor((100 + 200)/100) = 3

Since level 3 is at least 200 exp, this thing keeps working.

Level 4 begins with 400 exp.

Let's see what happens if we have 399 exp.
399 + 100
499/100 = 4.9
floor(4.9)
4

No way. 399 should still be level 3.

So let's take into account the doubling factor.

Level = floor((exp + 100)/100)/2

399 + 100 = 499... / 100 = 4.99 .. floored -> 4 / 2 = 2

Level 2? No way , it should be level 3

Another try:

Level = floor((exp/100))

floor(399/100) = 3
floor(400/100) = 4

But if we apply the formula to level 2(starting at 100, ending at 200 which would be level 3)

floor(100/100) = 1

I can't seem to achieve this on my own. Any suggestions?


texts: Why do Physics Engines use collision margins?

texts:
When using a physics engine in a game (such as Bullet), you usually need to define a collision margin for each object. I'm a beginner to game development, and I don't understand the purpose of a collision margin.

My basic understanding is that if you were to have two objects, each with a collision margin set to 0.01, then a collision would be detected when the two collision margins touch each other, such that the gap between the two objects is actually 0.02.

But why not just set the collision margin to 0, and cause a collision to be detected when the actual surfaces of the two objects collide? This is how physics works in reality.

One guess is the following. If a cube has a margin of 0.01, then a collision will be detected whenever a part of another object exists between 0 and 0.01 from the object's surface. This gives the simulation room for error, such that if it "misses" the point when the object passes the cube's collision margin (because the simulation step is long), then it still has time to detect a collision as the object then moves closer towards the cube's surface, within the 0.01 margin. Otherwise, if the margins are zero and a collision is missed by the simulation, you might get a situation where two solid bodies occupy the same space, which could cause problems.

Is this guess correct? Or is there another reason?

Thanks!


texts: Benefits of attending highly selective colleges

texts:
I live in a pretty high-income community where teachers and parents tell you that if you ever hope to have a good income, you have to go to a good, selective college. However I'm one of the few kids at my school who has developed a love for programming software (and games on occasion), and I've never had a teacher that's even understood computers; so I'm wondering if this statement is true for this the software profession as well.

How much of a difference does attending a highly selective, generic school make when entering the software or game development profession?

I've also found that almost any and all information on software development can be found on the internet or in a book. Which makes college almost seem unnecessary.

How important is it to go to college at all when entering these professions
or starting your own software or game company?

please try and give sources of information =)
Thanks


texts: How can I fix texture clipping in Unreal 4?

texts:
I made a small project testing out mini-maps, it worked fine, I left it alone for a few months and reopened the project, and now I'm getting this:

I'm not even sure what to call this kind of issue other than clipping.

Also note, a sprite representing the player model is supposed to be at the center of the mini-map, but now it doesn't show. I hadn't made any changes to the project since I last worked on it, and when I check the camera I'm using for the mini-map, the pointer is definitely visible in the Blueprint. The project was made in 4.13.

Though as I took that screenshot, everything else that should be visible disappeared, so the mini-map no longer is showing the floors and walls. This feels like a graphics problem. Anyone know where I can start fixing this?

SOLVED: It was a rendering/shader problem. Project settings > platform > mac > rendering > Max Metal Shader Standard to Target = "Metal v1.1"


texts:
I just updated my Unity from 4.3.3 to 4.3.4 and there is something very wrong with the Property Inspector window.
I tried restarting Unity, as well as load a different project, but neither fixed it.

This is what it looks like with a shader selected:

Even an empty folder looks corrupt:

Is this a known issue and is there a way to fix this?
Update1: I did a complete reinstall of 4.3.3 and the problem remained, now I am really confused.


texts: I plan to use UDK on PC to create commercial game. Can I use deferred rendering in UDK? Or it's only available with expensive UE3 license?


texts: Going up and down stairs by Unity3d's NavMesh

texts:
*Purpose
I want to create a navigation mesh that is optimized for going up and down stairs and stopping.
*Question
I'm making a nav mesh to make a character go up and down stairs.
I'm making a nav mesh that makes a character go up and down stairs, but when the character stops in the middle of a step, his foot floats or his foot gets stuck in the stairs.
I'm having a hard time creating a good path for the nav mesh.
I'm wondering if you have any knowledge on how to bake a nav mesh for ascending and descending stairs.
Please let me know what you know about baking navmeshes for stair climbing and descending, and what pages or ideas I should refer to when implementing stair climbing.
Please let me know what you know about baking a nav mesh for stair climbing.
*Preparation
　Create the stairs and the ground in Probuilder so that the nav mesh can be baked.
***Case 1
　Bake the nav mesh of the stairs.
　Test result.
　　When ascending and descending the stairs, my feet sink into the ground.
Every time I ascend or descend a flight of stairs, the surrounding scenery wobbles up and down.

***Case 2
Make a board to accompany the stairs.
Bake the nav mesh with the stairs hidden and the slope displayed.
　Test result.
When ascending and descending the stairs, the feet do not sink in.
But when I stop at the step, my foot floats away.
The scenery does not wobble because you are running on a board.

***Case 3
I made a board to accompany the stairs.
I want to make the nav mesh of the step part flat.
I want to make the nav mesh of the step part flat, so I'll edit the step part with the Probuilder function.
Instead of a straight slope, lower the knot to create a slope and bake it.
　Test result.
There is not much change in the shape of the nav mesh from Case 2.
The phenomenon that the foot lifts off the ground when stopping at the step was not improved.
The scenery is not wobbly because you are running on a board.

***Navigation mesh we want to achieve

***Development environment
Unity2019.4.9f1
***Package used
ProBuilder4.2.3


texts:
I am a second year student of Computer Games Technology. I recently finished my first prototype of my "kind" of own pathfinder (that doesn't use A* instead a geometrical approach/pattern recognition, the pathfinder just needs the knowledge about the terrain that is in his view to make decisions, because I wanted an AI that could actually explore, if the terrain is already known, then it will walk the shortest way easily, because the pathfinder has a memory of nodes).

Anyway my question is more general:
How do I start optimizing algorithms/loops/for_each/etc. using Assembly, although general tips are welcome.
I am specifically looking for good books, because it is really hard to find good books on this topic. There are some small articles out there like this one, but still isn't enough knowledge to optimize an algorithm/game...

I hope there is a modern good book out there, that I just couldn't find...


texts: Huge slowdown when running Lua as statically linked lib versus stand alone interpreter

texts:
I'm developing some algorithms in Lua which are run mostly in Lua (few calls to C++) and I'm noticing a huge slowdown when I'm running them from my app rather than the default Lua interpreter.
The script returns in about 11 seconds with the interpreter, and about 5+ minutes with my program.

I don't think it is a problem with calling the C++ function, overruling that function with an empty function in the script has no noticeable effect for time.

Both Lua and the program are compiled with Visual Studio 2010 (I created a new solution for Lua, with projects for both the interpreter and static library)

I've run a profiler on the code (the Very Sleepy profiler, can't get a Lua profiler working but haven't tried to much) and found that in my application around 50% of the time is spend on malloc.. and 40% on free, both called from the Lua garbage collector (tried disabling that to check, but that crashes with using to much memory (understandably), the Lua interpreter peeks at about 4mb ram usage).

I'm new at Lua, so its very possible I've done something wrong somewhere, anyone got a few hints to try?


texts: Can you dynamically set which texture to use in-shader?

texts:
I'm working on a user interface system, and I want to be able to mix textured polies with frag-coloured polies. Here's my shader code, that doesn't work:

attribute vec2 vertex_coords;
attribute float texid;
attribute vec4 fragdetails;

varying float usingtex;
varying vec4 v_fragdetails;

void main(){
    gl_Position =  gl_ModelViewProjectionMatrix * vec4(vertex_coords,0.0,1.0);

    usingtex = texid;
    v_fragdetails = fragdetails;
}

Fragment:

varying float usingtex;
varying vec4 v_fragdetails;

uniform sampler2D thetexture;

void main() {
    if (usingtex != 0.0){
        thetexture = int(usingtex);
        gl_FragColor = texture2D(thetexture, vec2(v_fragdetails[0], v_fragdetails[1]));
    } else {
        thetexture;
        gl_FragColor = v_fragdetails;
    }
}

Frag_details consists of either [r, g, b, a] for a coloured poly, with texid set to 0, or [texture x, texture y, 0, 0] for a textured one.

However, samplers must be uniform, and uniforms can't be modified. So how on earth would I swap between textures in one draw? Do I have to set them all up as uniforms and then pick from those? I'd have to use an array, and know the length, which isn't really practical for a UI system where buttons will be clicked, tabs changed, and so on.

Is there a way to do this?


texts: GLSL compile error when accessing an array with compile-time constant index

texts:
I have this shader that works well on my computer (using an ATI HD 5700). I have a loop iterating between two constant values, which is, afaik, acceptable in a glsl shader. I write stuff in two arrays in this loop.

#define NB_POINT_LIGHT 2

...

varying vec3 vVertToLight[NB_POINT_LIGHT];
varying vec3 vVertToLightWS[NB_POINT_LIGHT];

...

void main()
{
    ...
    for (int i = 0; i < NB_POINT_LIGHT; ++i)
    {
        if (bPointLightUse[i])
        {
            vVertToLight[i] = ConvertToTangentSpace(ShPointLightData[i].Position - WorldPos.xyz);
            vVertToLightWS[i] = ShPointLightData[i].Position - WorldPos.xyz;
        }
    }
    ...
}

I tried my program on another computer equipped with an nVidia GTX 560 Ti, and it fails to compile my shader. I get the following errors (94 and 95 are the lines of the two affectations) when calling glLinkProgram:

Vertex info
-----------
0(94) : error C5025: lvalue in assignment too complex
0(95) : error C5025: lvalue in assignment too complex

I think my code is valid, I don't know if this comes from a compiler bug, a conversion of my shader to another format from the compiler (nvidia looks to convert it to CG), or if I just missed something.

I already tried to remove the if (bPointLightUse[i]) statement and I still have the same error. However, if I just write this:

vVertToLight[0] = ConvertToTangentSpace(ShPointLightData[0].Position - WorldPos.xyz);
vVertToLightWS[0] = ShPointLightData[0].Position - WorldPos.xyz;
vVertToLight[1] = ConvertToTangentSpace(ShPointLightData[1].Position - WorldPos.xyz);
vVertToLightWS[1] = ShPointLightData[1].Position - WorldPos.xyz;

Then I don't have the error anymore, but it's really unconvenient so I would prefer to keep something loop-based.

Here is the more detailled config that works:

Vendor: ATI Technologies Inc.
Renderer: ATI Radeon HD 5700 Series
Version: 4.1.10750 Compatibility Profile Context
Shading Language version: 4.10

And here is the more detailed config that doesn't work (should also be compatibility profile, although not indicated):

Vendor: NVIDIA Corporation
Renderer: GeForce GTX 560 Ti/PCI/SSE2
Version: 4.1.0
Shading Language version: 4.10 NVIDIA via Cg compiler


texts: Simulating a sine wave/oscillating pattern for enemies

texts:
I'm creating a simple top down shooter, right now I have an enemy which simply follows the player. I'd like to change things up and have the enemies move towards the player but in a wave like motion. I have looked at some similar questions like this but they don't take into account for the Y changing. How can I simulate a wave like pattern for my enemies whilst they are homing into their target.

Edit:

Sample code

In my update method I have the following:

            Vector2 trackingPos = position - target;
            trackingPos.Normalize();
            position -= trackingPos * elaspedTime  * speed;