texts: Binding an Instance Matrix with an InputLayout

texts:
If I want to bind an instance matrix to a vertex shader, how do I go about it?

For example, here is a super-simple VS input:

struct VS_IN {
    float4 Position : POSITION;
    row_major float4x4 WorldMat : INSTANCE_TRANSFORM;
};

How would the corresponding bindings look when creating the ID3D11InputLayout?

I figured it would be something akin to:

D3D11_INPUT_ELEMENT_DESC[] bindings = ...;
bindings[0] = {
    "POSITION", // SemanticName
    0U, // SemanticIndex
    DXGI_FORMAT::DXGI_FORMAT_R32G32B32A32_FLOAT, // Format
    0U, // InputSlot
    0U, // AlignedByteOffset
    D3D11_INPUT_CLASSIFICATION::D3D11_INPUT_PER_VERTEX_DATA, // InputSlotClass
    0U // InstanceDataStepRate
};
bindings[1] = {
    "INSTANCE_TRANSFORM", // SemanticName
    0U, // SemanticIndex
    DXGI_FORMAT::DXGI_FORMAT_R32G32B32A32_FLOAT, // Format
    1U, // InputSlot
    0U, // AlignedByteOffset
    D3D11_INPUT_CLASSIFICATION::D3D11_INPUT_PER_INSTANCE_DATA, // InputSlotClass
    1U // InstanceDataStepRate
};
bindings[2] = {
    "INSTANCE_TRANSFORM", // SemanticName
    0U, // SemanticIndex
    DXGI_FORMAT::DXGI_FORMAT_R32G32B32A32_FLOAT, // Format
    2U, // InputSlot
    0U, // AlignedByteOffset
    D3D11_INPUT_CLASSIFICATION::D3D11_INPUT_PER_INSTANCE_DATA, // InputSlotClass
    1U // InstanceDataStepRate
};
bindings[3] = {
    "INSTANCE_TRANSFORM", // SemanticName
    0U, // SemanticIndex
    DXGI_FORMAT::DXGI_FORMAT_R32G32B32A32_FLOAT, // Format
    3U, // InputSlot
    0U, // AlignedByteOffset
    D3D11_INPUT_CLASSIFICATION::D3D11_INPUT_PER_INSTANCE_DATA, // InputSlotClass
    1U // InstanceDataStepRate
};
bindings[4] = {
    "INSTANCE_TRANSFORM", // SemanticName
    0U, // SemanticIndex
    DXGI_FORMAT::DXGI_FORMAT_R32G32B32A32_FLOAT, // Format
    4U, // InputSlot
    0U, // AlignedByteOffset
    D3D11_INPUT_CLASSIFICATION::D3D11_INPUT_PER_INSTANCE_DATA, // InputSlotClass
    1U // InstanceDataStepRate
};

In the example above, I'm increasing the InputSlot value with each 'row' of the instance matrix, because I would expect that each row of the matrix would take up the next 128-bit input register.

However, in other examples I've seen on the internet, people seem to increase the SemanticIndex with each row instead. I thought that might because they declare the input as four float4 fields instead of a matrix, but then I looked at this question, and that doesn't seem to be the case.

Anyway, to cut to the point, if I want to use VS_IN in the format I've provided, what is the correct way to lay out the input elements?


texts: COLLADA, loading, the modelling/animation process?

texts:
So, we're making a game in C++ using SDL - a TDS. It was originally intended to be 2D, but our lead programmer wanted to redo the engine and make it 3D. And, now, we really don't know how to go about it.

What model and animation formats should we be using? We're considering COLLADA, and if I understand correctly, we export models as .dae, then the animators import them, make the animation, then export as .dae. We then load them into the game using AssImp, then render, am I right? Or does the animator build a rig, save it as .dae, then the modeller builds on that, saves as .dae, then the animator makes the animations?

Thanks a lot for any help, really appreciate it.


texts: Black or White Border/Shadow around PNGs in SDL/OPENGL

texts:
having the same issue as this: Why do my sprites have a dark shadow/line/frame surrounding the texture?
however, when I do the fix suggested there (changing GL_SRC_ALPHA to GL_ONE) it just replaces the black border with a white border on the images. was able to find a lot of results on google from people finding black borders and fixing it with the GL_ONE change, but no results for white borders.
any ideas?

heres some of my relevant code.

init:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glEnable(GL_DEPTH_TEST);
glEnable(GL_MULTISAMPLE);
glEnable(GL_TEXTURE_2D);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);
glAlphaFunc(GL_GREATER, 0.01);
glEnable(GL_ALPHA_TEST);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable(GL_BLEND);

when each texture is loaded:

glGenTextures(1, &textureID);
glBindTexture(GL_TEXTURE_2D, textureID);
gluBuild2DMipmaps(GL_TEXTURE_2D, GL_RGBA, surface->w, surface->h, GL_BGRA, GL_UNSIGNED_BYTE, surface->pixels);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

thanks!


texts: Constrain parent node transform to child bounds

texts:
If I have some node rendering tree set up, where a node basically has a draw method to render things, and a transform, represented as a 3x3 matrix, with scale and translation.

Now, I would like to constrain the scale and translation of that node (constrain the transform basically) to the bounds of the child. So if the child is a 300x400 image, I want the root to only scale large enough to see the whole image, not more. So does the translation, that it does not go beyond the image bounds. How can I achieve that? Which sorcery of mathematics must I read about to learn this? Affine transforms or what?


texts:
Context :
I'm writing a 2D mobile game in Unity where the graphics are essentially black lines drawn on a background image plus some lighting. Running full RGB calculations for every step seems like a waste of processing power. What I'd like to do is render everything in [grey, alpha] and then multiply by the sRGB background image in a separate shader at the end. Actually, ideally, I'd like basically to specify custom components like [grey, highlight, additive, alpha], each of which can be ignored in a given pass, and then do a custom operation with those when I apply the background image, like ceil(src*(dst.r + dst.g)) + half4(dst.b). I can figure out how to do that between 2 textures within a shader, but not between texture and screen (a.k.a. src & dst).
Question :
Basically, is there a way of writing a per-component replacement of the built-in Blend functions? Because something like Blend SrcAlpha OneMinusSrcAlpha only works with the full float4 or half4 vectors.
Or do I need to grab the screen like a texture and handle it within a pass block, and then do Blend Off or Blend One Zero? Or do something with RenderTextures perhaps? My intuition suggests that that would undo some of the efficiency I'd gained in previous steps, though...?


texts: How to move an object using X and Y coordinates in JavaScript

texts:
I am making a 2d baseball game with JavaScript and HTML5 and am trying to move an image that I have drawn with JavaScript like so:

    //canvas
    var c = document.getElementById("gameCanvas");
    var ctx = c.getContext("2d");
    //baseball
    var baseball = new Image();
    baseball.onload = function() {
        ctx.drawImage(baseball, 400, 425);
    };
    baseball.src = "baseball2.png";

I'm not sure how I would move it though, I have seen many people seem to just type something like ballX and ballY but I don't understand where the actual x and y definition comes from. Here is my code so far:

http://jsfiddle.net/xRfua/

I have a different image source but it is a local source so I didn't include it. Thanks in advance for any help at all!


texts:
By "2.5D" I mean the art style in games such as Roller Coaster Tycoon, Age of Empires 2 or Fallout 1 and 2:

Everything in the games appears to be created with a "pixel art"-like tool. Am I correct?

How are the moving characters are created though? Take AoE2: For much of my childhood I was convinced that the soldiers, villagers and other characters were 3D!

Could someone explain:

What dimensionality are the characters?
What sort of software package could I use to create them?


texts:
I'm coding a relatively simple VN with RPG elements in Ren'py, with little prior programming knowledge. There's one aspect that I can't simplify further because it's important to the game's branches, but that I'm not sure how to enact.

There are four traits/stats the main character can have in this game:

Viciousness
Intelligence
Creativity
Charisma

You have two of the four. They don't have levels or anything -- it's simply 'do you have this trait or not'. You can't change traits after picking the two of them, you just have e.g. a Creativity/Viciousness build for the rest of that playthrough.

With my limited prior knowledge, the only way I can figure out how to enact this is with a giant mess of if-else statements. You would, for instance, start with:

default Intelligence = False

Then if you pick Intelligence as one of your stats:

$ Intelligence = True

Then, for anything further that requires Intelligence (or precludes it, as the case may be):

if Intelligence = True

But this sounds like a giant overcomplicated mess if I'm doing it for each and every time the game checks if you have/don't have a trait. There's a better way. What is it?


texts: How does an AAA graphical workflow look like?

texts:
So this is how I understand it:

An artist models the thing in Zbrush or Mudbox. It now has 10+ million polygon. He exports it in Zbrush as a normal map + low poly model. (this works?)
The model now has ~20-30k polygons?

Now the artist imports the low poly model into 3dsmax or Maya, applies the normal map somehow as well, so it will look in the modelling program just like it would ingame. Then he starts adding bones and then skins the model.
Then animation, then export. As I understand it, somehow all the textures of a model get "baked" into a single texture which the engine will understand?

Do people still make textures in Photoshop and then UV unwrap the model by hand, then apply the textures? I never understood how someone can make the laid out texture of a face in Photoshop, and somehow he knows that it will look good on the model. Do they paint the textures in Zbrush? But Zbrush doesn't have all the photoshop tools.

What if I want to make a terrain, or an indoor level? Do I just model the whole thing in 3dsmax? What if the textures don't show up in the engine the way they do in 3dsmax?


texts: In Unity for Android, how do I create touchable buttons?

texts:
I'm making a test game for Android in Unity 5, and I want to add left-right control buttons like the circles below, to move an object left or right.

(source: raywenderlich.com)

How can I do this?

Sorry if this question is basic. I'm new to Unity and I don't understand the methods of existing tutorials.


texts:
I'm trying to code a simple game via OpenGL C++.
I've implemented a point light, parallax effect with textures, objects from blender etc. but I seem to have an issue with my percentage closer filtering implementation. The shadows are casted on top of a floor which is just a rendered texture below my objects. Im pretty new with how shadows work in OpenGL. This is my attempt to achieve pcf in the fragment shader:
in vec4 shadowMapCoord;

layout(binding = 10) uniform sampler2D shadowMapTex;
// area around each fragment that will be sampled
const int pcfCount = 10;

void main():
float shadowFactor = 0.0f;
for (int x =-pcfCount; x <= pcfCount; x++){     // x offset from inner pixel
        for (int y =-pcfCount; y <= pcfCount; y++){     // y offset from inner pixel
            shadowFactor += textureProjOffset(shadowMapTex, shadowMapCoord, ivec2(x,y));
        }
    }
    float visibility = shadowFactor;

Does someone maybe spot any issue with my implementation of textureProjOffset() or can I achieve pcf with another type of implementation?


texts: Limiting x and y movement so you can't go off camera

texts:
So I want to make an on rails shooter like that of Star-Fox in the Unity engine. What I would like to do is limit the ship from moving off the screen. You move along the X and Y axis so i wont have to keep these invisible colliders in their place but I cant get another way to work.

and I know I have to find a way to convert camera space to world space I just can't find a way how.

This is my current controller and I commented a few failed attempts.

also I'm using a perspective camera and I'd like to keep the rigibody movement if possible.

public float turnSpeed = 10;//Horizontal

//private Vector3 moveDirection = Vector3.zero;

public Rigidbody rb;
void Start()
{
    rb = GetComponent<Rigidbody>();
}
void Update()
{//Screen.width
    //transform.position = new Vector3(Mathf.Clamp(transform.position.x, -holdMyRatio, holdMyRatio),
   //                                  Mathf.Clamp(transform.position.y, -holdMyRatio, holdMyRatio), 0);
    //CharacterController controller = GetComponent<CharacterController>();
    rb.AddRelativeForce(Vector3.right * turnSpeed * Input.GetAxis("Horizontal"));
    rb.AddRelativeForce(Vector3.up * turnSpeed * Input.GetAxis("Vertical"));
  //  moveDirection.x = Input.GetAxis("Mouse X") * turnSpeed;// * Time.smoothDeltaTime;
   // moveDirection.y = Input.GetAxis("Mouse Y") * turnSpeed;// * Time.smoothDeltaTime;
  //  controller.Move(moveDirection * Time.smoothDeltaTime);
}


texts:
I'm writing a game in Java and am struggling to think how to appropriately manage character's bodies.  My current structure is, in relevant part:

public class Character{
    private Body body;
    private Race race;
}

public class Body{
   private Leg rightLeg;
   private Leg leftLeg;
   //etc

   //the constructor takes a single Race argument and constructs a default
   //body for a member of that race

   public Leg getRightLeg(){
       return rightLeg;
   }

   ///etc
}

public class BodyPart(){
  //assorted instance variables and appropriate getters and setters
}

public class Leg extends BodyPart(){
  //leg specific stuff
}

public class AdvancedLeg extends Leg{
    //various different ways of improving body parts - magical enhancement
    //for example.  There are a number of these classes
    public AdvancedLeg(Leg l){
        //make leg better
    }
}

But this isn't working  because each character must have the same basic body structure - 2 arms, 2 legs, one torso, one head, etc.  Sure, I could have public class QuadrapodBody or similar (and make Body into an interface) but I certainly don't want to be getting in to public class OneHeadTwoRightArmsOneLeftArmOneRightLegOneLeftLegBody implements Body.

In essence I want to be able to flexibly assign body plans to each character and be able to manage getting body parts without having to write a potentially infinite number of classes each with a subtly different set of instance variables and getters/setters.

Hopefully my question is clear enough.


texts: "Compose PSM Master Package" doesn't do anything

texts:
I made a game for PlayStation Mobile, and I'm ready to build the master for publishing.

Per the mastering instructions, I have filled out all the required information in app.xml, created app keys for this specific application, and built on Release.

And now that I click on "Compose PSM Master Package", the PSM Studio pretty much does nothing. I have .psdp and .pspp files in the Release folder, but I don't get a .psmp file for submission.

I think all my account information is okay, including bank account information.

I also tried deleting and recreating the app keys, but "Compose PSM Master Package" still refuses to do anything.

What am I missing? What kind of interaction should I expect from "Compose PSM Master Package"?


texts: Why are Visual Studio and VSCode not giving me a dropdown list of methods and options etc?

texts:
I am using VSCode but I have also tried Visual Studio 2019 to write code for Unity, but when I'm writing the lines I don't get dropdown menus with for example the methods this class holds. Or objects. Or it's properties. etc.: basically, IntelliSense is not working.

Is there a setting that I need to enable in order to get those? Since I've seen everyone who use VSCode and visual studio get these dropdown menus.


texts: Should I give each character its own VBO or should I batch them into a single VBO?

texts: I'm making a 3D first person game. Should I give each character its own VBO or should I batch all characters into a single VBO?  What are the pros/cons?


texts: What's the difference between an "SDK" and an "engine?"

texts: In delving into game programming, I have encountered both "SDKs" and "game engines". What are their relationships and differences to each other?


texts: How to stretch screen image to fit higher res monitors set to lower resolutions with Unity?

texts:
Using Screen.SetResolution(width, height, windowMode); , how might I stretch the image to match the monitor size? I've noticed this problem occurs both with this line of code and also the default unity configuration launcher.

No body seems to discuss this issue which is odd to me.


texts: Heightmap vertex list to vertex + index list

texts:
Right now I'm trying to load a heightmap into my LWJGL application. I load it like that into a float[][] array and I can read the height value at a given x and z position in the map:

public class HeightMap
{

float[][] heightMap;

public HeightMap (String fileName)
{
    int height, width;
    try
    {
        BufferedImage image = ImageIO.read(getClass().getResourceAsStream(fileName));
        heightMap = new float[image.getWidth()][image.getHeight()];
        for (int x = 0; x < image.getHeight(); ++x)
        {
            for (int z = 0; z < image.getWidth(); ++z)
            {
                heightMap[x][z] = new Color(image.getRGB(x, z)).getRed() / 255f;
            }
        }
    }
    catch (IOException e)
    {
        e.printStackTrace();
    }
}

My problem is that I don't understand how to create the float[] vertices and byte[] indices arrays that I can pass to the vao and iao(and also texture coords (tco)).

Hope you can help me,

bebe


texts:
I'm trying to do realtime lighting, and my shadows are acting very strange. When I project a spotlight out from the camera (like a flashlight in a first person game) my shadows show up as 3D skews of the objects, and I can actually clip through them if I move the camera in the right way... if I detach lights from the camera and just have them sit in one position, I don't seem to have this issue (cylinder to the right is just the model Im using for the flashlight... its attached to the camera):

All objects have Cast Shadows set to "On"
All objects have Receive Shadows checked
All objects have Light Probes and Reflection Probes set to "Blend Probes"
All objects have Motion Vectors set to "Per Object Motion"
All objects have Lightmap Static unchecked
All objects have Dynamic Occluded checked
All lights have Mode set to "Realtime"
All lights have Shadow Type set to "Soft Shadows"
All lights have Realtime Shadow Strength set to 1
All lights have Realtime Shadow Resolution set to "Very High Resolution"
All lights have Realtime Shadow Bias set to 0 (changing this doesn't seem to effect the issue)
All lights have Realtime Shadow Normal Bias set to 0 (changing this doesn't seem to effect the issue)
All lights have Realtime Shadow Near Plane set to 0.1 (changing this doesn't seem to effect the issue)
All lights have Draw Halo unchecked
All lights have Render Mode set to "Auto"
All lights have Culling Mask set to "Everything"
Camera has Clear Flags set to "Solid Color"
Camera has Background set to #000000
Camera has Culling Mask set to "Everything"
Camera has Projection set to "Perspective"
Camera has Field of View set to 60
Camera has Near Clipping Plane set to 0.3
Camera has Far Clipping Plane set to 1000
Camera has Viewport Rect set to 0, 0, 1, 1
Camera has Depth set to 0
Camera has Rendering Path set to Use Graphics Settings
Camera has Occlusion Culling checked
Camera has Allow HDR checked
Camera has Allow MSAA checked
Camera has Allow Dynamic Resolution unchecked
Camera has Target Display set to "Display 1"
In Player, Rendering Color Space set to "Linear"
In Player, all Rendering Auto Graphics APIs checked (win, mac, lin)
In Player, Rendering Static Batching checked
In Player, Rendering Dynamic Batching checked
In Player, Rendering GPU Skinning unchecked
In Player, Rendering Graphics Job (Experimental)* unchecked
In Player, Rendering Lightmap Encoding set to "High Quality"
In Graphics, all Built-in Shader Settings are set to "Built-in shader"
In Graphics, Shader Stripping Lightmap Modes is set to "Automatic"
In Graphics, Shader Stripping Fog Mode is set to "Automatic"
In Graphics, Shader Stripping Instancing Variants is set to "Strip Unused"
In Graphics, Preloaded Shaders Size is set to 0
In Lighting, Skybox Material is set to "Default-Skybox"
In Lighting, Sun Source is set to "None (Light)"
In Lighting, Environment Lighting Source is set to "Color"
In Lighting, Environment Lighting Ambient Color is set to #000000
In Lighting, Environment Lighting Ambient Mode is set to "Realtime" (and the dropdown box is greyed out, so I can't change it)
In Lighting, Environment Reflections Source is set to "Custom"
In Lighting, Environment Reflections Cubemap is set to "None (Cubemap)"
In Lighting, Environment Reflections Compression is set to "Auto"
In Lighting, Environment Reflections Intensity Multiplier is set to 0
In Lighting, Environment Reflections Bounces is set to 1
In Lighting, Realtime Global Illumination is checked
In Lighting, Baked Global Illumination is unchecked
In Lighting, Fog is unchecked


texts: Snapping of irregular images in iphone puzzle app

texts: I am working on puzzle app in which i need to snap irregular shapes as they come in contact of one another as i am new to game development so i dont have any idea how to achieve this functionality in my app.Any suggestion would be highly appreciated.


texts: Per frame: Many draw calls with fewer total vertices vs fewer draw calls with more total vertices?

texts:
Is there any chance draw calls like XNA's Graphics.DrawIndexedPrimitives has an extremely low overhead and performance issues are more than likely due to the complexity of the meshes?

If I had a million quads to render, how significant in XNA is it to pack the vertex buffer as full a possible before calling the draw (as an example)? I know many other methods of culling, vertex welding, etc to lower the count would probably have an even bigger impact if/when they are possible, but just for curiosity's sake lets not hit on those topics for this question.

My hope is that XNA indeed has a low overhead on most draw calls and pretty much buffers the 'transactions' necessary to the GPU in some kind of load balancing type way.

Thanks for any and all help.


texts: Why do so many game websites end in game.com?

texts:
This is my first question here, so please tell me if I'm doing something wrong :)

I've recently noticed that many game websites end in 'game.com' (www.helloneighborgame.com, www.gunpointgame.com, etc). Is there a specific reason for this, or is it just a coincidence?

I've also noticed that many of these titles are usually indie games. Is it a common thing to do?


texts: Changing button position makes it move drastically

texts:
I have a button prefab that I'm instantiating like so:

GameObject button = Instantiate(Resources.Load("UI/Canvas/Button"), ReferenceToCanvasPanelRectTransform.transform) as GameObject;

This part works fine and the button is centered in the panel.

I would like to move the button a little bit though and lets say that the position of the button right now is (0, 0, 0).

If I get the button's RectTransform and attempt to move it like so:

RectTransform btn = button.GetComponent<RectTransform>();

btn.position = new Vector2(-20, 20);

it makes the button's position move to (-1051.05, 1149.5, -5679).

Why does it move so drastically and why does the Z position even change?


texts: Obscure primitive data types against cheating

texts:
im trying to create lightweight value obscurer, against possibility to blatantly change primitive values in memory editor. Such as cheat engine. Here's what i have to far.

/// <summary>
/// Obscure for type int.
/// </summary>
public class ObscuredInt{

    public ObscuredInt() {
        this.value = 0;
    }

    public ObscuredInt(int value) {
        this.value = value;
    }

    private int _a;
    private int _b;

    /// <summary>
    /// Current obscure value.
    /// </summary>
    public int value {
        get {
            return _a + _b;
        }
        set {
            _a = Random.Range(int.MinValue, int.MaxValue);
            _b = value - _a;
        }
    }
}

usage

ObscuredInt health = new ObscuredInt(5);
health.value = 10;

printInConsle(health.value);

This works by simply never storing actual value, but rather a combination of two integers, which sum represents the value. That way the value is actually never cached long time in the memory. So finding it in a primitive way using cheat engine is not possible.

My question

I've seen other examples of obscuring, which involve conversion to binary or string hashing or other quite heavy operations.

This example is of course much more lightweight, how is this example worse than more advanced hashing or conversions. What flaws do you see with this example? What can you suggest?

Thank you


texts:
I am writing a visual novel on my desktop, using SDL and C++. I'm having trouble handling my sprites, in SDL.

I am getting the "not enough video memory" error when I create all of my sprites to texture at once. I load the textures in the background process, while it was being rendered. I forgot that textures should be created in the main rendering thread, but if I load the image file in the background and load the textures in the foreground, the screen freezes. How do I fix this?
Our target base resolution is 1980x1080 pixels; that is why I am getting the "not enough video memory" error. The sprites should be detailed and huge in a single sprite frame, as they should look like 2/3 in the screen. That means my sprite sheet is as huge as 8k x 2k or a single row of sprites.

How should I handle it? Do I need to resize our base resolution to a lower size, and just do the bitblock resize of the entire screen/canvas to the screen? Do we do the work, or base the art on a lower screen resolution instead and just resize it to fit the player's screen at runtime? My problem, if we work at smaller resolutions and just resize at runtime, is that it might become blocky or blurry.

The sprite sheets are too big, because the screen resolution is too big. We have one hundred sprite sheets that can not be loaded together, but cannot be loaded in a separate thread. How do I handle a lot of big textures for a visual novel?


texts: What is the name of this game design style?

texts:
There is a style of game design which is shared by many mobile puzzle games where a game is divided into an small number (3-10) of main chapters and each one has a grid of a larger number of short levels, a famous example is Angry Birds. I would like to know what this style of game design is called.

I don't remember any game with this style from my childhood, this style seems to be relatively new.

Edit: SkyRoads (1993) has a relatively similar level selection menu.


texts: How do I rotate individual shapes on an html5 canvas?

texts:
So I am doing a basic Asteroids clone as an intro to HTML5 canvas. I want to be able to rotate the main player while leaving the other objects on screen alone. Currently I am using transform and rotate on the canvas to allow the player to move, which works well.. but since it rotates the entire canvas it affects other shapes on screen. Is the general way to do this, to instead have each shape keep track of its own positions and perform manual transformations on the shape itself while leaving the canvas alone? Can I possibly give my shape a CSS class and control it on its own that way? Should I be using more than 1 canvas so that I can control rotations individually? Not sure what the accepted way is to handle multiple on screen images/shapes all with their own movement and rotation patterns simultaneously. My gut is telling me to have each shape track its own positions and just perform the math on the shape object itself... but then I would not be using the Canvas APIs rotate at all.

My app currently: https://jsfiddle.net/0o2pwLhn/

And a code snippet for the rotation:

// player draw test
    function drawShip() {
        ctx.beginPath();
        ctx.moveTo(shipStartX, shipStartY);
        ctx.lineTo(shipStartX + 8, shipStartY + 20);
        ctx.lineTo(shipStartX, shipStartY + 15);
        ctx.lineTo(shipStartX - 8, shipStartY + 20);
        ctx.lineTo(shipStartX, shipStartY);
        ctx.translate(shipStartX, shipCenterY);
        ctx.rotate((Math.PI / 180) * shipMoveDegree)
        ctx.translate(-shipStartX, -shipCenterY);
        ctx.stroke();
        ctx.closePath();
    }

Do the save() and restore() methods on the CanvasRenderingContext2D maybe come into play here? I have tried experimenting with it but havent gotten anywhere. I tried using save() and restore() but the issue is that once I restore, the player just gets set right back to its original spot.. since I am never actually changing its position... just rotating the entire canvas. The similar question here Is it possible to rotate an image on an HTML5 canvas, without rotating the whole canvas? explains how to use save() and rotate() which I think is on the right track.. but does not solve the issue I have because the player location is reset back to the start when the key is lifted, because I set the degrees back to 0 on keyup. How can I maintain the current rotation of a single shape regardless of the rest of the canvas?


texts: How to work out given two coordinates should I use a vertical/horizontal/diagonal line to connect them

texts: I'm developing an android game and have essentially a grid. The user can drag a line between two points however the line will only ever be vertical, horizontal or diagonal (y=x). So I need to work out given two points which type of line is the best match.


texts: Roguelike game: detect intent of other actors by observing their moves

texts:
In grid turn-based roguelike game, how can I detect the following scenarios:

other actor is following observing actor
other actor is intentionally moving to block its path

Path blocking can happen if for example player intentionally stops right in front of actor and then when actor moves to avoid player, player moves in front and that keeps repeating as long as player does it. I managed to detect that situation in hackish way and I would like to know if there is a better method for solving things like this.


texts:
Ludum Dare is great, except it's only 48-72 hours (depending on your flavour). Is there any particular (good) competition that gives you 1-2 weeks to develop? I don't usually get enough time to put significant effort in 2-3 days.

Edit: I'm using .NET. It must be open to .NET (Silverlight, preferably) games.


texts:
I'm not sure of the correct terms for this so having a hard time searching.
But I have a series of 2d top-down rooms made up of random grid sizes between say 5 and 10 on the x and y axis. Each room will have one or more doors.
Now I want to place furniture shapes in them randomly, with some rules like not blocking a door, overlapping other furniture etc. For example a sofa would be 3x1 size, a tv unit 2x1 etc, but can be rotated.
What are my options for doing this? I can think of two methods:

Brute forcing it, looping each item until it fits somewhere.

Similar to the Spelunky method, whereby I make various room layouts and randomly pick one.


texts:
I've converted my XNA project into a MonoGame one.

Whenever I start the application and resize the game manually (ie - dragging the window)...

this.Window.AllowUserResizing = true;

...the game scales in a weird manner.

Namely instead of scaling as it should do, it scales to the point where it looks fuzzy and the mouse clicks aren't working correctly.

The main game map has a hard coded "component size" which means that when the screen gets larger, its supposed to show more of the game - but instead I'm getting poorly scaled components.

Part of my code looks as follows:

const int TILEWIDTH = 50;
const int TILEHEIGHT = 50;
//......
Rectangle rec = new Rectangle(0, 0, TILEWIDTH, TILEHEIGHT);
spriteBatch.Draw(this.game.Content.Load<Texture2D>(tileGraphic.path), rec, Color.White);

So theoretically the pixels are becoming larger. This was working correctly in XNA.

I am in no way handling or overriding the resize command, it was 'just working'.

I found some threads with similar problems, but no solution. Anything I could do ?


texts: Sending a Tilemap Layer over a socket connection (GMS2/GML)

texts:
I'm working on a multiplayer game in GameMaker Studio 2 using sockets and built-in networking functions. I have a server that can receive and send messages to and from clients.

What I'm trying to do is take the map data (on the server) and send it to the clients, so that I can create a map on the server and have it automatically sent to clients upon entering the game. This map will be a Tilemap Layer.

Does anyone have any ides on how to serialize a GameMaker Studio 2 Tilemap to a data type that can be sent over sockets?


texts:
So I'm a beginner in developing android gaame. I already developed a game, it's intended for kids. Basically, the game has 4 stages. In each stage, it has 15 questions. If the user chooses the correct answer, he will proceed to the next question, otherwise, will be given 3 trials to choose the correct answer/object.

Below is the structure of my game:

Home
Menu
    >>> Stage 1 | Stage 2 | Stage 3 | Stage 4

Stage 1_1.class
Stage 1_2.class
....

Stage 2_1.class
Stage 2_2.class
....

Stage 3_1.class
Stage 3_2.class
....

Stage 4_1.class
Stage 4_1.class

I know it's very noob, that's why I ask for your help to translate this to a more consistent, and efficient game or just give me an idea. I want to put each stage's main loop only in ONE ACTIVITY. Help is truly appreciated. Thanks.


texts:
In a effort to learn the blender interface, which is confusing to say the least, I've chosen to model a model from referrence pictures easily found on the web.

Problem is that I can't ( and won't ) get perfect "right", "front" and "top" pictures. Blender only allows you to see the background pictures when in ortographic mode and only from right|front|top, which doesn't help me.

How to I proceed to model from non-perfect guide images?


texts: In regards to real time turn based games, where should the turn handler be?

texts:
I'm currently developing a pool-like browser game. I'm stuck on where should I handle the turn changing, timer, etc.
Currently, turn timer (i.e. 15 seconds left to do action, then turn will change) is handled by the server. But the changing of turns itself is handled by the client (the browser itself).
Now in my current setup, whenever a player leaves window focus, the game gets out of sync. Should I migrate the turn change handling to the server instead?


texts: How can I use canon.js in three.js editor?

texts:
I would like to add bullet physics to a scene crated by the three.js editor. Where do I need to put the canon.js file in order to be able to access it's functions from the editor scripts?

I downloaded the three.js project and used the downloaded version of the editor.

I tried to declare a CANNON.World() instance in one of my editor scripts, to see if the editor is using the library, but I got an error message.

Here is what I tried beforehand:

I tried to put it in the index.html, from the published zip files. I also tried the app.js, but I figured out when you hit play in the editor it is not getting executed. So I copy pased the canon.js file under the editor/js and editor/js/libs folder, with no luck.

When I hit play I get a black square up in the LHS of the screen and it doesn't even enter play mode.

Please see attached screenshots.

This was my error message, obviously the editor can't see the cannon.js:

VM1178:6 Uncaught ReferenceError: CANNON is not defined
at Mesh.eval (eval at Player.load (app.js:83), <anonymous>:6:17)
at Player.load (app.js:83)
at Player.js:29
at g.execute (signals.min.js:8)
at e.Signal.dispatch (signals.min.js:12)
at UI.Panel.<anonymous> (Menubar.Play.js:23)

Screenshot
Screenshot


texts: How to access triangulates in a 3d model that was imported in Unity?

texts: I have a 3d model of a city. It is in collada format and ina dae file. I imported 3d model to unity but I don't know how can I access the objects of this 3d model with c# script.Because I am new with coding stuff. I am trying to learn bot unity and c# at the same time and I think this is a painful process.I want to access and manipulate the triangles in this 3d model. You can see the model in the attaching picture


texts:
I am eyeing OpenVG and cairo as rendering libraries for my pet game GUI. You can use both to render either into a texture or issue GL commands to draw directly onto the display. If I would use them directly, there are the following issues:

they will mess with GL state, which can be a problem, if it happens every frame,
their code will be executed every frame, if the GUI is drawn directly, but the GUI textures would be updated only when game state changes.

For this reasons I think I should be rendering the GUI into texture(s), but I'm asking here just to be sure.


texts: How do I create a Shadow of the Colossus - like climbing system?

texts:
I'm developing a game in Unreal Engine 4, and I want to implement a climbing system just like in Shadow of the Colossus, where you can grab and climb onto specific parts of the monster (fur, in this case).

It probably doesn't use the same logic as a building a climbing system/edge grabbing, where it uses a sphere trace by channel to detect edges and then disable the player movement, as the player must be attached to the colossus since it moves.

How would I go about creating something like this?


texts: Set color by uniform per sprite using libGDX SpriteBatch

texts:
I am using a SpriteBatch to render large amounts of sprites very fast. Now I want to modify the sprites with shaders to tint them in a color.

Problem 1: Altering an uniform by getting the shader and setting it between the begin/end of the batch changes the whole scene not only a single sprite.
E.g.:

"EngineView.getShader().setUniformf("u_blue", (float) Math.random());"

Problem 2: It is relatively slow.

Also I found this which seems to cover the same (no proper solution):
(Setting uniform value of a vertex shader for different sprites in a SpriteBatch):

  You almost certainly don't want to actually do this. Changing a
  uniform for every quad/sprite is going to severely impact the
  throughput of your renderer. Much of the GPU will be sitting idle
  while you're drawing one measly sprite at a time. The whole point of a
  "sprite batch" is to draw as many sprites at the same time with as few
  draw calls or state changes as possible. If you need random data in
  your shader, use a noise texture or a noise function.
  stackoverflow.com/questions/4200224/… – Sean Middleditch May 23 at 21:22

My question is, if I don't want to actually do this, what is it I want to do?


texts: Is it a legal thing to do to sell fabricated accounts of your game?

texts:
For example, say I create an online mass multiplayer game with in-game purchasing system and with randomness factors as well (the point is that game accounts have actual value and there is a somehow proportional relationship with playing time plus the luck of the player and the account's value) and the game appears to become popular.

Is it legal to, for example, insert cheated accounts into the database (without even spend a second of legitimate playing) and sell those accounts with extremely high price?


texts: sprite animation system height recalculating has some issues

texts:
Basically, the way it works is that it update the frame to show every let's say 24 ticks and every time the frame update, it recalculates the height and width of the new sprite to render so that my gravity logics and stuff works well. But the problem i am having now is a bit hard to explain in words only, therefore i will use this picture to assist me

The picture

So what i need basically is that if let's say i froze the sprite at the first frame, then unfreeze it and freeze it at the second frame, have the second frame's sprite (let's say it's a prone move) simply stand on the foothold without starting the gravity and when switching back, have the first sprite go back on the foothold like normal without being under the foothold.

I had 2 ideas on doing this but I'm not sure it's the most efficient ways to do it so i wanna hear your inputs.


texts:
I'm creating a simple jumper game in Libgdx that makes the player jump over obstacles in order to stay alive.

The only problem is that the collision detection for when the player just touches the ground, it:

1) Looks a little bit like there's a hitch in the repainting (because it tends to go a y axis little too far before being brought back to above 0).

2) Can't jump right away again (a very small, but annoying delay).

Here is the code that checks for collisions:

public void update(float dt) {
    if (location.y < screenBounds.y) {
        location.add(MOVEMENT * dt, 0, 0);
        velocity.y = 0;
        location.y = 0 + dt;
    } else {
        velocity.add(0, GRAVITY, 0);
        velocity.scl(dt);
        location.add(MOVEMENT * dt, velocity.y, 0);
        velocity.scl(1 / dt);
    }

}

I know why, it does this though:

LOCATION BEFORE RESETTING -0.45871875
LOCATION AFTER RESETTING 0.017244088

It takes too long to realize that the location on the y axis is below 0. This creates a hitch as well as a small delay between the times where it lets the player jump again.

I don't know how to fix this problem. I've looked at many posts that discuss collision detection, but none address the same problem I'm having.

For example, these tell me to do what I'm currently doing:

Collision detection
Collision detection in libgdx

But they both don't solve my issue.

Any help would be greatly appreciated.


texts: LibGDX full screen display mode and camera resize

texts:
I'm creating a simple 2D platformer and I have problem with my camera y position when I enter full screen mode. But first here's my code

screenY = Gdx.graphics.getHeight();

public void updateCamera(){
        camera.position.x += (player1.getHitBox().x - camera.position.x);
        if(screenY < player1.getHitBox().getY() && player1.getHitBox().getY() > (screenY - Gdx.graphics.getHeight())){
            screenChanger++;
        }else if(player1.getHitBox().getY() < (screenY - Gdx.graphics.getHeight())){
            screenChanger--;
        }
        screenY = Gdx.graphics.getHeight() * screenChanger;
        camera.position.y = (screenY - screenY/2);
        camera.update();

        System.out.println(Gdx.graphics.getHeight() + " " + screenY);
    }

So here's my results:
1) When I start the game all works fine

2) But when I enter to fullscreen here what I get

3) here how it looks when I zoom out my camera


texts: What is the difference between an orthographic and oblique projection?

texts:
They both seem to be a parallel projection. I know that the angles of axes of viewing differ based on the type of orthographic projection (eg, an isometric projection has equal angles for all the axes).

But what sets the oblique projection apart from the orthographical projection?

I found this image on Wikipedia and I don't see what sets the two oblique examples apart from the dimetric example.


texts:
I was trying to follow a tutorial for my first unity tests and I can't seem to convince unity that I indeed have an internet connection, short of a complete uninstall I tried about everything I could think of or find on google:

Running unity as an admin
Reseting my TCP-IP with a Microsoft tool
Deactivating my firewall
Deactivating windows 10 firewall for real and completelly (Because windows 10 sucks and I'd be using windows  7  if it weren't for docker)
Deactivating my AV software Logging out and   in from unity

The browser will open the asset store no problem, I'm on windows 10


texts: Which Graphics/Geometry abstraction to choose?

texts:
I've been thinking about the design for a browser app on the HTML5 canvas that simulates a 2D robot zooming around, sensing the world around it. I decided to do this from scratch just for fun. I need shapes, like polygons, circles, and lines in order to model the robot and the world it lives in. These shapes need to be drawn with different appearance attributes, like border/fill style/width/color. I also need to have geometry functions to detect intersections and containment for the robot's sensors and so that the robot doesn't go inside stuff.

One idea for functions is to have two totally separate libraries, one to implement graphics (like drawShape(context, shape)) and one for geometry operations (like shapeIntersectsShape(shape1, shape2)). Or, in a more object-oriented approach, the shape objects themselves could implement methods to do their own graphics (shape.draw(context)) and geometry operations (shape1.intersects(shape2)).

Then there is the data itself: whether the data to draw a shape and the data to do geometric operations on that shape should be encapsulated within the same object, or be separate structures (where one would contain the other, or both be contained inside another structure).

How do existing applications that do graphics/geometry stuff deal with this? Is there one model that is best, or is each good for certain applications? Should the fact that I'm using Javascript instead of a more classical language change how I approach the design?


texts:
I was following along the unity platformer tutorial. https://www.youtube.com/watch?v=9WhZ1svdC3Q It is great. After looking the animation I found that there was a fbx model for 2d sprite character. I just want to ask can you use 3d animation like motion capture animation once you rig a character using bone for 2d(fbx model). I search but unable to find any good tutorial of how to create fbx model for 2d character and creating maps for these 2d character.

I am really confused. Thank you so much for helping.


texts: What should I do about legal considerations for an indie game?

texts:
Apologies if there's a bit too much background information here, not sure what's relevant but figured I needed to outline the financial situation to differentiate this from other questions whose answers aren't applicable here.

I'm making an indie game, to be sold online (ie, to any country that can use PayPal). My current situation is underemployed - unable to find enough work to make ends meet over the last couple of years, I'm now looking to use some of that free time to top up my income by making a little extra money from my hobby. Primarily, I look at is as art rather than a business, but with cash flow and employment prospects limited, I need to make a little money.

My question is what should I do about the legal problems that can arise out of selling a game? I've read up general advice on small businesses, so I should be fine with the usual issues like copyright, limited liability and tax - it's game development specific ones that worry me. I've also checked the licenses of any libraries used thoroughly (it's all open stuff anyhow).

Software patents are currently scaring the hell out of me - they might not be legal in my country, but if I'm going to get any sales at all with my small scale project I'm going to have to cast a broad net. As far as I understand, there are so many and so broad or poorly defined, that I can't in practical terms make a game without violating them in at least some countries. The other thing that bothers me is if there's legal issues I've never heard of and wont hear of until I get a nasty letter threatening to take everything.

I've obviously searched for related questions here and elsewhere, but had no luck - the answers always seem to say either consult a lawyer, or buy expensive legal reference materials - whilst well intentioned, given the financial situation outlined above, well this advice isn't really applicable. I have no money, and the total amount I hope to make from this game is less than one hour of legal consultation. Given the amount of researched involved in patents, and the numerous jurisdictions that my sales might come from - well, I can't think of a way that sufficient help from a lawyer will ever be within my means.

So, given those considerations, can anyone suggest a sensible course of action for such a small scale business that'll prevent me from being shut down, and from losing my creative rights to the game the moment some large company with software patents decides to sue? And further, any other steps I need to take to protect myself against legal problems specific to this industry that general advice sites wouldn't cover?


texts: Using EaselJS, my spritesheet-based map is not showing up

texts:
I have a random map that generates based on a level and a set of Tile ID's, constructed using a Height Map generator I wrote using the BitmapData extension.

I've confirmed that the Tile IDs are generated correctly and can be modified to cycle through a set of tiles and changing circumstances.

The actual base image that holds the tiles is loaded and I was able to draw
it separately.

However... after I update the stage when the function finishes building, I don't see any map at all and I don't understand why. I've tried to add to a container and to the stage directly, neither method is working.

Could anyone identify the problem?

function buildBackground()
{
    var mapSeed = Math.round(Math.random() * 2);

    var channel = Object.create(createjs.BitmapDataChannel);
    var channelOptions = channel.RED | channel.GREEN | channel.BLUE;

    var offsets = [new createjs.Point(0, 0), new createjs.Point(0, 0)];
    var interpolateType = "cos";

    var TileMap = new Array();

    accessMap = new createjs.BitmapData(null, 200, 200);
    accessMap.perlinNoise(100, 100, 6, mapSeed, true, false, channelOptions, true, offsets, interpolateType);

    var BitmapLayout = new createjs.Bitmap(accessMap.canvas);

    BitmapLayout.scaleX = 5;
    BitmapLayout.scaleY = 4;

    BitmapLayout.x = 0;
    BitmapLayout.y = 0;

    var gridSizeX = 10;
    var gridSizeY = 7;

    heightMap = new Array();

    for (x = 0; x < gridSizeX; x++)
    {
        heightMap[x] = new Array();
        for (y = 0; y < gridSizeY; y++)
        {
            heightMap[x][y] = 0;
        }
    }

var pixelPoint = new createjs.Point();
var darkest_pixel = 1;
var brightest_pixel = 0;

for (x = 0; x < gridSizeX; x++)
{
    for (y = 0; y < gridSizeY; y++)
    {
        pixelPoint.x = Math.round((x/gridSizeX) * accessMap.width) + 1;
        pixelPoint.y = Math.round((y/gridSizeY) * accessMap.height) + 1;

        heightMap[x][y] = accessMap.getPixel(pixelPoint.x, pixelPoint.y);

        heightMap[x][y] /= 0xffffff;

        if (heightMap[x][y] < darkest_pixel) {
            darkest_pixel = heightMap[x][y];
        }

        heightMap[x][y] = Math.round(heightMap[x][y] * (Math.random() * 3));
    }
}

for (x = 0; x < gridSizeX; x++)
{
    TileMap[x] = new Array();
    for (y = 0; y < gridSizeY; y++)
    {
        TileMap[x][y] = 0;
        TileMap[x][y] = Math.round(heightMap[x][y] * (Math.random() * 5));
    }
}

var bitmap = new createjs.Bitmap(preload.getResult("BackgroundTiles"));

var BackgroundTileObjData = {
    images: [bitmap],
    frames: {width: 100, height: 100}
};

var BackgroundTileInfo = new createjs.SpriteSheet(BackgroundTileObjData);

var frameSize = 100;

var graphic = new createjs.Graphics();

for (x = 0; x < gridSizeX; x++)
{
    for (y = 0; y < gridSizeY; y++)
    {
        var TileID = TileMap[x][y];

        var levelModifier = 1;
        var tile = new createjs.Sprite(BackgroundTileInfo);
        tile.gotoAndStop(TileID);
        tile.x = 100 * x;
        tile.y = 100 * y;

        stage.addChild(tile);

    }
}

stage.update();
console.log("Tile SpriteSheet?");

}


texts: android - How Do I Replace A Scene in Cocos2D

texts:
I am using Cocos2D for Android:
I have two scenes MainScene and LogoScene. I want to show a Splash screen on LogoScene then, I want to go to MainScene.

I am wondering how I can go from LogoScene to MainScene using:

CCDirector.sharedDirector().replaceScene(MainScene.scene());

What is an example of Scene Transition from a splash screen to the main scene?


texts: Is there a mathematical model for balancing economies

texts:
This is relating to a server for a game I'm setting up (the game isn't mine, but I have the ability to change all prices - buy and sell - on the server).
I could arbitrarily pick prices for all items on a server, including items that regularly produce other things that could be sold (eg. Cow cost $100, milk sells for $1, cows live forever and can be milked once per day), but I feel like I'm going to make the system unbalanced and ultimately exploitable. Is there a mathematical or scientific model that can be applied to this type of situation to determine the ideal ratio of prices between different object.
To give a bit of background, the goal is to accumulate wealth, by buying things that can be used to create other things that can be sold.
My first through was to run some sort of simulation of the game (people buy and selling things etc.) but this seems far to complex and unlikely to randomly determine the explotability of a set of prices. I'm way out of my depth here, so any suggestions would be appreciated.


texts: Handling game message packet loss at low speed and at a microcontroller level

texts:
I read this: How do I handle packet loss in a client-server network model?

...But I'm looking for more advice.

Currently I'm implementing my own lazertag vests. I'm programming hardware (8051 microcontroller) with radio links. Currently the speed is 56kbps but I might have to lower it to 38kbps for longer range. Why old hardware? To save me money. Yes, I'm currently part of the "working poor".

Ok, so like other systems, my game will also be run on a client-server model. When the game starts, networking is done UDP style and is meant to happen as follows:

1. Server sends 1st client his game stats so the vest responds accordingly
2. 1st client responds with information on what client(s) shot him
3. Server sends 2nd client his game stats so the vest responds accordingly
4. 2nd client responds with information on what client(s) shot him
....
n. Server sends last client his game stats so the vest responds accordingly
n+1. Last client responds with information on what client(s) shot him

and the process repeats for at least 20 players.

I'm not concerned with stats output from the server because the same info for a client is repeatedly sent out until the client sends a request of some sort back to the server.

But what I'm concerned with is the client being able to send his request to the server and recognizing the server received it.

For example, if player 1 got shot by 3 people, then when the server sends data about player 1 to player 1, then that player will respond to the server with bits indicating that he got shot by the 3 people, but I need to create a reliable way for the server to receive this message without loosing speed.

Here's my ideas so far:

Make the server designate a special bit value that the client must use when sending his data to the server and if the client can't provide this bit value with the data then the client will stall and repeatedly send the same data until the server receives it. Problem with this is that it could increase chances of mis-fires in the game and it could slow down the rate in which the client can fire. (yes I'm trying to synchronize much of the game to when the packets arrive from the master since I don't want anyone with a stolen piece of hardware to be able to use the vest properly)
Have the client send back the same packet two or more times in a row. Through experimentation this seems to work somewhat better but then it forces slower speed since more bytes are being processed.
This is the worst idea in my opinion but I'm putting it out here as an option: Ignore the packet. This is worst because if other clients shot this one client then no one scores points and each client's accuracy will drop when it is not supposed to.

I thought of reducing the packet size but I can't go too low or the required data won't get through in a reasonable time frame.

Any ideas how I should tackle this problem? I don't want players to feel they're shooting others right on target only to find out they're scoring nothing and I don't want the victim to gain unlimited invincibility either when its not deserved.


texts: Const returning C++ method can't be bound with LuaBridge

texts:
I have a method with this signature:

const std::string GameObject::GetName()

And then I try to bind it with this line:

...
.addFunction("getName", &GameObject::GetName)
...

When I try to compile, this error comes up:

Error C2440 '=': cannot convert from
'const std::basic_string<char,std::char_traits<char>,std::allocator<char>> *'
to
'void *'

The error comes from here:

\include\luabridge\detail\Userdata.h, line: 354

Here is a snippet from the Userdata.h

  inline T* getObject ()
  {
    // If this fails to compile it means you forgot to provide
    // a Container specialization for your container!
    //
    return reinterpret_cast <T*> (&m_storage [0]);
  }

private:
  /**
    Used for placement construction.
  */
  UserdataValue ()
  {
    m_p = getObject(); //Line 354
  }

I can use const, and const & std::string as parameters, in those cases there are no errors.

Why does this error occur? How could I fix this?

Thanks in advance!


texts: Big level objects collision system for 2d game

texts:
I read many variants today and get some knowledge in general, so here is a steps of mine thoughts in pictures (horrible paint.net ones).

We need to develop grid system, so we check only thing near, perform simple check to cut out deep check, and at - last deep check like per-pixel collision check.

Step 1 - Let p1, p2 are some sprites lets first just check with circle collision - because large distance between p1, p2 this fails and of course so we don't need test more deeply. But if we have not 2, but 20 objects, why we need to even circle test something so far outside of our view.
Step 2 - Add basic column system, now we don't bother with p2 if it's in a column far from p1 column, so we even don't do circle test. But p3 is in the same col, so let do circle test, which of course will fail.
Step 3 - Lets improve column system to the grid system with grid cell size just like p1, p2, p3 collision boxes, so we cut out things much top or below p1. And this is all great until comes BIG OBJs which is some kind of platforms. They are much bigger then grid cell.

Circle test for will be successful, but deep check for whole big obj will fail

And that the part I can't get.

How do I store the grid position of big object? Like 4 grid coords for big object vertexes? And if one of them close to p1 do circle check for centre of big object then a deep one if succeed? Am I do it wrong?

My possible solution:


texts:
I have a ball which has CircleCollider2D attached to it. It is also rigidbody. When it lands on a platform, it jumps . The platform is static, with Edge Collider attached. It also has a platform effector attached with "Use One Way" selected.
Most of the times it works fine, but some times, the ball lands on the platform and instead of bouncing, just sits on the platform.
When ball lands on the platform, following code is executed:
 rb.AddForce(upForce, ForceMode2D.Impulse);

upForce is Vector2(4,10);
image shown below:

Why is this happening?


texts: I have an object made up of many vertices that changes very rare (for the most part of time, it looks the same) and I'm trying to figure out a way to avoid rendering all its vertices every frame. However, being a OpenGL beginner I have no idea how to do it. I was thinking I could render it to a texture and only show the texture every frame. But I don't know if it's possible or if there are better ways.


texts: Design pattern on class level, how to do separation of concerns through mvc or alike?

texts:
Say i had a Monster class

public class Monster {

}

Now this class has a set of properties like

int health
int speed
int weaponDamage

which details the core information about the monster.

in addition it also needs gui information stored in the model. probably something like this:

int positionX;
int positionY;
int positionZ;
int rotation;

So let's say those are the main properties in our Monster definition. Now we have a couple of methods that do things (besides data getters and setters).

For example:

public void move(){
  //do changes to position.. and rotation variables
}

public void eventIncomingDamage(Projectile p){
  //Incoming projectile did damage to monster
}

public void doDamage(Target aTarget){
  //fire off an damage event on target.
}

So, my question is, how should one go about separating the different data types and methods in such a way it conforms to separation of concerns? Should i have one MonsterController which has the move,eventIncomingDamage and doDamage methods, a Monster class which only has the core information (health,speed,weaponDamage) and what about a MonsterRenderer class (view), how should it fit into all this?

In my example "solution" im thinking along the lines of the MVC pattern. But are there other patterns that should be used in combination or instead?

How would you go about organizing this code into managable and separated blocks?

I hope this can start a good discussion around structuring data, actions and events.


texts: What is the minimum of shader I need to use to run basic calculation on GPU?

texts:
I read, that the Hull Shader, Domain Shader, Geometry Shader and Pixel Shader can be used optional. So, is the Vertex Shader optional too? If no: What does a basic Vertex Shader look like? Just like a simple pass through? Is the Vertex Shader necessary to tell what kind of datastructure (Van Stripes or Meshes) are used? What can I do, with just the vertex shader?
Are the fixed functions working without any help of programming a programmable stage?


texts: Rotating GameObject does not rotate child

texts:
I am rotating a gameobject that has a child game object with a particle effect on it.

It's a missile with engine exhaust.

I am rotating the parent game object but the particle effect child objects do not rotate:

The missile object has this script on it:

void FixedUpdate () {
Vector3 dir = targetObject.position - transform.position;
dir.Normalize();

float zAngle = Mathf.Atan2( dir.y, dir.x ) * Mathf.Rad2Deg - 90;
Quaternion desiredRotation = Quaternion.Euler( 0, 0, zAngle );

transform.rotation = Quaternion.RotateTowards( transform.rotation, desiredRotation, 10.0f * Time.deltaTime );
rigidBody.AddForce( transform.up * 10.0f, ForceMode2D.Force );
}

Particle Effect:

Anyone see what I am doing wrong?


texts:
I am new in the game development and now I am at the stage when you need to fill the game content. I want to create the events that occur with the player (like in FTL). Now I make these events with the help of hardcoding, but I understand that this is a very bad style. I know there is another way, use data in XML files. Here is an example:

 <event name="SIMPLE_EVENT">
  <text>Event text</text>
  <battle name="MONSTERS_WEAK"/>
 </event>

This event show a dialog window and start battle with a random weak monster. I understand how to make this XML files, but I not so experienced with C# to write code that will convert data from XML to my C# classes. How to convert this xml to C# methods invocation? Something like: ShowDialogWindow("Event text"); StartBattle("MONSTERS_WEAK"); Another example is:

<event name="ADD_FUEL">
 <text>Adding fuel</text>
 <item_modify>
     <item type="fuel" min="2" max="2"/>
 </item_modify>
</event>

This event show dialog too and add some fuel to the player.

I think its a some deserialization task? Anyway similar as FTL I need one class to represent all events in the game, using different XML data. I ask some advice with this, maybe tutorials, pattens or examples? Or maybe another solution of my task?


texts: How to convert fbx with animations to dae

texts:
I am making an ARKit app, and I need to implement animations. Our 3D artist has provided these files as fbx with animations.

All resources I find online about animated models in ARKit talk about dae (Collada) files with animation.

Is there a way to convert an fbx file with animations to a dae file containing the animations?

I tried asking our artist to export a DAE file, but that didn't appear to work as he has no experience with DAE files. The animation didn't seem to play.

I have also tried an online converter (http://www.greentoken.de/onlineconv/), but that failed to perform the conversion.


texts:
I can't find a nice way to do path smoothing while i'm following a path.

I have tried this piece of code but aparently it doesn't work as suspected.
The idea of how it should work is:

Edge 1 (the first location of the path)
Edge 2 (the 2nd location of the path)
while edge2 is not the last edge in the path, step through the edges checking
to see if the agent can move without obstruction from the source node of
edge1 to the destination node of edge2. If the agent can move between those
positions then the two edges are replaced with a single edge.

public static LinkedList<Vector2> SmoothPathEdgesQuick(LinkedList<Vector2> path, Player player)
{
    LinkedList<Vector2> newLinkedList = new LinkedList<Vector2>();
    List<Vector2> toBeDeleted = new List<Vector2>();

    var edge1 = path.First;
    var edge2 = path.First.Next;
    while (edge2 != null && edge2.Next != null)
    {
        if (player.CanWalkBetween(edge1.Value, edge2.Next.Value))
        {
            toBeDeleted.Add(edge2.Value);
            edge1 = edge2.Next;
            if (edge1.Next == null)
            {
                break;
            }
            else
            {
                edge2 = edge1.Next;
            }
        }
        else
        {
            edge1 = edge2;
            edge2 = edge2.Next;
        }
    }
    if (edge1.Next != null)
    {
        if (edge2 != null && player.CanWalkBetween(edge1.Value, edge2.Value))
        {
            toBeDeleted.Add(edge1.Value);
        }
    }
    foreach (var vector2 in path)
    {
        if (toBeDeleted.Contains(vector2))
            continue;
        newLinkedList.AddLast(vector2);
    }
    return newLinkedList;
}

As when i go from 250,400 to 500,400 (which is just a line) it should get just 2 waypoints (so the newLinkedList should just have a count of 2). But instead of 2 it does gets more waypoints, which is strange as the example in the book doesn't get more than 2 waypoints for a straight line.

I've used the code below which is provided by the the book Programming Game AI by Example.  And based my code on the logic in there.

void Raven_PathPlanner::SmoothPathEdgesQuick(Path& path)
{
  //create a couple of iterators and point them at the front of the path
  Path::iterator e1(path.begin()), e2(path.begin());

  //increment e2 so it points to the edge following e1.
  ++e2;

  //while e2 is not the last edge in the path, step through the edges checking
  //to see if the agent can move without obstruction from the source node of
  //e1 to the destination node of e2. If the agent can move between those
  //positions then the two edges are replaced with a single edge.
  while (e2 != path.end())
  {
    //check for obstruction, adjust and remove the edges accordingly
    if ( (e2->Behavior() == EdgeType::normal) &&
          m_pOwner->canWalkBetween(e1->Source(), e2->Destination()) )
    {
      e1->SetDestination(e2->Destination());
      e2 = path.erase(e2);
    }

    else
    {
      e1 = e2;
      ++e2;
    }
  }
}


texts: How to create water with ripples in custom places for top down game in Unity?

texts:
I want to make topdown row boat game with Unity. I want graphics to be simple (sprited), but the water must be "very nice" and realistic and it should reflect movement in it (paddles and boat movement maybe minor things like rain).

I was satisfied by the look of water made from basic assets, but I don't know how to add ripples from boat and paddle bodies. (is it possible?).

Can I use this or any other free component for my purpose or should I write some sort of script for my very own water behavior somehow?

Examples of 2d water ripples i like:

http://www.youtube.com/watch?v=sC71DZO8rG8
http://code.almeros.com/code-examples/water-effect-canvas


texts: Drawing an outline around an arbitrary group of hexagons

texts:
Is there an algorithm for drawing an outline around around an arbitrary group of hexagons?
The polygon outline drawn may be concave. See the images below, the green line is what I am trying to achieve. The hexagons are stored as vertices and drawn as polygons.

Edit:

I've uploaded images that should explain more. I want to favour convex hulls because it's conveys an area of control more quickly.
Each hexagon is stored in a multidimensional array so they all have x and y coordinates, I can easily find adjacent hexagons and the opposite vertex, i.e. adjacentHexagon = getAdjacentHexagon( someHexagon, NORTHWEST ) if there isn't a hexagon immediately adjacent it will continue to search in that direction until it finds one or hits the map edges.


texts: Unity launches both Visual Studio and Monodevelop simultaneously

texts:
When I open a script for editing from Unity, both Visual Studio and Monodevelop are launched, resulting in two instances of the same solution to be open in two different script editors.

I am presently running the latest version of Unity 5.50fs (though I also experienced this issue in the previous build prior to installing Unity's latest update), in conjunction with Visual Studio Community Edition 2015, and Visual Studio Tools For Unity 2.3.0.

I also have my external script editor set to VS in the preferences window of Unity.

While investigating this issue I came across a forum thread of someone experiencing a similar problem, where MD opens instead of VS. This seemed to be a result of a hard coded reference to MD for redundancy in cases where VS might fail to load, which I thought sounds like a plausible explanation for my situation as well.

The general consensus was that when VS takes a little too long to open, Unity reverts to MD under the assumption that their is a problem with VS. This explanation seems even more likely in my case because this issue only occurs when I first open Unity for the day- if I have had VS open recently MD does not open, and VS opens quite quickly, likely a result of being cached in my computers memory.

The work around offered to avoid MD launching instead of VS in that thread, was to change the name of the MD executable, so that Unity would be unable to launch MD, giving VS time to finish loading. I was however hoping to find a better solution. I like the fact that Unity has that redundancy in place and would rather keep it intact, and I don't know why but changing the executable solely for that purpose makes me feel a little OCD.

Other ideas I have tried include reinstalling Unity, running both Unity and VS as an administrator, and launching VS prior to opening the script in Unity (in this case Unity opens a second instance of VS).

Has anybody else experienced both script editors being launched simultaneously and/or have any other ideas on how to resolve it? It's obviously not a critical issue or anything, but it is a bit annoying.


texts: Difference and interaction between Viewport and Camera

texts:
I'm very very confused about some very basic concepts in game/grafical developing. The interaction between the individual components (camera, viewport, window-sizes, gameworld-sizes, ...) when rendering graphical things are still confusing me.

As far as I understand:

A camera "filming"/viewing something as long it is between the near- and the far-clipping plane
Camera has a Width and Height which defines the area of what will get "viewed"... ?

The viewport can connect to an camera
the viewport is the area which will get shown withing the window
the cameras view will get projected onto the viewport
so if the camera has a size of 1024x768 and the viewport ist only 300x400, the 1024 pixels will get upset on 300 "real" pixels

As you may have have recognized Im very unsure about this. Maybe you can help me with that.

I want to run the test-app down bellow in a way, that the picture will not get stretched. Also Im wondering what "game coordinates" are in that context.
For Demo-Cases and learning I've just created a piece of src:

package com.mygdx.game;

import ...

public class MyGdxGame extends ApplicationAdapter {
    public PerspectiveCamera cam;
    public Model model;
    public ModelBatch modelBatch;
    public ModelInstance instance;
    private FitViewport viewport;

    @Override
    public void create() {
        modelBatch = new ModelBatch();

        // creating a camera; gets width and height from the window
        // so it will "fit" best in the current window
        cam = new PerspectiveCamera(67, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        cam.position.set(10f, 10f, 10f);
        cam.lookAt(0, 0, 0);
        cam.near = 1f;
        cam.far = 300f;
        cam.update();

        // creating viewport; width n height r not really necessary since it gets new
        // values within
        // the rezise() method; correct?
        viewport = new FitViewport(1920, 1080, cam);

        ModelBuilder modelBuilder = new ModelBuilder();
        model = modelBuilder.createBox(5f, 5f, 5f, new Material(ColorAttribute.createDiffuse(Color.GREEN)),
                Usage.Position | Usage.Normal);
        instance = new ModelInstance(model);
    }

    @Override
    public void render() {
        Gdx.gl.glViewport(0, 0, Gdx.graphics.getWidth(), Gdx.graphics.getHeight());
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT);

        // what is happening here?
        cam.update();

        modelBatch.begin(cam);
        modelBatch.render(instance);
        modelBatch.end();
    }

    @Override
    public void dispose() {
        model.dispose();
    }

    @Override
    public void resize(int w, int h) {

        // putting new values into the viewport
        // and updating it will "resize" the camera ... ?
        float aspectRatio = (float) w / (float) h;
        // viewport.update((int) (h * aspectRatio), h);
        viewport.update(1920, 1080);
        viewport.update(w, h);
    }
}


texts: Is correct to calculate values in percentage, using the total number of iterations?

texts:
Trying to clarify the problem.

Imagine a factory that produce soccer balls; if you produce 1 ball, it will take a certain amount of game cycles. For sake of simplicity, let's say it could take between 5 and 15 cycles (depending from various conditions, like number of workers, quality of workers and so on). Once you make a certain amount of soccer balls, the process is considered done.

Now, I want to display a value in percentage for costs, and a value of defective balls made. with "cost", I am trying to display how much did I spent (materials, workers wage and so on), at the moment. The number in currency is self esplicative, but I believe a percentage value could help to know if you are using too many workers, or burning too many resources, resulting in a waste of money.

To calculate the percentage of defective is relatively simple, since every X amount of time, when I refresh, I can check the balls produced against the defective ones, and the result should be

Total produced * 100 / defective = percentage of defective.

But for the costs, things are different; so I was planning to use the number of cycles to calculate percentage for costs:

cycles * 100 / current costs = percentage of costs

Would this be considered correct? Since the number of cycles for a whole batch of balls may vary slightly, this may represent that when there are less cycles, it means that you spent less money, henche the percentage will be smaller.


texts:
Using UNET, I can't host a game for more than a few minutes unless both server and client are on the same computer. It appears that I am not alone in this.

Essentially, any latency problems or packet loss triggers an immediate disconnect. Rather than just getting lag, the client gets booted.

Does anyone know how this could be dealt with?


texts: How do I calculate logical velocity / direction?

texts:
I have a simple jBox2D (Java) implementation of a world with couple of Circle bodies that at the begining are static.

I want to make them movable when the user touches the circle. But I want them to be movable from the point where it's touched to its logical velocity direction.

How do I set the velocity / direction of the body after the touch so that it moves to the point that is logical to the touch?

10x


texts:
I want to draw a 3D capsule defined by a segment (two points start->end) and a radius:

Image source: Orionist on Wikimedia Commons

I already have a sphere leaning on this answer: https://stackoverflow.com/a/31326534/1902536.
I understand that I can expand the Parametric Equation to an ellipse one but I'm not sure how to do it with the segment (that may have rotation).

what is the best way to draw/model a capsule?


texts:
I am currently working on a networked first person shooter. I have created a server implementation that can synchronize player data. But while implementing a damage system, I realized that I almost simply sent a packet with

PLAYER DAMAGE [target id] [amount]

But that would likely be open for any player to save a list of IDs and inject that packet to damage every ID. Unfortunately the server is unable to know what the environment is like -- meaning it cannot check if there is something between the two players or likewise.

How would I keep this from being possible?


texts: I have a 3d model of a restraunt with several characters in it probably over a hundred objects. Whenever I try to import it into Unity Unity just loads forever until I force close it. How do you import such large models without Unity crashing?


texts: How to access the nth element in a 2d texture from a pixel shader in XNA

texts: How can I access the nth element in a texture2d from a pixel shader? For example if I wanted to get the 5th vector4 from 10 x 10 texture2d


texts: Entity/Component Systems in C++, How do I discover types and construct components?

texts:
I'm working on an entity component system in C++ that I hope to follow the style of Artemis (http://piemaster.net/2011/07/entity-component-artemis/) in that components are mostly data bags and it's the Systems that contain the logic. I'm hoping to take advantage of the data-centric-ness of this approach and build some nice content tools.

However, one hump I'm coming across is how to take some identifier string or GUID from a data file and use that to construct component for an Entity. Obviously I could just have one big parse function:

Component* ParseComponentType(const std::string &typeName)
{
    if (typeName == "RenderComponent") {
        return new RenderComponent();
    }

    else if (typeName == "TransformComponent") {
        return new TransformComponent();
    }

    else {
        return NULL:
    }
}

But that's really ugly. I intend to be adding and modifying components frequently, and hopefully building some sort of ScriptedComponentComponent, such that you could implement a component and system in Lua for the purposes of prototyping. I'd like to be able to write a class inheriting from some BaseComponent class, maybe toss in a couple of macros to make everything work, and then have the class available for instantiation at runtime.

In C# and Java this would be pretty straightforward, since you get nice reflection APIs to look up classes and constructors. But, I'm doing this in C++ because I want to increase my proficiency in that language.

So How is this accomplished in C++? I've read about enabling RTTI, but it seems most people are wary about that, especially in a situation where I only need it for a subset of object types. If a custom RTTI system is what I need there, where can I go to start learning to write one?


texts: How to get a good picture of the health of a level-based game from analytics?

texts:
I am designing a level-based game where the user completes the level 1, then 2, 3 and so on. There are 200 levels and each is rather short: 60-ish seconds.

I am tracking

Each played, completed (cleared for the first time), failed and cleared level
Milestones: number of players to reach level 1, 5, 10, etc. Also for number of failed and played levels.
Separate new players from returning ones.

However, I still find it difficult to get a clear picture of what is going on from the stats. So what are the best practices for determining where I am losing players?


texts:
I am making a 3D game in Unity and C#. I want to spawn another tile when the player is at the end of the current tile. But when I spawn the next tile it doesn't spawn at the right place(just after the current tile). How can I fix this?

Thanks

Old Code:

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

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

    public void spawnTile()
    {
        GameObject go;
        go = Instantiate(terrain) as GameObject;
        go.transform.SetParent(transform);
        go.transform.position = Vector3.forward * z;
        Debug.Log(z);
        Debug.Log(Vector3.forward * z);
        Debug.Log(go.transform.position);
        go.transform.rotation = terrain.transform.rotation;
        objs.Add(go);
        z += tileLength;
    }

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

That's the position of the current tile.

The correct position for the next tiles would be (6.103516e-05, 3.051758e-05, z).
They have to spawn after the current tile.


texts: How to create a repeating gif style imagery for a game tutorial dialog

texts:
I want to create a gif style video that shows up in a tutorial window using Unity. How can I make this? Do I record the thing I want to show and then put it in a texture?

Example:


texts: Checkers games with computer random movement

texts:
Im studying Java OOP, and I have to make first assignment about making checkers board game. I have to get input from user if he plays, and than when his turn is over the computer will play. Computer's movement is random but if he has the opportunity to "eat" his rival, he has to do this and if not than making random move.
Can someone help me with the coding?


texts: UE4 Blueprint OnActorBeginOverlap not working

texts:
I am following the tutorial here entitled "Making a Pickup". I have created a Blueprint class from the Statue SM:

I have set the SM Collision Preset to OverlapAll per the instructions. In the Event Graph I have the following:

When I run the simulation and run into the statue, nothing happens. If I monitor the Blueprint I see no triggering. I have wired the everything to trigger from EventBeginPlay and it all works as expected, but the ActorBeginOverlap node never triggers.

What am I missing?


texts: How to achieve selection of a tile from a tile sheet based on an ID?

texts:
Let's say I have a tile sheet that contains 8 sprites per sheet. Each sprite is a tile of 30x30.

I wrote my own custom map parser/map loader however I'm having trouble extracting a certain tile sprite from the file. I'll describe my problem better in order for everyone to understand.

I wrote an enum of materials, each material has a value according to it's location relative to the tile sheet. For example void is 1, grass is 2, rock is 3, etc. So in my tile sheet they are represented as such:

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

Which is equivalent to:

+------+-------+-------+
| void | grass | stone |
+------+-------+-------+

Basically when rendering, I created a tile class, each tile has 2 coordinates: X and Y (They are calculated automatically) and a material which can be represented either as a number, either as a value (ID). When rendering, I have a vector of sprites which are all taken from 1 file called tilesheet.png, however each of them must only draw a certain portion of the tile sheet, for example say I have something like this:

tile coordinateBounds(topLeftX, topLeftY, tileWidth, tileHeight);

During the initialization of the map I calculate an array of tiles, and I give each of them their position, their materials based on the values in a map file and a few other variables such as collision. I need to apply the coordinateBounds to each of them according to their material value. For example if the material is grass it should only take the grass sprite from the tilesheet. I must also mention I'm using SFML, and there are no borders or spacing between the tiles.


texts:
So I've been making my own tile map engine in LibGDX as the one currently implemented doesn't support collision detection with scaling. So I've come up with my own Layer and Map class and a drawing function for the map. Currently this is what it produces:

Here's the rendering code:

public void draw(SpriteBatch batch) {
    for(Layer layer : layers) {
        for(int x = 0; x < layer.getTileMap().length; x++) {
            for(int y = 0; y < layer.getTileMap()[x].length; y++) {
                batch.draw(layer.getTiles()[layer.getTileMap()[x][y]],
                        xOffset + (x * ((layer.getTileWidth() * scale))), yOffset + (y * ((layer.getTileHeight() * scale))),
                        (layer.getTileWidth() * scale), (layer.getTileHeight() * scale));
            }
        }
    }
}

EDIT: Yes, I'm aware the map looks weird, it's just random textures thrown in from a tile-sheet.


texts:
Our Levels consists of rooms.
Each room has an arbitrary number of portals into other rooms.
We frustum cull rooms by testing whether all portal vertices (a portal consists of a single quad) are outside of the frustum this is done recursively until no room is found.
This however has one flaw. if a portal is visibly occluded, it is still taken into account because it is within the frustum.

Is there an easy way to cull the rooms which are in the frustum but occluded?
I had Hardware occlusion culling in mind, but I am not sure whether this is too overkill.


texts: Voxel River Generation at Biome Borders or Biome Blending

texts: I'm creating a voxel (block, Minecraft like) game and I have different biomes (flatland, mountains, ect) and the problem is they are abrupt changes when biomes end /begin. I'm using 3d perlin noise, so I can't just "average out" the heights. So I thought to make rivers when biomes end /begin. Does anyone know how I could do this, or how it could work? With 3d noise I get very nice features, however the noise represents density rather than height, so I'm not sure how to go about doing "weight" and such. If not, how can I do blending with 3d perlin noise? Many thanks in advance. I'm also wondering of how  Currently, for each chunk of the world I have a certain chunkGen set, and when the biome changes (randomly determined) the chunkGen changes. Even if I were to generate on a block by block basis, I'm not exactly too sure how that could help me as the 3d perlin value I'm getting is of density. I think my best bet would be using 2d perlin with 3d perlin, the 2d for height and the 3d for ridges but I have no idea of how to implement this.  Would it also be possible to create a buffer terrain between the biomes? with the averages of the octaves, gain, frequency? EDIT: I've actually just tried buffer terrain but it doesn't work well, often enough it moves up randomly or happens in the middle of lakes.


texts: What is a good texture packing algorithm?  Technically, bin packing is NP-hard, so a heuristic is what I'm really after.


texts:
I want to try to build a multiplayer turn-based browser game.

What technologies do you recommend me to use for server side considering I plan to host it on a shared host? Would PHP be fast enough?


texts: On Function event of button is not loading C# Script?

texts:
I am making a car game in unity 5.0.4f1. I am facing two snags.

While installing 3.5 net framework, it gives an error. I searched,
it took my 2hrs and problem couldn't solve. Then, I reinstalled Unity. For this snag, what is the best solution in a way I won't waste my time anymore?
On the other hand, when I added a C# script using VS community 2015, after    dragging the script on the click event, No function doesn't show me the script name in the drop down menu. I'm following this tutorial, tutorial link. At 7:58 he added the script in on function. For me, it is not working.

using UnityEngine;
using System.Collections;

public class LevelLoader : MonoBehaviour {

    GameObject menu_Canvas;
    GameObject settings_Canvas;

    void Start () {

        menu_Canvas = GameObject.Find ("MainMenu_Canvas");
        settings_Canvas = GameObject.Find ("Settings_Canvas");

        settings_Canvas.SetActive (false);
        menu_Canvas.SetActive (true);
    }

    public void LoadLevel (int a) {

        Application.LoadLevel (a);
    }

    public void Quit () {

        Application.Quit ();
    }

    public void loadMenu () {

        menu_Canvas.SetActive (true);
        settings_Canvas.SetActive (false);
    }

    public void loadSettings () {

        menu_Canvas.SetActive (false);
        settings_Canvas.SetActive (true);
    }
}

Please help, as I have been trapped in the problem since few days.


texts: DirectX 10 - determining if hardware device is available

texts:
I am writing an offline renderer using SlimDX and Direct3D 10 that will need to be run on machines without graphics cards (servers). On these machines, I'll be using the WARP software renderer.

Is it possible to tell if a hardware device is present without throwing an exception in SlimDX? Currently I'm having to do this:

            try
            {
                Device device = new Device1(DriverType.Hardware, deviceCreationFlags,
                    FeatureLevel.Level_10_1);

                return device;
            }
            catch (Direct3D10Exception)
            {
                return null;
            }

And then create a WARP device if null is returned.

However, each time the exception is thrown, it breaks Visual Studio, which is annoying, and it doesn't seem like I should be catching an exception to determine if a feature is available.

Any way to do this?


texts: Rotation before scaling image/Lower resolution rotation? (XNA/C#)

texts:
Currently, when I rotate the image using SpriteBatch.Draw() the image is rotated after it is scaled. Resulting in:

Which is using the code
public override void Draw(GameTime gameTime) {
    sprite_batch.Draw(
        texture,
        parent.position,
        new Rectangle(0, 0, (int) 25, (int) 25),
        Color.White,
        rotation,
        new Vector2(texture.Width/2, texture.Height/2),
        new Vector2(2, 2),
        SpriteEffects.None,
        0f);
}

However what I would like to see is more on the grounds of

I've tried to directly edit the texture itself instead of rotating using spritebatch, only I have found that it was incredibly inefficient.
Edit 1:
I am currently looking around at RenderTarget2D and such. Possible solution to my problem.


texts: Get Stencil buffer working iOS OpenGL ES 2.0

texts:
I have been trying to get this work but either get black screen or reporting error when using XCode to analyze the GL code like below. Any help appreciated.  I am using Swift here if that making a difference. Any help appreciated.

The code I used to attach a stencil buffer is like below:

var depthRenderbuffer: GLuint = 0
glGenRenderbuffers(1, &depthRenderbuffer)
glBindRenderbuffer(GLenum(GL_RENDERBUFFER), depthRenderbuffer)
glRenderbufferStorage(GLenum(GL_RENDERBUFFER), GLenum(GL_DEPTH24_STENCIL8), 2208, 1242)
glFramebufferRenderbuffer(GLenum(GL_FRAMEBUFFER), GLenum(GL_STENCIL_ATTACHMENT), GLenum(GL_RENDERBUFFER), depthRenderbuffer)


texts: Do retail games use "inversion of control" and "dependency injection"?

texts: Many of the more diligent software developers I know are moving to inversion of control and dependency injection to handle references to objects. Coming from a Flash games perspective I don't know all the ins and outs of AAA studios, so: are these used in the retail game world?


texts: Placing tile on second layer results in wrong tile, or changes nearby tiles

texts:
So I am working on a 2d game and running into strange behavior when trying to add tiles to a tile map.

The first layer seems to work fine but if I add a new layer it will always place the same tile regardless of which tile I choose from the palette. Sometimes placing a tile changes tiles that were already placed elsewhere. Here is a video of the behavior, excerpted as a gif below:

It looks like it might be related to this bug:

UE-72279: Paper2D Tilemap doesn't render tiles correctly when more than one layer is added.

How can I solve this issue, to control the placement of tiles on my second layer?


texts: camera panning problems with "modelviewer" camera

texts:
I have a camera that rotates around a center point using a rotation matrix and radius for the zoom from the object. I need to add right mouse button panning in.

Here is the problem: when I change center.x and center.y depending on my cameras rotation around the object the camera ends up moving closer or farther from the camera. What I want is no matter which way the camera is facing to the object it should move on the cameras forward and up, not the models. What kind of math do I need to use for this?

My code to change the "center" or view target is as follows

var xdelta = mousestate.X - PreviousMouseState.X;
var ydelta = mousestate.Y - PreviousMouseState.Y;
if (ydelta != 0 | xdelta != 0)
{
    center += Vector3.Transform(new Vector3(0, ydelta * .02f, 0), rotation);
}


texts: Manipulating time in Unreal messes up Physics simulation?

texts:
I'm trying to achive a Super Hot like gameplay, where the time only flows when the player moves.

But when I stop time, then restart it, physics simulation will be messed up. Like:

Cloths starts flying around like they are in a tornado.
Rigidbodies fly away, like they were shot from a cannon.

All of these without any kind of forces being applied to them. They were just standing still, I stopped time, then I restarted Time and Booom, rigidbodies fly around.

I use this in the player's Tick method:

auto settings = GetWorld()->GetWorldSettings();
settings->SetTimeDilation(timeScale);


texts: What Situations is Saving a Game to Main Memory for?

texts:
I've been reading through Unreal's 'Saving and Loading' guide: Link

Within, they present a capability to save a game to main memory rather than secondary storage:

I haven't found any information on where this would ever be used.

The only situation I can fathom for this being useful is to keep data about other load zones in memory so that travelling through load screens into these zones is quicker.

Why, When and Where is this technique of saving to Main Memory used instead of saving to Secondary Storage?


texts:
Man, I'm really bad at drawing...
I feel myself really ashamed because I cannot draw even a little nice sword... :(

The problem is, on game development (I will be on the programming part, relax!) I will need to explain some game ideas to game artists, like "I need that city like this" or "that character needs to have that look and feel".

My idea is, I really need some BASIC skills on drawing some draft of what I'm thinking...

I'm bad in pen/paper drawing and photoshop/corel drawing, but I'm convicted to learn photoshop or corel to draft something...

Someone has passed that problem? What you recommend?


texts: How to search through large numbers of discrete objects that interact with each other, like Minecraft blocks?

texts:
Imagine you had a world like Minecraft, but wanted to bake in some sort of physics (okay, I was playing minetest actually).

For example, blocks under too much pressure might break, limiting how many blocks can be stacked on top of one another.  I see one approach to this:

Systematically check each block.  See if there is a block on top of that, a block on top of that, ect.  Then, determine the pressure on the block that you just started with.  Do this for each and every block.

I also imagine you could somehow check each block, then have it modify the properties of the blocks around it.  If all force was from top to bottom,  you could just start at the top.  But if you want to have a "net force" (so unsupported blocks accelerate) I have no idea how this could be implemented. For instance, three blocks are floating in mid air.

How can I solve this class of problem?


texts: Rorschach ink blot (aka Psychology test pictures) shader

texts:
(source: bonnefil.com)

I want this magnificent pattern to be in my game. So far I have figured out...

Draw one side, then render it twice left and right.
How do I render this pattern on one side? hmm...
I need help.

I need some insight on writing shader for this.

If you think is not shader fitting task, then let me know, hopefully with an alternative solution!

However I see no possible approach to achieve this without gpu. (unless you suggest to store bunch of prepared pictures of rorscach pic)