texts: Why does a part of the background turn white when the image disappears? Photo attached

texts:
I have an image of a fish that I've drawn to the screen, which has a transparent background:

When the ninja touches the fish, I want the fish only to disappear, without affecting the background. Instead, the fish disappears when the ninja touches it but the surrounding part of the background also disappears with it:

I have no idea why this is happening and I'd love some help as I am truly stuck! I have a feeling it may have something to do with the destroy() method I am using...

Here is the relevant Java code:

 if((characterY >= RandomY) && (characterX >= RandomX)){
     enemy.destroy();
 }

/* enemy is the fish image object, RandomX and RandomY are the fish's co-ordinates
on the screen (randomly positioned each time), and characterX and characterY
are the ninja's co-ordinates on the map. */

//Render method:

public void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
        background.draw();
        enemy.draw(RandomX, RandomY);
        ninja.draw(characterX, characterY);
    }

I am using Slick2D + LWJGL if that helps.


texts: Difference between reflection mapping and raytracing

texts:
Both methods involve casting a ray unto the reflecting object. It will be reflected. In reflection mapping - the intersection of this reflected ray with the environment map (texture) will yield the result.

Isn't it the same for ray-tracing, though? Or is ray-tracing classified only as ray-tracing if it works with the real 3D geometry in the scene (not pre-computed images).


texts: simple solution for 3d collision detection and response

texts:
I'm having great difficulty trying to implement collision detection and response in a 3d game

What are some simple solutions someone can use to implement smooth collision and response similar to games like Quake? I can see there are a lot of different ways to do collision and response but that makes it even more confusing, Im not sure which method is the best solution to sit down with.

So I was wondering what is the goto solution for the average programmer? All I have found online are very complicated incomplete mathematical explanations which I have a hard time understanding. Is this really a topic that requires an entire textbook to understand??

Perhaps theres a library ? Ive tried looking into bulllet but it seems to require heavy knowledge of physics. The best solution I have found is in a software called darkbasic, where it somehow handled sliding collision automatically and all the user had to do was desginate which object were to be handled. Was wondering maybe theres something similar to that


texts: Why are some objects not rendering properly?

texts:
Here's a button I exported from Blender into a .x format:

Now here it is in the game with BasicEffect applied to everything:

And now with my custom shader:

And there's the problem.  While the surrrounding environment is much brighter (I will get around to doing something about that btw), the button isn't.  I'm using the vertex shader to do the lighting calculations.  Sharp-eyed observers will notice that the texture is still slightly visible, but that's just ambient lighting.  I have no specular lighting, just ambient + diffuse.  So I guessed if lighting = ambient, then diffuse must be 0.

Here's my diffuse code:

float4 CombineDiffuseLights(float3 Normal, float3 Position3D)
{
    float4 lightColour = (0,0,0,0);
    for (int i = 0; i < NumberOfLights; i++)
    {
        float3 LightDirection = normalize(LightPosition[i] - Position3D);
        float DiffuseIntensity = saturate(dot(LightDirection, Normal));  //Where I suspect the problem lies
        lightColour += DiffuseIntensity * DiffuseColour * AttenuationPerLight(Position3D, LightPosition[i]);
    }
    lightColour.a = 1;
    return lightColour;
}

For the record:

Normal = mul(input.Normal, World);
Position3D = mul(input.Position, World);
DiffuseColour = (1,1,1,1);
Everything in the environment is using the same (vertex) shader
All normals are the right way around (CULLMODE = CCW;)
All LightPositions are going in with correct values

I've also noticed that if I manually set DiffuseIntensity = 1; this happens:

Besides the retina-searing brightness, it's proportionally the right shade compared to the environment, but there's no depth (duh, it's all 1).
So why on earth is DiffuseIntensity = saturate(dot(LightDirection, Normal)); giving me problems?  It's a pretty standard way of finding a diffuse value isn't it?  Is it doing something that I'm not aware of or is it a case of 'HLSL: You're doing it wrong!'?  Normally I'd have some clue but I am totally stuck on this one.


texts: Can I get enough experience to get an industry job just by reading books?

texts:
I've been recently working with DirectX and getting familiar with game engines, sub-systems and have done game development for the last 5 years. I have a real question for those whom have worked in larger game making companies before. How is it possible to get to into these big game creators such as Ubisoft, Infinity Ward or EA.

I'm not a beginner in my field and I'm going to produce a real nice 2D platform with my team this year, which is the result of 5 years 2D game creation experience. I'm working with prepared engines such as Unity3D or Game Maker software and using .Net with C# to write many tools for our production and proceeding in my way but never had a real engine programming experience 'till now.

I'm now reading good books around this topic but I wanted to know: Is it possible to become an employee in big game company by just reading books? I mean beside having an active mind and new ideas and being a solution solver.


texts: I need to make a button not a standard square shape, but a polygon shape.How to create a polygon button in LibGDX?


texts:
I need to come up with a better way to test for adjacency in a grid environment.  Imagine that the blue is water, the green is land, and the red dot is a character.  What I need to do is efficiently return a list of Vector positions of all grid tiles for the "island" that the character is on.

I have attempted to do this with raycasts using the following procedure.

-raycast at all of the immediately adjacent nodes surrounding the player.

-if (hit == land) then add hit to adjacent list.

-raycast at all immediately adjacent grid cells around each of the previous hits on land. (if they have not already been tested)

-if (hit == land) add to the adjacent list.

-loop until no more hits on land.

this seems to work okay, but is not very fast. If possible I need to maintain the raycasting because the levels are randomly generated at run time.


texts: MonoGame crash trying to load font from .xnb file

texts:
My MonoGame project uses a pre-compiled .xnb file to load a sprite font, and it works fine on Windows XP. The .xnb file is marked as content and copied to the output directory.

I've copied the project across to a machine running Windows 7, and now the game crashes when I try to load the sprite font. There is no exception thrown. The application just exits with code -1073741819 (0xc0000005).

Both machines have MonoGame 3.0 installed. The Windows XP box (where the game works) also has XNA 4.0.

I can't remember exactly how I generated the .xnb file! I originally just took it from the output of an XNA project, but when I switched from MonoGame 2.5 to 3.0, I remember having some issues with it and tried to use the MonoGame content pipeline instead. So my .xnb file could be from either method.

How can I work out why spritefont loading is failing?


texts: InputListener not working on a custom Actor

texts:
Right now I am working on a UI for my game. I'm adding my own UI elements to a group and adding that to a stage. But the listeners I'm adding to the actors are not firing off at all. I have looked on some StackExchange posts for answers but I couldn't find a good answer to my problem.

Right now the logic flow is Stage <-- Group <-- Custom Actors(FurnaceUI & FurnaceRecipeUI).

This is the HUD class (hastebin since it wouldnt paste right):
https://hastebin.com/zelibejopa.java

FurnaceUI:

public class FurnaceUI extends Actor {

private final Texture uiBackground;

public FurnaceUI(Group group, float x, float y, float width, float height){
    group.addActor(this);
    this.setX(x);
    this.setY(y);
    this.setWidth(width);
    this.setHeight(height);
    this.uiBackground = new Texture(Gdx.files.internal("ui/furnaceui.png"));
    for(FurnaceRecipe recipe : FurnaceRecipeRegistry.getRecipes()){
        group.addActor(new FurnaceRecipeUI(recipe, this.getX() + 10, this.getY() + 490, 280, 100));
    }

    setBounds(x,y, width, height);
    setTouchable(Touchable.enabled);

    addListener(new InputListener(){
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("usjkmd");
            return super.touchDown(event, x, y, pointer, button);
        }
    });

}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    batch.draw(uiBackground, this.getX(), this.getY(), this.getWidth(), this.getHeight());
}

FurnaceRecipeUI:

public class FurnaceRecipeUI extends Actor {

private final FurnaceRecipe recipe;
private final static Texture texture = new Texture(Gdx.files.internal("ui/furnace_recipe_ui.png"));
private final static Texture arrowTexture = new Texture(Gdx.files.internal("ui/ui_arrow.png"));
int i = 0;

public FurnaceRecipeUI(FurnaceRecipe recipe, float x, float y, float width, float height){
    this.recipe = recipe;

    this.setX(x);
    this.setY(y);
    this.setWidth(width);
    this.setHeight(height);

    setBounds(x,y, width, height);
    setTouchable(Touchable.enabled);
    addListener(new InputListener(){
        @Override
        public boolean touchDown(InputEvent event, float x, float y, int pointer, int button) {
            System.out.println("aight");
            return super.touchDown(event, x, y, pointer, button);
        }

        @Override
        public boolean keyDown(InputEvent event, int keycode) {
            System.out.println(keycode);
            return true;
        }
    });
}

@Override
public void draw(Batch batch, float parentAlpha) {
    super.draw(batch, parentAlpha);
    batch.draw(texture, this.getX(), this.getY(), this.getWidth(), this.getHeight());

    for(Map.Entry<Item, Integer> result :  recipe.getIngredients().entrySet()){
        batch.draw(result.getKey().getTexture(), this.getX() + 10 + (i * 58), this.getY() + 20, 64, 64);
        i++;
    }
    i = 0;

    batch.draw(arrowTexture, this.getX() + 110, this.getY() + 40, 64, 32);
    batch.draw(recipe.getOutput().getTexture(), this.getX() + 200, this.getY() + 20, 64, 64);
}}

Then here is the main class of my game with the input multiplexer: https://hastebin.com/donosavoru.java


texts:
I have a grid in terms of two arrays:

points: contains 3D coordinates of points.

triangles: contains 3 indices per line for each triangle of the grid.

I would like to interpolate the grid to make it smoother, i.e. add extra points and triangles in such a way that the grid is smoother than it is at the moment. But I found that scipy.interpolate only works if the xy-points are regular, which is not the case here. Any suggestions?


texts: I'm pretty new in Unity and i'm trying to write reusable code to use across multiple "project". So I wrote this class to POST and GET highscore via WebRequest. I compiled the project to a DLL and added the DLL in my assets folder, and then I created a test script added to a GameObject opened it in VS2013 and created a reference to the DLL in the Assets folder, and now im trying to use it and it keep saying that the class name doesnt exist.


texts: which one should use Transform or Nullable Vector3?

texts: We know Vector3 is a struct and for this reason it can't be null. Let's suppose that I want to rotate to a enemy position, if I use a Vector3 I can't be sure if there was an enemy or not and maybe I will be looking at Vector3.zero. A solution for this problem is use the enemy transform (and not the position) and do a null check, but another option is make a nullable Vector3, but I'm not sure which use, what should I take in account to take a decision?


texts: What type of networking system should I use With LibGDX on Android?

texts:
I've been looking for a good way to implement multiplayer in an Android strategy game I'm working on, using LibGDX.
What I found:

The embedded LibGDX networking system
Kryonet
Google Play Services (I already used this system for a Unity game)

The only problem is that I don't know what system I want to use because I see multiple problems in each of these.

In LibGDX's networking and Kryonet, how can players connect to each other without having to tell each other their IP (which is not easy for everybody) ?
In Google Play Services, I don't know what are the requirement for users. Do the have to have Google Play, or maybe Google+ installed on their devices? Also, how easy is it to get Google Play Services to interface with LibGDX and Scene2D?


texts: I had the idea, to make a custom card game based off an Anime i like. I was wondering if it would be legal to have such printed out (using a custom card/board game service) for personal use. I would only play it with friends and not make any money off of it.


texts: In a resource manager, how do I handle a resource containing other resources?

texts:
I have a resource manager, handling the usual resource loading, unloading etc. With resources such an images and meshes, there is no problem. However, what do I do when I have a resource containing other resources? For example, spriteFont contains reference to a sprite and a letter description.

Should that sprite be added to resource manager, or should my spriteFont be the only owner of that resource?


texts: Why does Unity require an EventSystem component for input during a play-test, where input works fine without it in a build?

texts:
Please be aware that this was initially a question about how to get the input to work. A comment pointed me in the direction of a fix, but only left me with more questions in regards to understanding the problem I was originally having, so I have edited my question to include the initial solution and focus on the question I still have.

The Problem:

Recently, I have moved from using GUIText and GUITexture objects to using the Canvas to display UI elements. In effort to set up a prototype, some external GUI elements were imported, and when the game is built and run from my phone, everything works as intended.

However, if I simply run the game from inside Unity, input is completely ignored. I originally thought this may have been a response to grabbing touch screen input, and expecting it to work on a regular screen with mouse input, but I have since confirmed that it still does not work when using Unity Remote to test the game on my phone.

It has since been pointed out that I was not using an EventSystem, along side my Event Trigger objects. After implementing an EventSystem component, and the default input module supplied by the EventSystem interface, the input works. However, this still leaves me confused. What is the point of enforcing the implementation of the EventSystem, if it only ensures functionality during play test? Why would I want this system in my end build, when I can confirm that the build version functions properly, without it?

Below you will find my setup, contextual to the problem. Click for a zoomed in view, as I have included the component structure of my UICanvas and MainCamera objects, in case it is helpful. In this case, we have a button that increases the max speed, when pressed. Everything works in a build, but nothing works during a play-test.

Additional Information:

I have enabled 'show touch input' on my phone, to confirm that the phone is still registering touch input.
I moved to using the Canvas object after the 'depreciated warning' for using GUIText and GUITexture turned into a 'depreciated error'. Even if there is a suitable way to still perform these actions with the GUIText and GUITexture objects, I still wish to persist with using the Canvas. I am also personally curious as to why this issue exists within the Canvas, as it seems lead to obvious cases of severe inefficiency, in a system that seems to have been put together with the sole point of being more efficient.
I can create manual OnMouseDown buttons that will work during play test, however, some GUI elements are more complex and persisting with this sort of solution seems like an incredible waste of time.
As previously mentioned, I do not have any input issues if I simply build and run the game from my phone. However, this takes considerably more time than a simply debug test, and even without the high efficiency cost, I do not have access inspector-manipulation during my play-test.
I am using Unity version 5.3.5 personal. Any solution that does not include updating Unity will be well preferred. While I have no physical problems updating Unity, in some previous projects updating Unity versions has lead to massive issues that we would prefer to outright avoid, if possible.

TL;DR:

Unity will not accept input on my input canvas during debug. I literally have to build and run my project each time I want to test input, or create dodgy hacks to provide input from the Inspector. The addition of an EventSystem allows input during debug play-testing, but is not needed for input post-build. Why does Unity act this way, and why do I need an EventSystem entirely for play-test input?


texts:
I'm trying to create a web application, to display 3D objects on canvas. To represent the 3D object I'm using an array of Points (from application's point of view, a Point - is just an object containing x, y and z coordinate values). Then I'm connecting the points with lines.

So. My task is to represent 3D points on 2D coordinate system. As I understand, what I need is to implement the projection of these points (to transform point from 3D representation into 2D). I spent few hours reading about projection types and I can't really understand which type is actually suits my needs.

I created an array of points to represent a cube. Then I implemented a central projection to display my cube on cavnas. As a result, it lost it's proportions (what I got is a paralelipiped).

I would like that my cube would look like a cube after projection. I guess, that I have to use a parallel projection, but there are a lot of subtypes of it.

So the question. Which projection I need to choose and maybe you can give me a peace of advice of what should I read to get a base mathematical background about this topic?


texts: Directory.EnumerateFiles hangs with disk pegged to 100%

texts:
I am having an issue that occurs seemingly at random with the following block of code.

    public static IEnumerable<string> GetSavedGameFileList()
    {
        foreach (string fullFilePath in Directory.EnumerateFiles(Application.persistentDataPath, "*.save"))
        {
            Debug.Log("Located save game: " + fullFilePath);
            yield return Path.GetFileNameWithoutExtension(fullFilePath);
        }
    }

Unity will freeze and force me to close it. There is no error message, in the Windows Task Manager, I noticed that the disk utilization gets pegged at or near 100%:

Nothing is logged to the console when this happens. The folder it's scanning only contains 3-5 files during my testing. I am running Unity 2017.2.0f3 with the .NET 4.6 backend.

Here is what I have tried without success:

Use Directory.GetFiles instead of Directory.EnumerateFiles.
Storing my results in intermediate arrays instead of returning an IEnumerable.
Restarting the Unity editor.

Any ideas? Thanks!


texts: Configurable Joint: how to create a FixedJoint, and Rotating it?

texts:
I have 2 rigidbody, in 2d view, non kinematic, and with no gravity, and want to connect them with a Configurable joint. I don't want the joint to be spring (I want the same distance always). But I would like to move the blue object left / right (rotating it around the red one)

How can I setup my Configurable Joint ?

Thanks you !


texts:
In Phong lighting model a vector R is used to calculate the spectral component of light. The equation used to obtain it is

R = 2(N•L)N - L

I can't understand why we use this equation. Could someone give me a demonstration of how we obtain this equation?


texts: How to design prefabs in Entity Component Systems

texts:
In Unity (and I presume other game engines) you can create "prefabs" which are blueprints for game objects. They contain a list of components, and default values for those components. Prefabs can be instantiated many times, which is an efficient way of creating many objects of the same kind.

One feature in particular of prefabs is that you can modify an attribute on a single instance of a prefab, without modifying the prefab itself. Similarly, you can modify the prefab, which will propagate the change to all instances.

I've been working on an implementation of the Entity Component System (for a high-level description of ECS see this question: How to implement n-body in an Entity Component System), and I got stuck on how to implement prefabs efficiently in ECS. I think it's a powerful capability of EC-design, and implementing this on native ECS would be awesome.

I can come up with a few approaches:

Create archetypes, which are predefined lists of components (Unity approach). This does not let me set initial values for the components, nor override them (there is nothing to override). Easy to implement, but doesn't really do what I want it to do.
Create a "prototype" entity from which other entities are cloned, including component values. With this design I can override individual attributes, but when I update the prototype, the clones don't get updated.
Create entities with a reference to a "base" entity. When getting a component from an entity, first look in its component list, then try the base entity. This way when I update a base component, base instances change as well. To override a base component I can simply add it to the instance entity.

Of these three approaches the third approach comes closest, but I don't see a straightforward way to extend it so I can override a single attribute. How can I make this work?


texts: Most efficient way to recalculate enemy A* path on the fly?

texts:
I'm working on implementing a more robust pathfinding algorithm for the enemies in my top-down shooter game, and I have the A* algorithm working, but now I need to decide when to calculate the path.

There are a couple situations where the path will be calculated already:

The enemy sees the player.
The enemy hears a sound.

I figure that I'll have the enemy continually recalculate their path to make sure they're aiming at the player and not just wandering off to the last path goal even after the player has moved. I also plan to have them initially only head to the last sound they heard or the last place they sighted the player if the player is no longer visible, and only continue pathing if they sight the player again or hear a new noise.

However, while they actively have the player in their sights and are charging toward him, how should I determine when to recalculate their path? I have a couple ideas already, but I'm not sure which would be most efficient, or if there's a better way.

Using grid coordinates corresponding to the map tiles, if the player moves 1 or more grid squares away from his initial position, determined by calculating (x2 - x1)^2 + (y2 - y1)^2. If this way is efficient enough, should each enemy be doing this calculation in their update step? Or should there be some sort of "notify" implementation (this would be a good amount more work because I don't have any kind of signal/slot pattern set up).
If the sum of the X and Y offsets of the enemy's grid coordinates compared to the player's coordinates are getting bigger, recalculate.

Anyone have any ideas? A* isn't exactly a cheap operation, so I want to limit the amount of recalculating I'm doing, especially if there are a good deal of enemies in the map.


texts:
My project, in its current state, keeps all of the info for each inventory item in script files. That means, inventory items and their properties are part of the codebase. This works well, but I'm advancing quickly through development and I fear that this system is going to pose some problems later on. Normally, data (item properties) are not stored in the code, but in some sort of database.

I was thinking about storing item properties in external (text for now) data files, that would get parsed when the game loads. I'd mark each item with a string ID (for easier referencing in other places - GetItemWithID("FOOD_FISH") makes more sense than GetItemWithID(5)). Then, I'd build some sort of class that would take care of item-driven events (such as what happens when an item is consumed). Then I'd map each function implemented by the manager to some interpretable string counterpart (in an item's data file I'd have the string "RestoreHealth(50)" - this would be mapped by the manager to the function RestoreHealth (the param would get passed too)).

Is this an even remotely good idea? How would you do it?

Another thing that I'm thinking of, since I'm building a tool to make inventory item creation easier, is to develop something that simply generates appropriate C# code for an underlying database of user-readable and editable item properties.

E.g. it takes in

FOOD_FISH
Name:Fish
Value:50
OnConsume:
RestoreHealth(40)

and generates

FoodFish = new InventoryItem();
//Properties set here.

LATER EDIT:

After Byte56's reply, I came up with a kind of format that's easy enough to parse.

[ID:IT_FO_TROUT]
[Name:Trout]
[Description:A raw trout.]
[Value:10]

[3DModel:null]
[InventoryIcon:trout]

[Tag:Consumable]
[Tag:Food]
[Tag:Stackable]

[OnConsume:RestoreHealth(15)]
[OnConsume:RestoreFatigue(15)]

Since on the project there will be people with no programming experience working remotely, using external files + custom item generators seems to be the best way to go. Should've figured it out earlier.


texts: Is there a way to blur objects in a 2d game with OpenGL without using shaders?

texts:
Is there a nice way in OpenGL to blur objects without using shaders?

Currently, I'm accomplishing blur by rendering the object slightly up, down, left, right, and the four diagonals from its original position. It seems like there should be a much better way of doing this. I'm working in a 2d scene.


texts: Two pass blur shader using libgdx tile map renderer

texts:
I am trying to apply the following technique: blur effect using two pass shader to my libgdx game using the OrthogonalTiledMapRenderer. The idea is to blur the background wich is also a tilemap but rendered with another camera with a different zoom applied.

Here is a screen capture without effect:

Using the OrthogonalTiledMapRenderer sprite batch like this:

backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurX);
backgroundMapRenderer.render(layerBackground);

I get the following render:

Wich is ok for X blur pass. I then try using frame buffer object like in this example. But the effect seems to be too much zoomed:

I may be messing up with the camera and the zoom factor. Here is the code:

    private ShaderProgram shaderBlurX;
    private ShaderProgram shaderBlurY;

    private int FBO_SIZE = 800;
    private FrameBuffer targetA;
    private FrameBuffer targetB;

    targetA = new FrameBuffer(Pixmap.Format.RGBA8888, FBO_SIZE, FBO_SIZE, false);
    targetB = new FrameBuffer(Pixmap.Format.RGBA8888, FBO_SIZE, FBO_SIZE, false);

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

    backgroundMapRenderer.render(layerBackground);
    targetA.end();

    targetB.begin();
    Gdx.gl.glClearColor(1, 1, 1, 0);
    Gdx.gl.glClear(GL10.GL_COLOR_BUFFER_BIT);
    backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurX);
    backgroundMapRenderer.render(layerBackground);
    targetB.end();

    TextureRegion back = new TextureRegion(targetB.getColorBufferTexture());
    back.flip(false, true);

    backgroundMapRenderer.getSpriteBatch()
        .setProjectionMatrix(backgroundCamera.combined);
    backgroundMapRenderer.getSpriteBatch().setShader(shaderBlurY);
    backgroundMapRenderer.getSpriteBatch().begin();
    backgroundMapRenderer.getSpriteBatch().draw(back, 0, 0);
    backgroundMapRenderer.getSpriteBatch().end();

I know I am making something the wrong way, but I can't find any resources about applying two passes shader using tile map renderer.

Does someone know how to achieve this?


texts:
Non-Player Character also known as NPC is a character that is controlled by a computer itself with an Artificial Intelligence and friendly behavior. (Ex. Merchant, Blacksmith, Pet)
Enemy Character  is a character that also  has an Artificial Intelligence but with a different behavior. (Ex. Monster, Troll, Slime)

What is the difference between Non-Player Characters and Enemy Characters?
I need to create a Character class which is divided into three types, a PC, NPC and Enemy Character. I want to know what are the possible attributes or data of NPC and Enemy.
Based on the below code example, I have added a target and steering-behavior data for both Enemy & NPC. As you may have noticed, they both have the same data, the only difference is they have a Good and a Bad or Can attack or Cannot attack.
public class Character {
    // Traits or Stats, Skills & Abilities
}

public class NonPlayerCharacter extends Character {
    Vector2 target
    // friendly behavior, it means it doesn't attack
    // can follow, attack, pursue, evade, flee (Some steering behaviors)
    // can stall & sell items, save point, bank etc.
}

public class Enemy extends Character {
    Vector2 target
    // Not friendly, it means it does attack player
    // Also have steering behaviors
}


texts:
So I have this code for moving a pointer up and down in a menu. The only problem is it moves way too fast to even stop on any of the selections. It does go to each one, but even just a quick tap of the button the pointer moves down 3 selections. If you go up and down a few times it will go to the selection you want, but it's a hassle. So is there a way to maybe disable movement for about half a second?

        if(Game.stateEngine.menuState == StateEngine.MenuState.ITEM)
        {
            if(Input.dn && Game.pointer.y < 430)
            {
                Game.pointer.y += 15;
            }
            if(Input.up && Game.pointer.y > 172)
            {
                Game.pointer.y -= 15;
            }
            if(Input.x && Game.stateEngine.menuState != StateEngine.MenuState.MAIN)
            {
                Game.stateEngine.menuState = StateEngine.MenuState.MAIN;
                Menu.firstPass = true;
            }
        }


texts:
I want to animate my character, but i got this error: Parameter 'Blend' doesnt exist.

if i use 1d Blend Type it works fine no bug nothing.

But if i change the Blend type

in the animation panel working fine the animation but if i run the game i get this error: Parameter 'Blend' doesnt exist and my character is freeze in one position what can cause this problem ?

parameters


texts: How can I load local html pages into unity?

texts: How can I open an HTML page inside UNITY, with the page functioning normally?


texts: Are there any alternative JS ports of Box2D?

texts:
I have been thinking about creating a top down 2D car game for HTML5. For my first game I wrote the physics and collisions my self but for this one I would like to use some ready made library.

I found out Box2D and its JS port.

http://box2d-js.sourceforge.net

It seems to be quite old port, made in 2008. Is it lacking many features of current Box2D or does it have major issues with it? And are there any alternatives for it?


texts: Good book or tutorial for learning how to apply integration methods

texts:
I'm looking to animate a graph layout using edges as springs and nodes as weights (a node with more links will have a bigger weight).

I'm not capable of wrapping my head around the usage of mathematical and physics relations in my application.

As far as I've read, Runge Kutta 4 (preferably) or Verlet will be a good choice, but I have problems with understanding how they really work, and what physics equations I should apply.

If I can't understand them, I can't use them. I'm looking for a book or a tutorial which describes the things that I need.


texts: An invisible object that deletes anything behind it?

texts:
I am using augmented reality to put a 3D object on top of a "camera detected" object.

The 3D object can be though of as leaves that go above the real world object but also fall in front / behind / on the sides of it.

The leaves are not uniform so they appear as arcs which let more of the "camera detected" object be seen in some parts and less in others.

Because of this I want to only show the leaves that would normally be seen if there was a real 3D object (instead of the camera detected one) in that place. But since the camera detected one is just a background image part of the leaves on the side or behind are seen when the object is rotated.

I was thinking it might be possible to use an "invisible" object that moves and rotates the same way as the "camera detected" one so it behaves as a placeholder for depth testing but is not actually rendered.

Is this possible? May I have some pointers on how to achieve this?

Thank you


texts:
So I am creating a game with C++ and SDL.
I have a "gameobject" header file and no cpp (I do not need it) the game object has 2 functions void render() & tick().

The player class inherits from the gameobject. the problem is I don't know how to inherit functions. I tried virtual but I still can't figure it out.
I am used to Java so C++ is quite complicated.

My code:

gameobject.h :

#include <SDL2/SDL.h>
#include <SDL2/SDL_image.h>
#include "game.h"

class gameobject
{
    public:
        virtual ~gameobject();

        void virtual tick() = 0;
        void render();

    protected:

        int width = pos.w;
        int height = pos.h;
        int posx = pos.x;
        int posy = pos.y;

        float velox;
        float veloy;

        SDL_Rect crop;
        SDL_Rect pos;
};

#endif // GAMEOBJECT_H

player.h:

#ifndef PLAYER_H
#define PLAYER_H

#include "gameobject.h"

class gameobject;

class player : public gameobject
{
    public:

    private:

        player(SDL_Renderer* renderer,int pwidth,int pheight);
        ~player();
};
#endif // PLAYER_H

player.cpp :

#include "player.h"

player::player(SDL_Renderer* renderer,int pwidth, int pheight)
{
    this->pos.w = pwidth;
    this->pos.h = pheight;
};

void player::tick(){} /// the problem here


texts: Voxel Face Crawling (Mesh simplification, possibly using greedy)

texts:
Edit: This is just for my own learning experience, it is NOT for performance reasons that I ask this question.

This is in regards to a Minecraft-like terrain engine. I store blocks in chunks (16x256x16 blocks in a chunk). When I generate a chunk, I use multiple procedural techniques to set the terrain and place objects. While generating, I keep one 1D array for the full chunk (solid or not) and a separate 1D array of solid blocks.

After generation, I iterate through the solid blocks checking their neighbors so I only generate block faces that don't have solid neighbors. I store which faces to generate in their own list (that's 6 lists, one per possible face/normal). When rendering a chunk, I render all lists in the camera's current chunk and only the lists facing the camera in all other chunks. I do this by storing all 6 lists in one buffer, then I simply change what ranges I draw.

Using a 2D atlas with this little shader trick Andrew Russell suggested, I want to merge similar faces together completely. That is, if they are in the same list (same normal), are adjacent to each other, have the same light level, etc. I know I will still end up with rectangles, but it should easily reduce my vertices count by 50% or better if my estimations are correct.

My assumption would be to have each of the 6 lists sorted by the axis they rest on, then by the other two axes (the list for the top of a block would be sorted by it's Y value, then X, then Z).

With this alone, I could quite easily merge strips of faces, but I'm looking to merge more than just strips together when possible. I've read up on this greedy meshing algorithm, but I am having a lot of trouble understanding it.

So, my question: To perform merging of faces as described (ignoring whether it's a bad idea for dynamic terrain/lighting), is there perhaps an algorithm that is simpler to implement? I would also quite happily accept an answer that walks me through the greedy algorithm in a much simpler way (a link or explanation).

I don't mind a slight performance decrease if it's easier to implement or even if it's only a little better than just doing strips. I worry that most algorithms focus on triangles rather than quads and using a 2D atlas the way I am, I don't know that I could implement something triangle based with my current skills.

PS: I already frustum cull per chunk and as described, I also cull faces between solid blocks. I don't occlusion cull yet and may never.

*Edit: I have implemented my own little technique, which probably has a name, but I simply go through my 6 lists which are sorted by the axes they rest on, followed by block type, and then by lighting level. I iterate through them, creating new rectangles as I go and grow them simultaneously (with a heavy bias towards a certain axis). It is definitely not optimal, but it is indeed quite fast and it does lower my vertex count by close to 50% on average. Byte56's comment is the closet I think to a real answer, but I can't select that for the answer/bounty.

Here is my fast and simplistic way I'm handling this problem AFTER generating the full initial terrain without much of any optimization. Assuming all squares given are the same image, light level, normal, etc.. each color is a different quad I would render. With my lists sorted the way they are, this is a very easy/fast approach.


texts: How should I choose between Vec3 and Vec4?

texts:
I find myself torn between using Vec3's vs Vec4's for representing position, directions, etc in my non-gpu code. I see the obvious benefit of using Vec3s for stuff like data in buffers, to more tightly pack mesh data, reducing memory used.

The primary motivation for switching from Vec3 to Vec4 is to reduce the tedius conversions back and forth. For example the math library I am using (GLM) only lets mat4's multiply with vec4's.

I realise it dosn't make sense to have a fourth component in say a direction vector, and to make the distinction between say a position and a direction vector becomes more important.

It's not a big issue, but nonetheless I am curious is there any significant pros or cons between using vec3's or vec4's? What makes the most sense to other users?


texts: Are there spritebatch drawing limitations on monogame?

texts:
I've reached a point that it seems when I draw too much on screen, monogame starts doing weird things.

When I call this code in the Draw method

public void drawDialogBox()
    {
        if (dialogueBoxOn == 1)
        {
            spriteBatch.Begin(SpriteSortMode.BackToFront, BlendState.NonPremultiplied, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, null, Matrix.CreateScale(GameGlobals.zoom));
            spriteBatch.Draw(dialogBoxChara, new Vector2(89, 18), Color.White);
            spriteBatch.Draw(dialogBoxTexture, new Vector2(0, 108), Color.White);
            spriteBatch.DrawString(font, "àéùaDASASCZadhkjashdash", new Vector2(4, 108), Color.White);
            spriteBatch.End();
        }
    }

This happens:

This code is supposed to show the character, the textBox itself and the text. But the text isn't drawn correctly. If I comment one of the draw lines, it works.

Or this (if I only comment the character line)

Any ideas of what is happening here? I thought it was some SpriteBatch limitations, but I don't know...

EDIT: After following @Jon advice, i've reached this state

Now it shows the character and dialog properly, but the background and the walls are not displayed now. I have all the walls like this:

spriteBatch.Draw(leftcenterright4, new Vector2(0, 53), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.5f);

And the background

spriteBatch.Draw(background, new Vector2(0, 0), null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 1f);

And the code from earlier fixed:

spriteBatch.Draw(dialogBoxChara, new Vector2(89, 18),null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f);
spriteBatch.Draw(dialogBoxTexture, new Vector2(0, 108),null, Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0.1f);
spriteBatch.DrawString(font, "àéùaDASASCZadhkjashdash", new Vector2(4, 108), Color.White, 0, Vector2.Zero, 1, SpriteEffects.None, 0f);


texts:
I am making a simple phone game and having a conceptual argument with my partner. The argument might end up being inconsequential, but I would like to hear some opinions from actual devs who are making games.

This will be a pretty standard beat-em-up style game where you beat up lots of easy enemies and build up a huge kill count. There will be many different types of enemies. The question emerged when we had to put up some display on the UI.

Should the kill count be represented as a 1:1 number? For example, on your HUD, it will constantly show:

Kills: 15

--or--

Defeated: 31

Or, should it be represented by a score? For example: 1 enemy = 100 points and it will display something like this:

Score: 1200

This may be a matter of taste in the end. But, for the casual games market, what do you think a mainstream audience will enjoy more? I think people love big numbers, in general, what do you guys think?


texts:
I have an idea for a game, and I was wondering, how would I go about grabbing people in the gaming development community to help build this baby that is in my head. I am no coder, but I do understand coding concepts etc.

Are there sites for discussing possible game design ideas, or game concepts? (I'm hoping here is such a site :) )


texts: An error comes up in console when trying to enter play mode in unity

texts: Hay folks, i pray for everyone's wellbeing. I want to ask a question that whenever i enter playmode in unity, error message is displayed even though there is nothing in the console. This doesn't get fixed even after restarting unity. Any help would be great.


texts: I am having problems with Cryengine 5, every time I open the editor through the launcher, it appears an image speaking Traceback (most recent call last): File "cry run", line 722, in module File "cryrunapy", line 375, in omd open File ubprocessapy line g59, in init File "subprocesspy", line 1112, in execute child osError: IwinError 216) This version of% 1 is not compatible with the version of Windows being run. Check your system's information if you need an o86 B2-bit or x64 (64-bit) version of the program and cont bug, I do not understand anything about it, I need explanations and resolutions


texts: How to Work With Arbitrarily Oriented Vectors

texts:
I'm brushing up for a pending game jam and just for kicks I thought I'd let the gravity in my 2D platformer push at an arbitrary angle. Normally gravity points downward (3 PI / 2), but if I wanted it to point to the right (0) then the character would rotate accordingly and be able to walk along walls as though they were floor. In that case, pressing left would cause the player to move downward on the screen, as that would be left relative to the current angle of gravity.

The problem comes when I try to implement jumping or falling. As I'm now realizing, I lack the mental language to even properly describe my problem, but I clearly don't intuitively grasp how to handle rotated vectors.

For example: I'd like to know when the player is falling. Normally I'd just check if their velocity.y > 0, but that only makes sense if gravity is pointing downward. If it's pointing to the right, then a velocity.y > 0 implies that they're moving to the left, relative to gravity.

How do I go about understanding and working with 2D vectors that have an arbitrary global rotation applied to them?


texts: Make square walk by rotating around corners

texts:
I in the very beginning of making a small game, and I'm having some problems getting the basic movement of my character.

My character is a square that can be moved by rotating around a corner. The user chooses what corner to rotate around by pressing a button. Here is the (malfunctioning) code I've come up with this far(Java and slick2d):

    // square is an org.newdawn.slick.Image and is rendered by calling square.draw()

    @Override
    public void update(GameContainer container, int delta) throws SlickException {
        Input input = container.getInput();
        if (input.isKeyDown(Input.KEY_W))
        {
            square.setCenterOfRotation(0, 0);
            square.setRotation(square.getRotation() + 1);
        }
        else if (input.isKeyDown(Input.KEY_E))
        {
            square.setCenterOfRotation(square.getWidth(), 0);
            square.setRotation(square.getRotation() + 1);
        }
        else if (input.isKeyDown(Input.KEY_S))
        {
            square.setCenterOfRotation(0, square.getHeight());
            square.setRotation(square.getRotation() + 1);
        }
        else if (input.isKeyDown(Input.KEY_D))
        {
            square.setCenterOfRotation(square.getWidth(), square.getHeight());
            square.setRotation(square.getRotation() + 1);
        }
    }

This will rotate the square correctly, but when I switch rotation direction, the square jumps two times its lenght to the side I switched to. I think the problem is that I never really move the square, just rotate it away from its original position. I think this will also make collision detection difficult.

How would I prevent this 'jumping', and how will I later do collision detection on the image? Or asked in another way, how should I be doing the 'rotation walking'?


texts: I created a sphere (planet) with a texture (earth texture) in Blender, and exported it using the G3DT exporter. Then when I go to use it in my application I convert to the G3D binary format, and load my texture. When I render my sphere each face contains the texture. It is not wrapping around my whole sphere like it was in Blender. Any ideas what I'm doing wrong?


texts: Unity not redrawing sprite, after sprite change

texts:
I am making a game where the player mines dirt by walking on it:  So, I created a scene and added a bunch of dirt to a grid, from a dirt prefab. When the character walks on a square, it is supposed to change to dark dirt. If I only have a few hundred dirt squares, it works as expected. I step on the dirt, and it turns dark. But now that I have a few thousand dirt squares, unity renders incorrectly, and will only change the sprite for dirt squares that are in every 4 or 5 columns. See the following picture:

The debugger outputs GetComponent<SpriteRenderer>().sprite.name for the dirt I walk on is DarkDirt even though it is showing up as "Dirt" in reality. The inspector in the scene view agrees that it should be rendering DarkDirt.

How can I get unity to re-draw sprites when they update?


texts: How do I make a sine wave without using an infinitely-increasing time value as input?

texts:
I have a basic understanding of sine wave generation. The problem I am facing is that as the input parameter for time gets larger, my sine wave falls apart and starts to look really ugly.

I'd like to calculate a sine wave without depending on an ever increasing time value. How can I do this?


texts: How to use Tiled Editor to recreate a 2D map?

texts:
Alright, to familiarize ourselves with the Tiled Editor, the teacher asked us to replicate a tile-based map of a 2D platformer.

He gave us pretty much these two things:

1.) A selection of maps to copy from (Choose one map to copy)

2.) A folder with subfolders that contains 16x16 images on each subfolder (tiles)

Naturally, I started by importing the images from the folders by clicking on each folder, and importing each collection, which takes a long amount of time..(also considering the tiles for the other maps are mixed in here as well)

I used the png image as a transparent backdrop to help me place the tiles, then started placing tiles, which again, took a lot of time...

More than halfway there, I realized the width I set the map when I created it wasn't enough and tried to change the option under properties but it was grayed out. I also tried creating a new map and copying and pasting from my original one but that one doesn't seem to work either.

Is there a way to speed up the process a little bit? or salvage the tmx file?
Considering that he might ask us to create more maps later on, I'd like to be a bit informed...

I've also looked up the possibility of importing the image itself, slicing it to the desired tile size and removing duplicate tiles. This way I can simply import the map png and have the software only create tiles that are used in the level.

Can this be done?


texts: How can I get Unity to tell me the battery status of my OS X laptop?

texts:
How do I get battery status on an OS X laptop in Unity?

This is un-Googlable: I keep finding either mobile stuff (iOS or Android) or people complaining about laptop battery life.


texts:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Makarov : MonoBehaviour
{
    public GameObject Bullet;

    public float BulletSpeed;

    public Transform ShootPoint;

    // Update is called once per frame
    void Update()
    {
        if(Input.GetMouseButtonDown(0))
        {
            shoot();
        }
    }

    void shoot()
    {
        GameObject BulletIns = Instantiate(Bullet, ShootPoint.position, ShootPoint.rotation);
        BulletIns.GetComponent<Rigidbody2D>().AddForce(BulletIns.transform.forward * BulletSpeed);
    }
}

When I shoot the bullets just stop right in front if the gun.
This is for a top down shooting.


texts:
So after a long attempt at DirectX I switched back to good old OpenGL. Now I'm running into this weird problem. My code involves shaders, of course, and drawing a basic cube. But I'm getting this weird shape. I've never seen this before. I was just wondering what could possibly be causing this? Thanks very much!

Initialization:

lightingShader->GenerateVAO();
lightingShader->GenerateVBO();

lightingShader->SetVertices(vertices, sizeof(vertices), GL_STATIC_DRAW);

lightingShader->BindVAO();
{
    lightingShader->AddAttribute(0, 3, GL_FLOAT, GL_FALSE, 3, 0);
}
lightingShader->UnbindVAO();

Rendering:

lightingShader->Use();

GLint objectColorLoc = lightingShader->GetUniformLocation("objectColor");
GLint lightColorLoc = lightingShader->GetUniformLocation("lightColor");

glUniform3f(objectColorLoc, 1, 0.5f, 0.31f);
glUniform3f(lightColorLoc, 1, 0.5f, 1);

GLint modelLoc = lightingShader->GetUniformLocation("model");
GLint viewLoc = lightingShader->GetUniformLocation("view");
GLint projLoc = lightingShader->GetUniformLocation("projection");

glUniformMatrix4fv(viewLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->View()));
glUniformMatrix4fv(projLoc, 1, GL_FALSE, glm::value_ptr(game_->GetCamera()->Projection()));

lightingShader->BindVAO();
{
    glm::mat4 model;
    glUniformMatrix4fv(modelLoc, 1, GL_FALSE, glm::value_ptr(model));

    glDrawArrays(GL_TRIANGLES, 0, 36);
}
lightingShader->UnbindVAO();

Result:

As you can see, position and color is set fine, but I still get that weird shape.


texts: Hobbyist game dev, want to create async multiplayer game. Are server costs manageable?

texts:
I want to make the game I want to play, and that game happens to be an asynchronous multiplayer game. Think Hero Academy or Hearthstone, where there are 2 players and each submits moves to a central server. Alternatively (and not ideally), clients connect to each other and play is limited to a fixed window of connection, but still there needs to be a central server to acquire new opponents.

That said, this is very much going to be a hobby type endeavor - I'm just one guy after all. This is not going to commercially support itself. If I have 100 players ever, that would be fantastic.

Given that I'm going to have to eat server costs myself, what are my options for getting a server? I don't need much bandwidth or CPU, due to the nature of async games - only the sending of the gamestate/current move, and perhaps some checking of legal moves. Going to Amazon or getting dedicated hosting seems drastically overkill for what I want.

If it makes a difference, I'm intending to learn and use Unity for this.


texts:
At the moment I am trying to implement fbx model loading in my DirectX 11 code. This is old code I had create for use with DirectX 9 and I'm simply trying to bring it back up to date.

Since I first create the code, the SDK version I used was 2012.2, not autodesk have released 2014.1. With that, I have managed to update all of my code bar one issue; my sdk seems to be missing all of the .lib and .dll files I need.

In my old code I needed add the following dependency:

  fbxsdk-2012.2-mdd.lib

I thought it would be a case of changing it to:

  fbxsdk-2014.1-mdd.lib

But this doesn't work. I've spent all weekend trying to find a solution to this, but can't. Does anyone know what I need to do in order to genereate these dll and .lib files?

I've downloaded all of the different SDK options from autodesk, I've searched for the 2012.2 version of the SDK, but got nothing. Failing that; can anyone recommend a good library. or way to implement 3D model loading into my project?

I've tried looking at AssImp but found it a nuisance to work with. So I would like to avoid if possible.


texts:
I have a small working game prototype. I want to do something like

LwjglApplicationConfiguration cfg = new LwjglApplicationConfiguration();
cfg.resizable = false;

But I get "LwjglApplicationConfiguration cannot be resolved to a type"

What can I do? Or is there a different method?
Thanks.


texts: What is the most efficient way of rendering a large number of SDL2 objects?

texts:
I'm trying to find the most efficient way of rendering a large number of SDL2 objects to the screen.

Each of my objects have their own sprite sheets which are stored as SDL_Texture*.

Currently my render process looks like this:

Update objects.
Clear screen.
Call each objects render function, which calls SDL_RenderCopyEx(...) to render to the screen.
SDL_RenderPresent()

I was thinking I could improve this in one of two ways:
Method 1:

Update objects.
Clear screen.
Call SDL_SetRenderTarget(...) to set render target to a new texture 'X' which had previously been created with a SDL_TEXTUREACCESS_TARGET flag.
Call each objects render function, which calls SDL_RenderCopyEx(...) to render to texture 'X'.
Call SDL_SetRenderTarget(...) to set render target to screen.
Call SDL_RenderCopyEx once more to render texture 'X' to the screen.
SDL_RenderPresent()

Method 2:
Method 2 would require all sprite sheets to be stored as SDL_Surface*.
It would also require a 'global' SDL_Surface 'Y' to memcpy to.

Update objects.
Clear screen.
Call each objects render function, which calls a custom function to memcpy(...) each current obj surface information to surface 'Y'
Use surface 'Y' to create a new texture 'Z'.
Call SDL_RenderCopyEx only once to render texture 'Z' to the screen.
SDL_RenderPresent()

Unsure if any of these methods would make a difference in speed. Was looking for some input on whether it would be a good idea to implement either, or implement something new entirely.

Also, I'm not really looking for any new libraries to use, currently trying to use pure SDL. But if it's impossible to have an efficient rendering system with SDL, I would consider switching.


texts: Do I really need to clear the renderer every iteration?

texts: Just a quick question about fine-tuning/optimization. If I'm making a 2D platformer with a parallax-scrolling background (meaning no two frames are the same) do I really need to clear my renderer for every iteration? The entire scene will be drawn-over anyways, so if I can get rid of one extra function every iteration, it could help to speed things up a little bit, though I realize that render-clearing is not a very expensive function. By the way, I'm using SDL2.


texts: In an XNA game object, what should I use to represent a texture for serialization?

texts:
While trying to save to a file a list of objects needed to run my game, I noticed that Texture2D is not serializable. Why? What was the purpose?

The object I want to serialize looks like this:

[Serializable]
public class GameObject
{
    private Vector2 position_ = Vector2.Zero;
    private float rotation_ = 0.0f;
    private Vector2 scale_ = Vector2.One;
    private float depth_ = 0.0f;

    private Texture2D texture_;

    private bool is_passable_ = true;

    private GameObject(
        Vector2 starting_position,
        string filepath,
        ContentManager content)
    {
        this.position_ = starting_position;
        this.texture_ = Content.Load<Texture2D>(filepath);
    }

    //Properties
    //Update/Draw
}

So, what should I serialized since Texture2D isn't made to be used that way?


texts: What causes regions of improperly-lit terrain when my pixel light count is below 4?

texts:
My Unity3d game has a strange bug where if you have the pixel light count set below 4, these strange boxes appear on the terrain.  Because this game is going to be for mobile, if I set the pixel light count too high, won't run fast enough.

The screenshot will show you what I mean:

You can see this box on the left of the image where light is entering, I want light to enter all around the coin. How can I fix or prevent this?


texts: TiledMap problem in android device (LIBGDX)

texts:
I'm a noob when it comes to programming Java apps, so I'm trying to make a very simple platformer game.
All is running very well on desktop project, but when I put the game on my Xperia a "strange" thing happens...I'm using Tiled to draw the map, and on code OrthogonalTiledMapRenderer and TiledMap, with a OrthographicCamera, I "zoom" with camera.setToOrtho a part of the map. The problem here is...

I have an elevated floor and other tiles, and on phone screen, this all appears squashed: the tiles and the elevated floor display in a lower position than the desktop version, which is an ugly problem. Resizing the window on PC, all runs and resizes good, mantaining the aspect ratio.

Sorry if I don't explain the problem very well, I'm lost on this theme! xD
I thank tutorials, examples and all other things for noobs.
I tried all viewports and still have not solved the problem, a good way I think is cut off the top part when resize, but I don't know how to do it!

Edit:
I add the screenshots, this part of code is from a good book from packt, and I don't know if I can share here here, I prefer not do it, I'm only learning at the moment, and a comment that saying a track to try solve this is sufficient, here are:

The figure is a sprite on code, the floor and the "door" are layers on tiled (floor and doors). I configured as 16x16 tiles, but configuring as 32x32 or more is the same.

The second image is the regular window, and the last is at the minimum size window, but the aspect is the same that on the more big window...If I stretched out the window, all is stretched, but the upper floor and the sprite maintains the same distance. I don't understand what is happening on the mobile version...


texts: Should I be concerned about assets being accessed by dumping VRAM?

texts:
I have heard many people tell me that a user can dump the VRAM on their GPU and get all the images in my game. Including all "Streamed" images. This includes most of my Menu graphics.

How would a user dump their VRAM and get the images? Is there software that does it?

Do I need to be concerned that this is possible and should I protect my game from it?


texts: What is involved with writing a lobby server?

texts:
So I'm writing a Chess matchmaking system based on a Lobby view with gaming rooms, general chat etc. So far I have a working prototype but I have big doubts regarding some things I did with the server. Writing a gaming lobby server is a new programming experience to me and so I don't have a clear nor precise programming model for it. I also couldn't find a paper that describes how it should work. I ordered "Java Network Programming 3rd edition" from Amazon and still waiting for shipment, hopefully I'll find some useful examples/information in this book.

Meanwhile, I'd like to gather your opinions and see how you would handle some things so I can learn how to write a server correctly. Here are a few questions off the top of my head: (may be more will come)

First, let's define what a server does. It's primary functionality is to hold TCP connections with clients, listen to the events they generate and dispatch them to the other players. But is there more to it than that?

Should I use one thread per client? If so, 300 clients = 300 threads. Isn't that too much? What hardware is needed to support that? And how much bandwidth does a lobby consume then approx?

What kind of data structure should be used to hold the clients' sockets? How do you protect it from concurrent modification (eg. a player enters or exists the lobby) when iterating through it to dispatch an event without hurting throughput? Is ConcurrentHashMap the correct answer here, or are there some techniques I should know?

When a user enters the lobby, what mechanism would you use to transfer the state of the lobby to him? And while this is happening, where do the other events bubble up?


texts: How to draw a screen space decal along a desired projection direction and control which surfaces it affects?

texts:
I am currently programming a complex 2D lighting system which calculates lighting in 3D space.
Something like what I want to achieve (Source @pixpilgames from Twitter):

I recently learned how to program ScreenSpace decals into a deferred rendering lighting pass and I ran into a few problems.
Decal in my case is a long box rendered in the light pass. Here's the shader code for it:
#shader vertex
#version 330 core
layout (location = 0) in vec3 aPos;

uniform mat4 u_Model;
uniform mat4 u_View;
uniform mat4 u_Projection;

out vec4 PositionCS;
out vec4 PositionVS;

void main()
{
    PositionVS = u_View * u_Model * vec4(aPos, 1.0);
    PositionCS = u_Projection * PositionVS;
    gl_Position = PositionCS;
}

#shader fragment
#version 330 core

layout (location = 0) out vec4 gLight;

in vec4 PositionCS;
in vec4 PositionVS;

uniform sampler2D gDepth;

struct Decal {
    sampler2D Texture;

    vec3 Color;
};

uniform Decal u_Decal;

uniform mat4 u_InvView;
uniform mat4 u_InvProj;
uniform mat4 u_InvModel;

void main()
{
    vec3 ndcPos = PositionCS.xyz / PositionCS.w;

    vec2 texCoord = ndcPos.xy * 0.5 + 0.5;

    float sampledDepth = texture(gDepth, texCoord).r;

    float sampleNdcZ = sampledDepth * 2.0 - 1.0;

    vec3 ndcSample = vec3(ndcPos.xy, sampleNdcZ);

    vec4 hViewPos     = u_InvProj * vec4(ndcSample, 1.0);
    vec3 viewPosition = hViewPos.xyz / hViewPos.w;

    // Transformation from view-space to world-space
    vec3 WorldPos       = (u_InvView * vec4(viewPosition, 1.0)).xyz;
    vec3 objectPosition = (u_InvModel * vec4(WorldPos, 1.0)).xyz;

    // Bounds check, discard pixels outside the wall in object-space
    if (abs(objectPosition.x) > 0.5) discard;
    else if (abs(objectPosition.y) > 0.5) discard;
    else if (abs(objectPosition.z) > 0.5) discard;

    objectPosition.y = 1 - objectPosition.y;

    gLight = vec4(texture(u_Decal.Texture, objectPosition.xy + 0.5).xyz * u_Decal.Color, 1.0);
}

First of all, whenever I draw a decal and rotate the camera, I noticed that decals are rendered onto multiple meshes colliding with the long box. Here's a picture:

I know why this is happening, I don't know the solution for it though. I believe it's because the Decal draws onto every pixel that it collides with, checks it's position and maps it.
Additionally, I want to be able to change the direction the decal is projected from (Aka mimic a projector).
Now the question is - Do I have to render all the geometry again into a depth buffer from decal camera's perspective and do all the respective calculations ( I have some ideas on how to compute that )? It would solve both of the problems because the underlying geometry wouldn't have any depth information and I could just change the projector matrices to my liking. It does require rendering the same geometry multiple times. Is there a better way to achieve the same effect?
Thank you!


texts: How should I use this 1D perlin noise function?

texts:
I'm trying to create a terraria like terrain with SDL2 and C++. For generating the terrain I'm trying to use the 1D noise function from here:
https://github.com/SRombauts/SimplexNoise

It's pretty basic and only takes a x value. I've been messing around with it for a while but can't work out what to pass into the function as the x value. I first tried passing just the x value of the column I'm finding the noise for. This just returned 0 every time. Next I tried passing a value between 0 and 1, so I passed it x / width. This sort of worked, but the wider I made the terrain, the more spaced out it became.

Hope you understand, what I do give the function for the x value?
Thanks in advance.


texts:
I have a container movieclip that contains my "game" and I would like to be able to drag the "camera" (i.e. the container clip) around, but I need it to have kinetic movement, i.e. feel more like native dragging and scrolling on an iOS device.

I can't seem to find anything that deals with this properly and in the manner that I am looking for, and I also would prefer to stay away from using any 3rd party packages if there are licenses involved. This is for personal side projects that may or may not see a form of commercial release, so I would rather a) learn how to code this myself and b) not have to rely and pay for third party libraries.

Any help would be greatly appreciated.

Thanks!


texts: How to randomly spawn object using instantiate

texts:
I'm trying to spawn objects which move in one direction until they hit a player or the barrier. The spawner is a cube which moves between two points to spawn the object at different locations.

The code I am using is:

#pragma strict
var speed : int = 1;
var direction : int = 1;
var shot : Transform;

var lastSpawn : float;
var nextSpawn : int;

function Update () {
    transform.Translate(Vector3(0, direction * speed * Time.deltaTime, 0));
    if (Time.time > lastSpawn + nextSpawn){
        Instantiate(shot, new Vector3(transform.position.x - 1, transform.position.y, transform.position.z), Quaternion.identity);
    }

    lastSpawn = Time.time;
    nextSpawn = Random.Range(1, 3);
}

All the prefabs and gameObjects are assigned correctly. Should this code work or am I doing something wrong?


texts: Adding a simple mix() destroys the framerate

texts:
I have a very simple shader and added linear fog via mix like this:

finalColor = mix(finalColor, vec3(0.5, 0.8, 0.95), vUVoutAndViewZ.z);

Note that the view Z distance is in the variable that also contains the UV coordinates, so the fog didn't even add a new interpolator.

Still, this one innocuous line brought the framerate on the OG Droid with the Power SGX chipset from 33fps to 22fps. Even the HTC Evo with the Adreno 200 GPU stays under 30fps. (The Adreno 205 is at a constant 60fps, but that thing is a beast).

The fragment shader itself is primitive (all values are hard-coded since it's a test shader):

precision mediump float;
varying mediump vec3 vUVoutAndViewZ;
varying lowp vec3 vNormalOut;

uniform lowp sampler2D diffuse;

void main() {
    lowp vec3 normal = vNormalOut;

    // Lighting
    lowp vec3 lightDir = vec3(0.5, 0.3, 0.5);
    lowp vec3 light = vec3(dot(normal, lightDir));

    lowp vec3 diffuse = texture2D(diffuse, vUVoutAndViewZ.xy).rgb;

    lowp vec3 finalColor = diffuse * light;

    // Fog
    finalColor = mix(finalColor, vec3(0.5, 0.8, 0.95), vUVoutAndViewZ.z);

    gl_FragColor = vec4(finalColor.xyz, 1.0);
}

I added the lowp/mediump declarations later (which added about 2fps), it works just as bad without them.

I refuse to believe that the PowerVR chipset is so weak that it can't handle a simple shader like this. There must be something stupid in this shader (like something implicitly swizzling a lowp register) that just completely messes up the unit.

ANSWER and EDIT:

Ellis has some fantastic information in the answer and the subsequent comments. In this particular case, it seems that mix() is flat-out broken. It brought the shader to 12 cycles (from 4) and 4 GPRs (from 2). I got back to 29fps by using this code instead:

lowp vec3 fogDiff = vec3(0.5, 0.8, 0.95) - finalColor;
fogDiff *= vUVoutAndViewZ.z;
finalColor += fogDiff;


texts: Why doesn't my jump script stop my player from jumping mid air?

texts:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Jump : MonoBehaviour {

public float jumpSpeed;

private Rigidbody2D _rigidbody;

private bool _isGrounded = false;

// Use this for initialization
void Start () {
    _rigidbody = GetComponent<Rigidbody2D> ();
}

// Update is called once per frame
void Update () {
    //if the jump button was pressed
    if (Input.GetButtonDown ("Jump") && _isGrounded) {
        _rigidbody.velocity = new Vector2 (
            _rigidbody.velocity.x,
            jumpSpeed
        );
    }
}

void OnCollisionEnter2D(Collision2D collision) {
    if (collision.gameObject.tag == "Ground") {
        _isGrounded = true;
    }
}

void OnCollisionLeave2D(Collision2D collision) {
    if (collision.gameObject.tag == "Ground") {
        _isGrounded = false;
    }
}

}

Its supposed to check if the player is on the ground, but it still lets my character jump unlimited times in the game.


texts: Drag and Flick Objects to any position (Unity3D)

texts: In unity, I have several boxes in one cluster. I want the user to be able to move any of these boxes to any position that they desire in the app, and have it stay there until they move it again. Also, I want the user to be able to flick any boxes and when it is flicked, have it bounce around the screen, as if it were trapped inside of the phone (but never leaving it). Any way I can do this? (This will be used for an Android Experiment)


texts: In ROBLOX, how can I check what is in front of me?

texts:
In ROBLOX Studio I need to check what part is in front of the model Freddy.

I need to set the variable called thingInFront to the part that is in front of the model Freddy so that I can decide whether I should allow him to walk through or not. This is my current code:

thingInFront = nil
if thingInFront.BrickColor == BrickColor.new('Black') then
    script.Parent.Parent.CanCollide = true
else
    if not thingInFront.BrickColor == BrickColor.new('Black') then
        script.Parent.Parent.CanCollide = false
    end
end


texts: How can I implement the ability to combine items into new items?

texts:
I would like to understand how to be able to combine items in a player's inventory, producing new items. For example, the scenario I have in mind is that the user picks up three key fragments and combines them to create a complete key.

What properties should I model on my item classes to support this behavior, and what should my basic algorithms be?


texts: Handling game states like Braid's timeshift or Shooter's Killcam

texts: me as very unexperienced game developer, I wondered how I could achieve something like re-winding the time in my game or jump back to a special moment (killcam) and replay it for the user.


texts:
I am working on a top-down, tile-based game (think 2D RPG). However, I would like to have trees that sway in the wind and shake a little if the player bumps into them!
How should I approach this? Is it achievable with trees that are composed of tiles and part of a tilemap?
Or should I exclude my trees from the tilemap and turn them into game objects instead?
If I were to turn them into separate game objects, would I then manually tweak their rotation/position to achieve the sway and shake, or is there some form of shader I can use?


texts:
I'm looking for a bullet that can collide with other bodies of the world but doesn't change direction according to collisions. I want the bullet to perform the collisions but without changing its own direction of moving. Basically I want to create a super bullet that can kill multiple bodies available in sequence. Would you have an advice?

If RayCastCallback is part of the solution, then could you tell me how to use it in this case?


texts:
Has anyone have experience implementing collision detection on server side? I am writing a top down 2D multiplayer game. All the players are constantly moving. I want to implement collision detection on the server side so at any time the server will know which player collide with which player and broadcast the result.

The problem is if I use brutal force collision detection to detect collision of every player the resource consumption on the server will be huge (my game updates 60 times a second).  I only have experience detecting collisions on client side where I can use broad-phase collision detection such as spatial partitioning. But I have thought about that on server side the server has to know the state of every player so detecting collisions only in a small area doesnt make much sense. So do I have other more efficient algorithm for collision detection on server side?

Here is how I do this:

I pick a moving sprite from the sprite array
do a spatial hashing for it and get some nearby sprites
based on the above method, I loop through the entire sprite array
and pick one by one to get some nearby sprites
I put all the results into a big array and it will store all the
    sprite for collision detection.

Because I need to send out state information to every moving sprite/entity I have to loop through the entire entity list to do spatial hashing for each one.

UPDATED:

I have get answers from gamedev.net forum. What I thought I should be doing was wrong. I don't need to compute all nearby entities for all the entities in one go. All I need to do is loop through the entity list and when I need to send out the nearby bucket list for an entity I do a spatial partitioning for that specific entity. I don't need to do this on every frame. In fact maybe I just need to do it 5 or 10 times per second.


texts: Position child on the edge of the parent circle while scaling unity3d

texts:
I have come across to some different situation. I have one circle sprite and i am rotating circle continuously while rotating i want to make circle smaller and larger.

I have one object on the edge of the circle i have made that object as child of the circle.

Now my problem is how to make this child object to stay at the edge while i scale circle sprite . I s this possible ?

Thanks.


texts: Player can only dash towards to the top right, but can't in any other direction?

texts:
I have a dash mechanic, but it only seems to be working when the player is going up, down, left, right, or to diagonally to the upper right. It won't work diagonally in any other directions, and I can't figure out why?
The super weird thing is this problem only happens when my game is running on my computer, not on my laptop?? Any ideas on how I can fix this? Thank you!
void FixedUpdate()
    {
        if (dashing)
        {
            myRigidbody.AddForce(direction * dashspeed/3,
            ForceMode2D.Impulse);
        }
        else
            myRigidbody.AddForce(direction* thrust/4.75f,
            ForceMode2D.Impulse);
            myRigidbody.AddForce(direction * -thrust * 7f,
            ForceMode2D.Force);
        }

void Update()
{
    direction.x = Input.GetAxisRaw("Horizontal");
    direction.y = Input.GetAxisRaw("Vertical");

    if (Input.GetKeyDown(KeyCode.Space) & powerSlider.value > 0)
      {
        if (direction.x != 0 || direction.y != 0)
      {
        if (CanDash) elapsedTime = 0f;
      }

if (elapsedTime < duration)
            {
                if (!dashing)
                {
                    CanDash = false;
                    dashing = true;
                }
                elapsedTime += Time.deltaTime;
                }

        if (elapsedTime > duration)
        {
            if (dashing)
            {
                dashing = false;
                elapsedTime = Mathf.Infinity;
                StartCoroutine("DashCoolDown");
            }
        }

        if (elapsedTime >= duration)
        {
            elapsedTime = Mathf.Infinity;
        }

    IEnumerator DashCoolDown()
    {
        Debug.Log("dash cooldown");
        yield return new WaitForSeconds(.45f);
        CanDash = true;
    }

}


texts: Accurate sprite rotation with mouse movement

texts:
I am using the current mouse position to aim the player sprite, but I am not getting the best results.

It will often by off by a noticeable amount, or even a complete ~180 off if I go from one side, through the player, to the other side.

boolean mouseMoved(int screenX, int screenY) {
    mouseX = screenX;mouseY = screenY;
    rot = MathUtils.radiansToDegrees * MathUtils.atan2((float)mouseY - (float)player.y, (float)mouseX - (float)player.x);
    if (rot < 0) rot += 360;
    player.setRot(rot);
}

Update 1:

When I am at 90/270 it seems to pickup the angle fine. But for 0/180, the angle is off depending on how far away my cursor is to a certain point (not the player's point).

Update 2:

Added in semi-fix, but I'm still having the same exact problem

Update 3:

I was mistaken the semi-fix wasn't actually a fix. I fixed it for real, though. The problem was that libgdx has (0,0) at the bottom left, but the InputProcessor has (0,0) at the top left. What I had to do was adjust the mouse position so that it's (0,0) was the bottom left. I did this by

mouseX = screenX;
mouseY = Game.HEIGHT - screen y;

This will give the player coordinates & mouse coordinates the same origin, and then the formula will work.


texts: PhysX Capsule Character Controller floating above ground

texts:
I am using PhysX Version 3.0.2 in the simulation package I'm working on, and I've encountered some bizarre behavior with the capsule character controller.

When I set the controller's height and radius to the appropriate values (r = 0.25, h = 1.86)it behaves correctly (moving along the ground, colliding with other objects, and so on) except that the capsule itself is floating above the ground. The actor will then bump his head when trying to get through a door, since the capsule is the correct height but also floating above the ground.

This image should illustrate what I'm going on about:

One can clearly see that the rest of the scene has their collision bodies wrapped correctly, it's just the capsule that's going wrong!

The stop-gap I've implemented is creating a smaller capsule and giving it an offset, but I need to implement ray-picking for the controller next so the capsule has to surround the character model properly.

Here's my character creation code (with height = 1.86f and radius = 0.25f):

NxController* D3DPhysXManager::CreateCharacterController( std::string l_stdsControllerName, float l_fHeight, float l_fRadius, D3DXVECTOR3 l_v3Position )
{
    NxCapsuleControllerDesc l_CapsuleControllerDescription;

    l_CapsuleControllerDescription.height = l_fHeight;
    l_CapsuleControllerDescription.radius = l_fRadius;
    l_CapsuleControllerDescription.position.set( l_v3Position.x, l_v3Position.y, l_v3Position.z );

    l_CapsuleControllerDescription.callback = &this->m_ControllerHitReport;

    NxController* l_pController = this->m_pControllerManager->createController( this->m_pScene, l_CapsuleControllerDescription );
    this->m_pControllerMap.insert( l_ControllerValuePair( l_stdsControllerName, l_pController ) );
    return l_pController;
}

Any help at all would be appreciated, I just can't figure this one out!

P.S. I've found a couple of (rather old) threads describing the same issue, but it seems they couldn't find a solution either. Here are the links:

http://forum-archive.developer.nvidia.com/index.php?showtopic=6409
http://forum-archive.developer.nvidia.com/index.php?showtopic=3272
http://www.ogre3d.org/addonforums/viewtopic.php?f=8&t=23003


texts: Actual use of sparse voxel octrees in a game engine

texts:
Looking for different ways to speed up my simple voxel system reducing the number of voxels and generated triangles, I stumbled upon these sparse voxel octrees.
Now, I read a lot about it: how do they work, their implementation, pro and cons especially regarding level of detail (that was my research purpose).
I am not an experienced game developer at all, until now I managed to create a simple yet working procedural generation based on chunks, contoured with Marching Cubes. As many other voxel engines, every chunk is formed by a tridimensional array of voxels, where each one has a density value and a position.
Before I even start trying to implement a Voxel Octree, my questions are:

1) How can I "translate" my world generation in order to use the octrees?

2) Should I use an octree for every chunk, or just one octree with "big" bounds containing the whole generated data?

3) Regarding my project, the aim is to create simple spherical world (fairly big, definitely too much without a LOD), are Voxel Octrees even necessary for my purpose?

Forgive my ignorance, I probably don't have the basic knowledge on these topics, but I still wanted to try this cool stuff.
Thanks!


texts: How can I draw text to the screen in directx 11 with slimdx?  In SlimDX.Direct3D10 there's a font class which can be used but there's no font class in SlimDX.Direct3D11.


texts: How do I serialise a mesh to a text file?

texts:
I'm building a game engine in OpenTK (OpenGL for C#). Is it ossible to take a terrain mesh (in any format) and convert it into a text file (or a really small character-filled file, no more than a few bytes). Then, afterwards, I'd take that file and generate the terrain from it.

The only reason I'm doing this is to save some memory on the computer. I think it would be more efficient if we had to quickly generate a crude terrain, and then smooth it instead of loading in a large mesh file.

Is this possible, and if so, how could I do it?


texts:
I'm working on game which uses LibGDX's Stage2d for GUI.

All textures for UI are packed into one texture atlas.

Fonts (BitmapFont) are generated in runtime by gdx-freetype for different locales and font sizes (at least 6 locales and 4 font sizes for each locale) and then placed into separate texture.

Game UI contains much different elements (strategy game with lots of numbers) - buttons, icons, text labels, which usually alternate between each other and trigger many texture switches when drawn. I wonder if there's any way to reduce the number of texture switches as it sometimes takes up to 5ms per frame for stage.draw().

The only way I see is to draw fonts only when all UI textures are drawn, when it is possible, but it will produce awful code and will harm the hierarchy of elements in stage.

I didn't merge textures (but thought of it), because:

Textures use different filtering (MipMapLinearNearest for UI textures, Linear for fonts) and it will require manual texture filtering switches or mess with stage2d overriden Label class.
UI texture already has a size of 2048x2048px, and I can't add all font size textures to it as it will require higher texture sizes, which are not supported by many old devices.

Is there any good way of solving this issue?


texts: How to get UE4 to correctly put my bundle identifier for iOS projects?

texts:
Each time I create a new project UE4 adds a generic bundle identifier to the iOS platform settings, that I always have to change to com.myname.[PROJECT_NAME] in order to be able to run the newly created project. So, I wonder how can I make UE4 to correctly auto detect this field from the picked provisioning profile.

I was thinking something like putting [BUNDLE_IDENTIFIER] (including the square brackets) but the editor crashes when I put that in the bundle identifier field.


texts: What are the possible options for AI path-finding etc when the world is "partitionned"?

texts:
If you anticipate a large persistent game world, and you don't want to end up with some game server crashing due to overload, then you have to design from the ground up a game world that is partitioned in chunks. This is in particular true if you want to run your game servers in the cloud, where each individual VM is relatively week, and memory and CPU are at a premium.

I think the biggest challenge here is that the player receives all the parts around the location of the avatar, but mobs/monsters are normally located in the server itself, and can only directly access the data about the part of the world that the server own. So how can we make the AI behave realistically in that context?

It can send queries to the other servers that own the neighboring parts, but that sounds rather network intensive and latency prone.

It would probably be more performant for each mob AI to be spread over the neighboring parts, and proactively send the relevant info to the part that contains the actual mob atm. That would also reduce the stress in a mob crossing a border between two parts, and therefore "switching server".

Have you heard of any AI design that solves those issues? Some kind of distributed AI brain? Maybe some kind of "agent" community working together through message passing?


texts: Does the latest DirectX SDK support both Direct3D 9.0c and 11?

texts:
1) What is the latest version of DirectX SDK?

2) For my purposes I need DirectX 9.0c SDK and DirectX 11 SDK. Do I need to install these libraries separately or last DirectX SDK package contains both of versions?


texts: Excluding geometry from a shadow casting light in deferred rendering

texts:
Is it possible to exclude geometry from a particular shadow casting light in a deferred rendering pipeline? If yes, can it be done correctly or are there limitations? This is mainly to reduce the rendering cost of each shadow casting light.

In UE4 this is currently not possible and one of the staff members simply replied with a rather cryptic message:

  "Unfortunately, this is not possible with Deferred Rendering."

Since we are rendering the depth map from the light's perspective, we should be able to exclude geometry from that render pass...? Are there edge cases that I am not thinking of when combining shadow casting lights with deferred rendering?

Link to forum post (and screenshot to follow in case the link goes down): https://forums.unrealengine.com/unreal-engine/feedback-for-epic/35667-exclude-object-from-a-specific-light


texts: Implementing match-making & community system for multiplayer games

texts:
These days, games often have multiplayer portals with chat channels & match making system for the multiplayer aspects of the game.

An example would be battle.net, magic the gathering online's chat rooms, halo etc.

Now, for the rest of us indie gamers that probably won't be able to spend much development effort on creating those back-ends from scratch, what options do we have?

I was thinking of something along the line of using IRC as the backbone of the system. From there, implement the "community" aspect, player tracking, game tracking and match making on top of that. It seems to be what the old battle.net (brood war era) used to be.

The question is, is this easy to do? What does it take to run an irc server, and I suppose this also requires writing an IRC client (which seems to have been done a lot these days?)?

If there are other ways as well (say, an open framework for this stuff), let's hear them too.


texts: How to draw objects that have a smaller Y axis first?

texts:
In my game there is a large 2D map of various objects. Example. As you see, upon creation objects of the same type (trees for example) are placed correctly, but objects of another type (enemies) are placed on top of the no matter the position. Now, how can I arrange that everything is drawn according to it's position?

Another example (the dog should be drawn before the tree, and not on top of it):


texts: How do I properly use Unreal's Lens Distortion plugin?

texts:
I am trying to use UE's LensDistortion plugin (seems like it's bundled with the engine but only put to use in the Compositing sample project), and following the same workflow as the sample. Essentially, the idea is to create a camera model using the standard distortion parameters (radial, tangential etc.). The plugin then 'draws' a UV displacement map according to these params, and the original image is then distorted by adding these displacements to the corresponding pixels.

The level blueprint creates the displacement map and a material uses this to distort a given image (the distortion values are written only on the R and G channels, hence the mask in the material). Both are shown in these images:

I don't understand the output I am getting. Seems to me the material function somehow ends up addressing invalid pixel values (less than 0 or greater than 1, assuming UV range is 0-1), so I see a strange 'repeating' of the image, as below:

The way the whole canvas is distorted makes sense spatially: but the pixel values corresponding to those locations are wrong. Am I doing something wrong in my material? How do I properly use this distortion plugin?


texts: Unity particles rendering on top of camera space UI

texts:
I'm using LWRP in Unity 2019.1.12f1. The UI is in Screen Space - Camera. The shader used for the particles is Lightweight Render Pipeline/Particles/Unlit (Transparent, Premultiply).

Any ideas?


texts: How to make a world-to-player inventory system?

texts:
I am running into an issue of trying to implement an inventory system within XNA (doesn't really matter, could be any platform) but so far. Here is the issue I am trying to wrap my head around:

How can I get an item from the world (think when you kill a monster it drops armor) and get it into my player's inventory?

If an inventory is just a list of items, technically, how could I get Steel Sword from the world into my player's inventory without having a class do more than one thing?

I currently have an item struct, which contains a unique hex value, a count of how many items there are (for stackables, like arrows) and a Texture for rendering within the inventory, and some other unimportant properties (name, description, etc).

It would be bad design if I had to modify my existing item class to house a world position, along with collision detection (don't want the item falling through the earth).

Thanks for any considerations!


texts:
I'm moving my character controller using Euler integration like this:

Vector3 originalPos = transform.position;
Vector3 acceleration = Physics.gravity;
velocity += acceleration * Time.deltaTime;
characterController.Move(velocity * Time.deltaTime);

This works consistently on different framerates. I also implemented simple rope physics by pulling the controller back when its outside the radius. I then (on the same frame) calculate the new velocity from the new and old positions.

if (outsideOfRadius)
    Vector3 newPos = anchorPos + (transform.position - anchorPos).normalized * ropeRadius;
    Vector3 oldPosition = transform.position;
    characterController.Move(newPos - oldPosition);
    velocity = (newPos - originalPos) / Time.deltaTime;
}

This is the problematic part because it behaves significantly different on different framerates. This causes problems when my character controller lets go of the rope and tries to land on a platform. The distance covered on 30 fps is less than on say 60 fps or higher.

Is there a way I could make this work more consistently across different framerates?


texts: Formula for converting ratio of current device to target device

texts:
I am designing my (Android/OpenGL ES 2.0) app on one device and want it to run all all other devices while keeping the screen ratio of the development device (so the image doesn't stretch / squash), by altering the GLViewport ratio of the current device to match the development device, thus having either pillarboxing or letterboxing.

The only values I know for sure, are the physical screen ratio of the development device (in landscape) and the current device (regardless of orientation).

Please refer to my other question (which was regarding centering the viewport once I'd set it's size here: Centering GLViewport position within physical screen ) - on further study I see that my maths is somewhat incorrect (maybe too simplistic?) and the  viewport doesn't seem to be getting sized correctly on all targets.

Is there a 'formula' for doing what I'm trying to do?

I get my ratio by doing the following:

float ratio = width / height;

Then I simply want to set my viewport like so:

GLES20.glViewport(0+offsetX, 0-offsetY, widthToUse, heightToUse);

The offsetX and Y values I think I'm OK with as per my previous Q.  It's the 'widthToUse' and 'HeightToUse' that I can't seem to work out properly.

You can see from my other question, that I'm working out the 'widthToUse' value my multiplying the current device's height by the [development devices] ratio.  However, this doesn't work on all devices as the resulting figure could actually be larger (wider) than the physical screen.

Here are some examples of what I'm trying to achieve, for illustration (ratio's much exaggerated here)

In the pics, the black outter-box is the physical screen of the devices and the blue square is the viewport.

Side note: I realise that my game will most likely be locked to a particular orientation (the one I'm currently developing will, eventually be locked to landscape mode) so I probably don't need to handle orientation changes, however, I would like to know, if possible, how to display at a particular ratio in either orientation in case this is required in the future.  So in other words, I may develop an app for landscape, but 'allow' it to run in portrait (albeit with large letterboxing).

Also I know there are similar questions on here, but I've read them over and over and they either don't apply to my situation (or way of doing things), or I'm otherwise not able to get my answer from them.


texts:
I'm an absolute beginner with game development and all I know about collision avoidance/resolution, I learnt it on or through this site in the past week... so don't hesitate to correct me if what I'm asking here is based on wrong assumptions / misunderstanding. I tried of my best to be clear, but that said, the subject is still novel to me.

Vehicles

In my game, I have vehicles that move autonomously. They are placed in a 3D space, and their motion is governed by a number of variables which are different for each vehicles. The one of interest here are primarily:

Only forward motion.
A speed that can vary between min & max, but whose min is not (even close to) zero.
A steering radius that is dependent from the speed (the higher speed, the larger radius)
Two maximum accelerations (for decreasing and increasing speed)

Goal

My goal is to implement some sort of AI that will a 100% accurate collision avoidance (i.e. I will be sure that the vehicles will never ever collide).

Design

Although I would prefer more the idea of having the AI "onboard" (i.e. each vehicle having it's own "collision avoidance AI", eventually querying and/or sending messages to other vehicles) it is also possible for me to implement the CA AI at a central level (dispatching commands to the vehicles).
In most of the cases, the vehicle will simply have to steer clear of each other in any direction, but under certain circumstances, they will have to avoid collision and going towards the same target

What I found so far and where I got stuck

Within the many many links I found in other questions on this very site, I found of particular use these ones:

Collision between pool balls
Unalligned collision avoidance
Queuing

While these three links "opened my eyes" in many ways, it is not immediately clear to me how to use that information in my case. In particular article #2 only "tries" to prevent collision (but collisions do happens time to time). While article #3 needs to stop vehicles sometimes to prevent collisions.

What I also noticed, is that the collision avoidance algorithms linked above use a "instant projection" of linear speed to check if something is on the way of the vehicle. I was wondering if this is enough in my case or if I had to project my position in a more realistic way (e.g.: If I am 60° into a steering 90° to the right, I should calculate my position for the rest of the 30° of the curve, and then assuming linear motion).

Finally, I am particularly afraid of deadlocks. In other words: although the density of vehicles in the world will be fairly low, I am worried that given a certain numbers of vehicles converging towards the same point, once they will realise they are on a collision course, any evasive manoeuvres will be impossible as it would bring the vehicle on a collision path with some other ones.

Question

How can I reach my "goal"? An in depth-explanation is of course very much appreciated, but links to external resources would also be of great help (I'm sure I'm not the first with this problem, but probably I used the wrong keywords to search the web?)

Thank you in advance for your help!


texts: XNA - Accessing primary View, Project, World matrices from a game component

texts:
In XNA4, I have an EnemyManager class that takes care of all of the enemies.  When it comes time to draw, however, it needs access to the game's main View, Projection, and World matrices.

I could just pass a reference to my DavesGame object down in there, but that seems like bad design.  I could put them in an interface and expose them as a game service.

I'm leaning towards the latter, but I'm wondering what the correct & elegant way to do it is.

Thanks!
Dave