texts: Monogame: Why is my sprite looking the same on every resolution?

texts:
I want that my sprite(Mario) don't look the same on every Windows Phone resolution. If I use this code, the sprite is on every resolution on the right position but it also has the same size on every resolution.
In this picture, you see that the sprite on a resolution of 1280x720(it looks the same on 800x480)

Full Size

But if I don't use this code, my sprite looks smaller, but my sprite is no more on the right position if I change the resolution from 800x480 to 1280x720.
Is it possible that my sprite changes it's size automatically when I change the resolution and in addition, the sprite should be drawn on the right position. In my case, the sprite should always be drawn in the center of the screen.
In this picture, the sprite is smaller on a resolution of 1280x720, but the position is not correct. It should be in the center.

Full Size

What should I change so that the sprite is always drawn on the right position when I change the resolution? I don't know how to do that.

I'm not sure what is/looks better. The first possibility(the sprite has always the same size) or the second possibility(the sprite changes it's size when I change the resolution).
In addition, I want that the proportions of the sprite don't change. For example, a circle should look on every resolution like a circle. It should not look oval on a different resolution.

In my opinion, the second possibility looks better, but I'm not sure if I should do it like that. What do you think? Which possibility is better? How would you do it? What possibility is used by professional game designers?


texts: Currently to open the link i am using button sprite. But now i want to link a text to website. Is there any way to do this in AndEngine?


texts: Can I publish games with adult content to Android Market?

texts: I have a very old adult (e.g. boobs and stuff) arcade game (think Delphi 7/DirectX 8 age), that currently is backported to Droid. Can the game be published to Android Market? Are there any age restrictions?


texts: What is the pixels to units property in Unity sprites used for?

texts:
I'm starting to learn Unity for 2D development.

So, I am importing several sprites into the game, and I couldn't help but notice that there is a "pixels to units" property, by default on 100. I normally set it to 1. Is there a reason why I would need to have this value different than 1? Or, more generally, is there a reason to have multiple sprites with different


texts:
How do i make a AI enemy that go to player and if enemy arrives at collision (ex. stone collider) rotating to path , (unity 2D top view)?

(Enemy has a face sprite and  animator component)
In this pic , I want to do :ai enemy following player but when arrives to wall so it's face changes  the path and following again  . 2- if enemy 1 arrives to enemy2 so enemy face change the path for follow player


texts: Unity, depth behind a transparent object

texts: Is there a way to know how far away is any object behind a transparent object in shader? Like making water fully transparent when close to shore.


texts: Techniques for separating game model from presentation

texts:
I am creating a simple 2D game using XNA.

The elements that make up the game world are what i refer to as the "model".

For instance, in a board game, i would have a GameBoard class that stores information about the board.

This information could be things such as:

Location
Size
Details about cells on the board (occupied/not occupied)
etc

This object should either know how to draw itself, or describe how to draw itself to some other entity (renderer) in order to be displayed.

I believe that since the board only contains the data+logic for things regarding it or cells on it, it should not provide the logic of how to draw things (separation of concerns).

How can i achieve a good partitioning and easily allow some other entity to draw it properly?

My motivations for doing so are:

Allow multiple "implementations" of presentation for a single game entity
Easier porting to other environments where the presentation code is not available (for example - porting my code to Unity or other game technology that does not rely on XNA).


texts: Find a position within one radius, but outside other radii

texts:
I have an Object A which will attempt to stay within a certain distance of another Object B. I would like Object A to also try to stay outside a certain distance of one or more other Objects R.

The idea behind this question is the desire for a companion AI to follow the player around and provide support, but also try to stay out of the attack range of enemies.

Using the image above as an example, we'll say the distance/radius within which we want to stay to Object B is represented by the blue circle. The distances/radii we want to stay outside of for Objects R are represented by the red circles.

How can I find any point (perhaps the closest point? or the point least crowded by red circles?) in the blue circle that is not overlapped by a red circle?

Furthermore, approximately how expensive would it be to calculate these kinds of details?

And how would the answer(s) to the questions above be affected if we used spheres instead of circles (3D instead of 2D)?

I use Unity and C#, so please keep that in mind if you provide specific code examples. Thank you.


texts: Switching Screens without initializing them every time

texts:
I have a UI with four Screens (all extending a "main Screen") that users switch between very frequently, at the moment I am switching Screens using g.setScreen(new screen);, but this leads to the problem that I have to reload and initialize everything inside the Screen every single time, which is causing memory leaks.

Is there some way I can save the Screens in memory and just load them without having to re-initialize everything inside them? Or is this bad? Because my current approach is not going to cut it.

I was thinking something like initializing all Screens on startup and saving them in an array, then just loading the Screen I need from that array when I need it, ie g.setScreen(screenArray.get(nextScreen));. Is this a viable approach? Please any advice you can give will help, really need help with this.


texts:
I'm trying to implement a faster alternative to super-sampling for my isometric 2d monogame game (for when the view is zoomed out). The idea was that I would render the texture coordinates to the render target like so:
output.Color = float4(input.TexCoord.xy, 0, 1);

...And then I would sample the sprite using the surrounding pixels' texture coordinates to get an anti-aliased color. I first tried my method by only sampling the original pixel to see if I could replicate the original output first, but I can't make it work. This is the result I got:
output.Color = sprite.Sample(spriteSampler, tex.Sample(texSampler, input.TexCoord).xy);

I used point filtering, I tried disabling mipmaps, I tried offsetting the texture coordinates, and it just doesn't work. For some reason the sampled texture coordinates are linearly interpolated, which gives out nonsense texture coordinates at the edges of textures, producing black lines.
However, if I zoom in close enough and align the camera somewhat, I get the correct output:

So what is causing those black lines? What can I do to remove them?
Additional info:
Sprite dimensions:   2048 x 2048
Render target format for texcoords:   Vector2
Vertex declaration for the screen quad (not indexed):
vertices = new VertexPositionTexture[6];
vertices[0].Position = new Vector3(-1, 1, 0);
vertices[1].Position = new Vector3(1, 1, 0);
vertices[2].Position = new Vector3(-1, -1, 0);
vertices[3].Position = new Vector3(1, 1, 0);
vertices[4].Position = new Vector3(1, -1, 0);
vertices[5].Position = new Vector3(-1, -1, 0);

vertices[0].TextureCoordinate = new Vector2(0, 0);
vertices[1].TextureCoordinate = new Vector2(1, 0);
vertices[2].TextureCoordinate = new Vector2(0, 1);
vertices[3].TextureCoordinate = new Vector2(1, 0);
vertices[4].TextureCoordinate = new Vector2(1, 1);
vertices[5].TextureCoordinate = new Vector2(0, 1);

This is the code that converts the the computed coordinates for the blocks to screen space:
float4 PixelToScreen(float4 position)
{
    position.x = position.x * ((scale * 2) / resolution.x) - 1;
    position.y = position.y * ((scale * 2) / resolution.y) + 1;

    return position;
}


texts: Relative and absolute position with sprites in libgdx

texts:
In libgdx, can i add a sprite as children of another an set it with the relative coordinates of the father and not the stage?

Like in HTML when you add controls they are relative to its parent, but here i want it with sprites, i add the children in a Group class but the coordinates are absolute (relative to the stage)


texts: I do not understand the code version of time based sprite animation?

texts:
I'm Universo and for the longest time had coding issues around the concept of time-based sprite animation basically, do not know how to implement it and any code or explanation simple or complex that I've found has been extremely confusing to me and was hoping to have a kind person walk me through the code step by step, explaining exactly how this is implemented correctly.
Here's what, I believe to know about the concept and or idea for time-based sprite animation it is to construct a delay or halt of some code statement using time of some kind in milliseconds with a collection of moving images and or sprites however any attempts from the tutorial's or my own brain have resulted in inaccurate various speed sprite animations and not the consistent stable speed, Id appreciate and be grateful for here's some code to show my progress and perhaps help you understand my position in this mess baring in mind, I prefer my code be as extremely simple and speedy as possible within the limitations, of course:
JavaScript with HTML5 Canvas
window.onload = function () {

var canvas = document.getElementById("canvas"); // get the canvas object

var ctx = canvas.getContext("2d");
/* make sure we have a context for that canvas so we can draw stuff */

var FrameSize = 120; //120 pixels
var FrameNumber = 0; //obvious
var img = new Image(); // make a image object
img.src = 'sprite_ani.png'; // url to the image
var last = 0; // no idea

function Render() {

  ctx.clearRect(0,0 ,640,480); // clear screen
  now = performance.now(); //to get the current timestamp in milliseconds
  delta = now - last; // last is 0, how does this work?
  last = now; // last is now, why?

  if(delta > 20 //what does this value represent??) {
     FrameNumber += FrameNumber + 1;

   /* increment FrameNumber by 1 could have been FrameNumber++ */

     delta = 20; // No idea why I need to keep this the same number??
  }

  if(FrameNumber>=4){   //just to make sure this is the end of the frame number sequence
     FrameNumber = 0; // to reset the frame number
  }
     ctx.drawImage(img,FrameSize*FrameNumber,0,120,120,0,0,120,120);

     /*
     perticularly draw a sequence of images and switch each individual image
     in that sequence based on the equation

     FrameSize
     (number to multiply the pixels by)
     * // multiply operator symbol
     FrameNumber
     (the pixels for the FrameSize to multiply with)
     */

     window.requestAnimationFrame(Render); // do the Raf stuff part one
}
window.requestAnimationFrame(Render);  // do the raf stuff part two
}

As you can see, it's extremely simple yet, I'm still struggling to not only understand it but extremely simply implement it, I'm not a fan of over-complicated coding hence why I ditched c++ ages ago.
Could someone in extremely simple english guide me through time-based sprite animation in the context of JavaScript preferably, Id also really appreciate various time-based sprite animation methods being explained too in extremely simple terms but not holding out, I thank you for reading this far.


texts:
I am making a game that needs to detect when the device gets turned over in landscape mode to landscape-flipped to change some game mechanics when the player does so. The project is already set to work only in those two orientations.

I am using an object instantiated in the room with the following code in Step :

show_debug_message("Orientation : " + string(display_get_orientation()));

But I always get the same input - either "landscape" or "landscape-flipped" and it doesn't seems to change the output in runtime, although if I press the power button on the phone and the game goes in pause, if I flip the phone and I return to the game I get the opposite status, but it keeps repeating itself, as it could not read the real orientation of the phone.

Anyone has faced this problem before?

Cheers!


texts: How to calculate 1st, 2nd, 3rd place and draw conditions in local multiplayer game?

texts:
I have a local multiplayer game with an end of round screen that pops up after each round. I'm trying to figure out the logic to calculate the 1st, 2nd, 3rd place from a maximum of 4 players. I also want draw/tie conditions. It's possible for 2 or 3 players to get the same score. The score is just an int for each player. I've been struggling with this for a while... Any help appreciated, even if its just some pseudo code to point me in the right direction. Also, I'd like to avoid using Linq if possible, as I've heard it doesn't play nice with Unity. Thanks

Edit:

Below is what I've managed to come up with for determining the draw conditions. Doesn't seem to hold up in all cases though... Surely there's a simpler approach?

         PlayerScore[] orderedScores = m_scores.OrderByDescending(ps => ps.score).Take(4).ToArray();

        _1stPlacePlayers.Add(orderedScores[0].playerNumber);

        if (orderedScores[0].score == orderedScores[1].score)
        {
            // 2 player draw 1st place
            _1stPlacePlayers.Add(orderedScores[1].playerNumber);
            if(orderedScores[0].score == orderedScores[2].score)
            {
                // 3 player draw 1st place
                _1stPlacePlayers.Add(orderedScores[2].playerNumber);
                if(orderedScores[0].score == orderedScores[3].score)
                {
                    // 4 player draw 1st place
                    _1stPlacePlayers.Add(orderedScores[3].playerNumber);
                }
            }else if (orderedScores[1].score == orderedScores[2].score)
            {
                // 2 player draw 2nd place
                _2ndPlacePlayers.Add(orderedScores[2].playerNumber);
                if (orderedScores[1].score == orderedScores[3].score)
                {
                    // 3 player draw 2nd place
                    _2ndPlacePlayers.Add(orderedScores[3].playerNumber);
                }
            }
            else if (orderedScores[2].score == orderedScores[3].score)
            {
                // 2 player draw 3rd place
                _3rdPlacePlayers.Add(orderedScores[3].playerNumber);
            }
        }

        else if (orderedScores[1].score == orderedScores[2].score)
        {
            // 2 player draw 2nd place
            _2ndPlacePlayers.Add(orderedScores[2].playerNumber);
            if (orderedScores[1].score == orderedScores[3].score)
            {
                // 3 player draw 2nd place
                _2ndPlacePlayers.Add(orderedScores[3].playerNumber);
            }
        }
        else if (orderedScores[2].score == orderedScores[3].score)
        {
            // 2 player draw 3rd place
            _3rdPlacePlayers.Add(orderedScores[3].playerNumber);
        }


texts: Efficient solution for multiplayer space partioning?

texts:
This question is a little tricky, but I will try to make it clear.

Lets say I am building an online game (not MMO-scale), but that supports as many players as possible, in a authoritative server approach. I want really big worlds with lots of AI simulated enemies.

I am aware of a few strategies to save server CPU by subdividing the space and not processing what doesn't need processing. I have already split the world by regions, that will require loading times and small transitions, which I think is important to maintain the quality of gameplay when playing locally (alone or even with a couple of friends). I don't expect the players to be in more than one or two regions.

The problem is that a region can become pretty big, and have a lot of NPCs simulating at once. How do I handle this without affecting the players' experience? Approaches like one server per region and alike are not in the table.

I am mainly looking for data structures to hold hordes of enemies, and even peaceful NPCs. To finalize the question, please note that vehicles exist, therefore its considerably fast to travel within a region, influencing the "when" to cull areas.


texts:
This is the "init" code of the Renderer class:

glGenBuffers(1,&_idVBO);
glGenBuffers(1,&_idEBO);
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,_idEBO);
glBindBuffer(GL_VERTEX_ARRAY,_idVBO);

GLint lUV       = glGetAttribLocation(_SID,"inUV");
GLint lPosition = glGetAttribLocation(_SID,"inPosition");

glEnableVertexAttribArray(lPosition);
glEnableVertexAttribArray(lUV);
glVertexAttribPointer(lUV, 3, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)0);
glVertexAttribPointer(lPosition, 2, GL_FLOAT, GL_FALSE, 5 * sizeof(GLfloat), (GLvoid*)(3*sizeof(GLfloat)));

...and this is the "flush" function:

glBindBuffer(GL_ELEMENT_ARRAY_BUFFER,_idEBO);
glBindBuffer(GL_VERTEX_ARRAY,_idVBO);
glBufferData(GL_ARRAY_BUFFER,_lVBO*sizeof(GLfloat),_pOriginVBO,GL_STATIC_DRAW);
glBufferData(GL_ELEMENT_ARRAY_BUFFER,_lEBO*sizeof(GLuint),_pOriginEBO,GL_STATIC_DRAW);

glDrawElements(GL_TRIANGLES,6,GL_UNSIGNED_INT,0);

The glDrawElements call crashes with error code c0000005, which is caused by memory acces violation i.e. bad pointers.
But I do not understand where the problem is. Any ideas? Thanks in advance...


texts:
I am working on the asset bundle method, i know how to use the asset bundle for untiy 4.x series but i am trying to do this in unity5. I heard in unity 5 is more compatibility to do. I searched in youtube and google but i didnt get the proper tutorial to how to use that. So please suggest me or provide some tutorial to do this.

Thanks in Advance.


texts:
I am currently considering my options for game development and deploying to Steam Greenlight. I really like Java with libGDX, especially for its cross platform Android potential, and I understand that it is possible to deploy Java games on Steam. I am also very comfortable with having to create some sort of wrapper so that my Java game could call into the C++ Steamworks API.

My question is about what deployment problems I might run into. Specifically, with the client machine's installation of the JRE. I have seen many Steam installers check for the .NET runtime. Should I do a similar check and install for the JRE?

Are there any glaring reasons why Java deployment on Steam would be a nightmare to deploy and maintain vs something like C# using Monogame?


texts: How To Create A Dynamic 2D Rope In Unity?

texts:
I'm trying to create a 2D rope in Unity that is fixed at one end and other is moving up and down to pick up objects just like a crane.

I've tried adding a cube and making more instances of it, adding a parent-child relation and hinge joint between them when I press the Down arrow.

It worked, but when I tried to move them sideways a big noise is generated.
I then tried with a spring joint, but that didn't work.


texts: Resize a texture using the full SpriteBatch.Draw in XNA

texts:
I'm using the full Spritebatch.Draw function to draw my explosion sprite since I also need rotation. I am using the Scale value to resize my texture, but I can't get it to be accurate.

I want to be able to set the textures Size to a specific pixel size, width/height are exactly the same. Say the texture is 128x128, and I want to resize it to be 23x23.

Heres my current code:

  Vector2 Scale = new Vector2((float)sprite.Area.Width / (float)sprite.Texture.Width, (float)sprite.Area.Height / (float)sprite.Texture.Height);
            spriteBatch.Draw(sprite.Texture, sprite.Position, null, sprite.Color * sprite.Alpha, (float)Math.Atan2(sprite.Angle.Y, sprite.Angle.X), new Vector2(sprite.Area.Width / 2, sprite.Area.Height / 2), Scale, SpriteEffects.None, 0f);

I have the Area set to be the size I want it at, however the Draw function seems to not be drawing it to the exact size.


texts: Pixmaps, ByteBuffers, and Textures....Oh my

texts: My ultimate goal is to take a specific region of the screen, and redraw it somewhere else. For example, take a square from the upper left hand corner of the screen and redraw it on the lower right hand corner, so that it is basically a copy of that screen section; kind of like a minimap, but at the same scale as the original. I have looked in to pixmaps and bytebuffers. Also maybe copying that region from the backbuffer somehow. Wondering the best way to go about this. Any help is appreciated. I am using opengl es and libgdx for what it's worth.


texts:
I'm trying to create screen transitions similar to those found in Mega Man or Legend of Zelda (i.e. the active elements of the first screen are stopped as the screen scrolls in the direction of the new screen then the active elements of the new screen become active again).  I'm making this for a 2D browser game written in JavaScript.
Right now, I can only make the screen scroll as long as the player remains on the edge of the screen; the player can still move when the transition is taking place, which stops the scrolling midway through transition. Below is the code I'm using to make this happen.  If anyone can help me with this, I would really appreciate it.

//checks if player has touched right side of screen
//*used to change screen color
if(this.rightX == gameWidth){
    screenShift = true;
    if(bgDrawX2 > 600){
        bgDrawX-=5;
        bgDrawX2-=5;
        drawBg();
    }
    screenShift = false;
}

if(this.leftX == 0){
    screenShift = true;
    if(bgDrawX2 < 1200){
        bgDrawX+=5;
        bgDrawX2+=5;
        drawBg();
    }
    screenShift = false;
}


texts: Is using Game in libGDX for more than just switching screens a bad practice?

texts:
I'm the process of refactoring the prototype of my game to use multiple screens using the Game - Screens model.
I found some information (I think in more than one place) that the Game class should be used only to switch screens.
I've checked some libGDX demos and they indeed follow that pattern.

Initially I wanted to do it the same way, but then I found more and more problems with this approach. AssetManager is the best example I think. Since there is only one instance of it and I would like to use it in more than on screen why not use the Game object to store it? Same thing with Viewport for example or Camera, if I'm happy with just one. What about single instances of my own classes, that I need throughout the whole game, why not to use Game for that?

I know that there are different ways to achieve what I wrote above. I can use static methods like here or create my own class to store all the needed objects and pass its instance between screens, but since I'm already passing instance of Game, what's the point?

To summarize: is using Game to anything else than to switch screens a bad practice? If so, why?


texts: Is it useful to monitor framerate over the course of an arbitrary (but long) period of time?

texts:
How useful is it to keep a measurement of framerate over the course of long times (such as an hour) spanning multiple scenes/data environments?

I've had plenty of times where data throttling/pushing was based on a poll of what's going on in regard to framerate over the course of a minute. I've used ~10 minutes a few times when the game can be sensitive to upcoming high-detail/volume renders to task some unused processing power/memory bandwidth ahead of time.

Anyone come across any situations where long-term polling of frame speed is useful?


texts: How can you tell if what you're buying is legal?

texts:
In the past few days I've been browsing 3D asset marketplaces and repositories (I've been doing it for ages, but a lot recently). Many assets are paid for, others are free. In the past few days I've found suspicious activity on these sites, for example something sold on one site and given free on another site. I've recently reported many of these cases to the respective sites. The problem is, that now I look really closely at these models before buying them. I try to compare textures, geometry where I can, and poly count as tools for sniffing out property theft (copyright infringement).

I have bought some real bargains lately, and I know they're the real deal because I have spoken individually with the artists and am 99% I know it's the real deal. However how can I approach a store and have any confidence that what I'm buying isn't some reskinned asset ripped from a commercial game? (These are harder to spot as comparing geometry is harder)? I've tried to stick to reputable and popular sites, but I've already reported a number of people on these for abuse. It's worrying how often sellers aren't discovered by the site's owners or anyone else before I say something. For example there might be multiple thumbs up or 5 star reviews for people buying models that I've found out are actual rip-offs, or have been ripped off by someone else.

How can I know that a model I buy didn't come from some commercial game from 5 or 10 years ago, or from some mod from some point in time? Do I have any protection for example in future I release a commercial game and it's discovered that one of my assets from someone's mod or a commercial game from the past?

A while back I'd bought some products that seemed to be real bargains, and now that I'm a lot more cautious about these issues, I regret buying them.


texts: Capturing video with sound, from cameras in Unity?

texts:
I want to capture video from cameras and save them in Unity. There is a function Application.CaptureScreenShot() but it only captures images. There is another function that only captures images, too.

It's said to be possible to capture images and attach them together to make a video file but I think it uses a lot of resources and makes the process heavy and in the end there is still no sound.

I mean ingame cameras not reall cameras. I want to capture videos from game

Is there any other way for me to record sound?


texts: Java LWJGL - How can I click to interact with objects?

texts: I want to be able to click on a monster to walk to him and start attacking him. The part that doesnt make sense to me is the conversion between the mouse position, and the actual terrain position. There are camera angles to worry about, heights, seperate terrains, how is this done???? I am using Java LWJGL and rendering with OpenGL 4.4


texts: How to make a vision cone for the enemy in game maker?

texts:
I'm making an enemy object where the enemy look for the player when he's going on a patrol

I want the vision cone to changes direction corresponding to the sprite.When the sprite turn right,the cone will faces right,left and the cone will faces left and when he move to any direction the cone will move with him and changes direction accordingly

I also want to give the cone certain ranges.The longest range's where the enemy will be in doubt and get to that position to investigate,medium range he'll start chasing,shortest range he'll attack.

I hope someone can help me.


texts: Why do games like Guild Wars 2 and Clash of Clans require you to manually collect loot?

texts:
For example, in world vs world in Guild Wars 2, enemies drop bags that you have to manually collect. Then you have to manually open the bag which may contain other bags that you have to open.

In Clash of Clans, you have to click on the gold mines to collect the gold. This same principle is in Farmville also.

Why don't these games put the loot directly into your bags or gold storage?

Are the players unlikely to notice that they are getting bags or gold unless they take a physical action?

Is there a behavioral reinforcing that's happening by requiring a physical gesture?

This irritates me but when I see it in multiple games it makes me wonder if there is a gaming concept behind it that is fun for some people (or if not fun, part of the "addictive" nature of the game).


texts:
The title might be confusing and I don't think this short explanation is 100% accurate, but I will try my best to show the problem.
So I have this hierarchy:

And I want to change "measureOfTime" value in all subWave in wave[i], because I had no clue how to do this in a short way (at least I bet there is a shorter way) and I made this:
    using UnityEngine;

public class EnemySpawner : MonoBehaviour
{
    [Header("Set this value here to set time to 1 wave")]
    public float timeUntilWave;
    [Header("Measure Time basically = 0")]
    public Wave[] waves;
    public float waveTime;
    public bool roundStarted;
    public int wave;

    private void Start()
    {
        wave = -1;
        roundStarted = false;
    }
    private void Update()
    {
        if (timeUntilWave >= 0)
        {
            timeUntilWave = timeUntilWave - 1 * Time.deltaTime;
        }else if (timeUntilWave < 0)
        {
            roundStarted = true;
            wave++;
        }
        if (roundStarted == true)
        {
            waveTime = waveTime + 1 * Time.deltaTime;
            int subwaveLenght = waves[wave].subWave.Length;
            int count = 0;
            while (count <= subwaveLenght)
            {
                waves[wave].subWave[count].measureOfTime = waves[wave].subWave[count].measureOfTime + 1 * Time.deltaTime;
                count++;
            }
        }
    }
}

And in lines 33 and 37 I see an error: "IndexOutOfRangeException: Index was outside the bounds of the array."
And here are 2 questions:
Why those errors appear here?
Is there an easier way to raise the value in arrays in an array?
I hope it's not too confusing, and thanks for your help!


texts: VBO triangle not rendered using Freeglut Opengl 3.x, not understanding the weird fixes

texts:
I've just started to learn OpenGL 3 and I'm using freeglut for the context. I ask for a 3.3 context using:

glutInitContextVersion(3,3);
glutInitContextFlags(GLUT_FORWARD_COMPATIBLE | GLUT_DEBUG);

I then query the version I'm using with:

int glVersion[2] = {0,0};
glGetIntegerv(GL_MAJOR_VERSION, &glVersion[0]);
glGetIntegerv(GL_MINOR_VERSION, &glVersion[1]);

Furthermore in my simple program, I create a triangle using a VBO. When I compile and run, the triangle is not rendered.

There are three ways that fix the problem and I don't understand why. The first method is to uncomment the first two lines of code I posted. In this case, the 3 next lines I posted, still report that I'm using OpenGL 3.3.

The second method it to wrap the VBO in a VAO.

The third one is to ask for a 2.1 context but in this case a version 3.3 is being reported again.

Could you help me understand this behaviour? Is it specified somewhere in the OpenGL specification that a VBO needs to be wrapped in a VAO in versions 3.x?


texts: Calculate vector3 global point projecting it in local space using Unity and C#?

texts:
How to project a vector 3 locally ? Unity has a special function for this?

For example, if a has a GameObject that contains 2 children Vector A (transform) "My A Arrow" and Vector C (transform) "My C arrow projection".

I wish a C# solution script for "C" vector (transform) so that it can be used in Unity Game engine.

Just for example:
My game object "A" is child moving and rotating locally.  I wish to make the projection locally. "B" is my world forward in case is needed. "C" is a simple projection of "A" to the plane in local axis.

Is simple to get the vector in world global axis, just taking x (x = 0f). But I fail locally, since my parent GameObject is rotating.

Attempted solution.
    public Vector3 vector_A, projection_C;

vector_A= new Vector3(4f, 5f, 11f);

void FixedUpdate()
{
    projection_C = transform.TransformPoint(vector_A);
}

I try using transform, rotation, vector3 unity functions and quaternion. My skill was not at the level to understand wich function to choose for the task
reference: https://docs.unity3d.com/ScriptReference/Vector3.html

I was able to get the solution but was so complex that I was thinking that Unity has a function that makes the local projection.

This is my attempt to describe the process:

First you need to make a clone of the game object, rotate it to world global and move it to origine 000. The child vector will folow the perent game object. Now you can make the projection of "A" taking out x. The result "C" must be rotated and move by the original game object rotation and position.


texts: Can a rules engine produce manageable and complex AI?

texts:
I am currently in the middle of creating an AI village simulation in Java. Having implemented a simple rules engine for dialog, I am wondering if this DSL can be extended for AI. I have previously implemented both GOAP and behavior trees, but considered GOAP to be confusing for the average user. Behavior trees may still be an option.

In this case, I expect the AI to be able to control interactions between villagers (covered within the rules system already) and to manage the goals/daily actions of both individual villagers and the village as a whole. Actions could range from gathering resources, to deciding what to build on a broader scale.

However, I have concerns about whether a rules system will be able to manage hierarchy or many complex situations. There may also be some interaction with non technical users, so understandability is important.

The rules engine as it stands currently takes in a number of facts on an event, matches it to the best rule and executes a number of actions.

The outcome of the AI needs to be sufficiently complex as to be believable; for example, there may be many competing desires to relax, work on a pressing task etc. This needs to be able to be managed and prioritized as tasks come up. A village wide AI can assign tasks to individual villagers based on their abilities and the urgency of the task. There are randomized events that can change the priority of certain tasks. My main concern is whether the rules engine will be performant, be able to schedule tasks well and be responsive to dynamic conditions.

Is a rules based engine desirable for this kind of AI?


texts:
I have the following code:

import pygame,random

pygame.init()
screen=pygame.display.set_mode((480,360))

map=[]
for y in range(32):
    row=[]
    for x in range(32):
        row.append(random.randint(0,2))
    map.append(row)

camera=[0,0]
running=True

while running:
    screen.fill((255,255,255))
    for y in range(32):
        for x in range(32):
            tile_position_x = (x*16)-camera[0]
            tile_position_y = (y*16)-camera[1]
            pygame.draw.rect(screen,(255,0,0),(tile_position_x,tile_position_y,tile_position_x+16,tile_position_y+16))
    pygame.display.flip()
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            running=False
        elif event.type == pygame.KEYDOWN:
            if event.key == pygame.K_UP:
                camera[1]-=10
            elif event.key == pygame.K_DOWN:
                camera[1]+=10
            elif event.key == pygame.K_LEFT:
                camera[0]-=10
            elif event.key == pygame.K_RIGHT:
                camera[0]+=10

pygame.quit()

When running this I find that when you scroll a few pixels in any direction the screen looks like this:

Notice the long unsightly white line on the left side. Why is that there? I've read and reread all of my code and it doesn't make any sense why these problems are happening. My only explanation would be that there is some kind of rounding problem going on in my code. But I haven't found any.


texts: How to access internal data from separated rendering-layer?

texts:
I am currently rewriting a project I have been working on last year and I’m utterly stuck trying to "correctly" separate the game-logic from its representation. I know why this is beneficial and I sort of get how to build the representation into its own subsystem but if you actually encapsulate all the game-states into a different object or even library, how can you draw the scene?

Example:

Say we are working on the Super Mario game. There would perhaps be some Mario-object that encapsulates the different states Mario can enter (e.g. Small, Big, Fire-shooting, Mounted, …). These states are not purely visual since Mario’s movement-speed or damage-handling depends on this.

However, the way Mario is drawn also depends on this very state. So how would the rendering-layer know which sprite to bring onto the screen?

Pretty much everything the game-logic does causes some sort of animation, sound, or other output. In a way, having the drawing-logic mixed with the internals seems to be the cleanest since they really do belong together.

If you do separate the game-logic from its representation, there needs to be a way to access the data. What’s the best way to do that? I could think of these:

Data-binding by using some Event-system

Every time some state in the logic-layer changes, it could publish some event to which all other parts of the game can subscribe to. Upon receiving an Event, they can update themselves and load the appropriate animations.

However, this feels like we’re removing the responsibility of drawing the state onto the screen just to add the responsibility of firing an Event, which might actually be messier: There would be Events for each entity and each state, every spell that can be cast, every changed movement-parameter,  plus every started, finished and interrupted attack – the list is huge compared to a function that “just renders the internal state”.

Also, there is a lot of bookkeeping to be done since each Event needs to manage a list of subscribers, which would probably be an Interface resulting in many indirect calls, which might cause a performance-hit as well.
Access the data from the rendering-layer

The representation-layer could just query the state, either by simple Getters or a complex Entity-Component-System where the data would be accessed plainly, anyway.

It still feels wrong to open up the (encapsulated) state like this, but it seems to be cleaner approach. In another post, I saw the use of the visitor-pattern, which sort of does this as well, but then there would be a Draw()-method on the game-object again, which sort of defeats the purpose, doesn't it?

Any input is highly appreciated cause I really want to stop thinking about it and just get into coding again. :D

Thank you so much!


texts: SFML game only runs smooth at high framerate (Windows 10)

texts:
I am trying to make my game smooth on low and high fps. Right now, it only runs smooth when I don't limit the framerate. If I run it at 60, then my sprite is noticeably "sluggish". I believe this happens because of the FPS spikes like crazy. It goes from 20-65 FPS and sometimes to the thousands.

I tried to implement a fixed timestep as per this tutorial: http://gafferongames.com/game-physics/fix-your-timestep/, which made it better. However, you can still notice that it is not smooth if the framelimit is limited.

So it only runs smooth like this:

window.setFramerateLimit(0);
window.setVerticalSyncEnabled(false);

Otherwise, it doesn't.

I do believe, though, this is only being caused on Windows 10. I had someone try it on their Linux machine with a Nvidia graphics driver and they said it ran smooth even with a framelimit. I have a Nvidia graphics driver as well but my OS is Windows 10.

Here's the code:

Game.h: https://gist.github.com/anonymous/4dce9df0ee983016466f19d4fd43940d

Game.cpp: https://gist.github.com/anonymous/9724aa1336c231b3cf96b726316ba14b

Player.h: https://gist.github.com/anonymous/610ffaecdd85c741058afec32eace912

Player.cpp: https://gist.github.com/anonymous/cf0a6e3e7ffaeaa39088a6e92c069556

Whole project (6 files with code): https://dl.dropboxusercontent.com/u/735021/Spritesheet.zip

Any help would be appreciated! Thank you!


texts: How do I use the Minecraft Coder Pack on Linux

texts: I downloaded the Minecraft coder pack to mod the game and decompile it, but how do I use it on Linux. Some sources seem to give specific directions, but they are not clear and they involve executing the .bat files. My Ubuntu does not recognize .bat file. How do I decompile a class file from changing a Minecraft version jar file to a zip and unzipping it? How do I decompile one of those class files using Minecraft coder pack? I have been wondering what at least some of the Minecraft source code looks like.


texts:
I'm creating a 2D top-down RPG, and many of my buildings/scenery have non-rectangular corners to the textures. Does anyone know a good way to create circular/triangular/polygonal hitboxes, or is too intensive too be worth it?

P.S. If it is too intensive, I can stick with rectangular hitboxes, no big deal.


texts:
I used BEPUphysics for my XNA 4.0 game , the problem is that I load my model.fbx from into the game then add it to the space of physics engine , but when I change the scaling matrix of my Model then collision did not work , if I keep model scale the same then my model response to collision and every thing look good !

some says to me that your collision shape (it's often box ) that bound your model have to be changed also if the Model changed ? is this true ? (If yes !!! what is this ????)


texts:
I'm trying to write a platforming game where the sprites for the level backgrounds are broken up into 512x512 chunks. I keep 3 chunks in memory at a time and I'm trying to write code to blit all three to the screen. Here is the current code I have:

SDL_Rect where;
where.y = -game->camera->y;

where.x = -game->camera->x - MAP_WIDTH;
SDL_BlitSurface(left_chunk, NULL, screen, &where);

where.x = -game->camera->x;
SDL_BlitSurface(center_chunk, NULL, screen, &where);

where.x = -game->camera->x + MAP_WIDTH;
SDL_BlitSurface(right_chunk, NULL, screen, &where);

The issue I'm running into is that whichever chunk gets blitted first is the only one that shows up. The rest fail to appear onscreen. I think the issue might have something to do with alpha transparency, but even if the chunks don't overlap at all they still fail to blit. In other parts of the code I'm blitting multiple things to the screen at once, such as characters and backgrounds, and they all show up correctly. This particular segment of code is the only area I'm encountering this problem.

If I comment out the line that blits left_chunk, it changes to this:


texts: What are the main requirements to port a game to Linux

texts:
Steam for Linux is out today and I was surprised to see many games already being sold, which made me wonder what are going to be the difficulties for all those games to be ported to Linux. I broke this though into 3 questions:

Is it a matter of basically make the game run in OpenGL?
Are there any engines that build to Linux?
Did Valve have any hand on the development of some framework/toolset/OpenGL to make porting easier?


texts: I have a chess game and I have all the movement for the pieces coded but all of the pieces, not just the knight, can move over the top of the other pieces. What would be the least intrusive way to prevent this in Game Maker DnD (Drop and Drag)?


texts: Keeping crosshairs & GUI onscreen - SFML

texts:
I read this question, but didn't understand the implementation suggestions with SFML on C#.

For example, right now I'm just trying to make sure that the mouse crosshairs stay onscreen constantly. I tried using this code:

        View lastView = this._mainWindow.GetView();
        this._mainWindow.SetView(this._mainWindow.DefaultView);
        this._mainWindow.Draw(crosshair);
        this._mainWindow.SetView(lastView);

After drawing all other sprites and before call this._mainWindow.display(), when beforehand I set crosshair.Position based on its position relative to the window, not the view.
This just keeps the screen locked and prevents screen scrolling. Any suggestions?


texts:
I have a simple question.

For people that know and built ogre3D from source as a Static library, what is the order of which the libraries should be linked?

The libraries I need to be organized are:

Ogre Plugins
'libOgreMain.a'
Ogre RenderSystems
Boost(version 1.47)link
Ogre's Dependencies

The reason I'm asking is because in the Ogre forums, I have asked about this and didn't get a good reply... yet.

The other reason is because even though I link to the boost library, I get this error:

undefined reference to '_imp___ZN5boost6thread20hardware_concurrencyEv'

My compiler is MinGW with CodeBlocks as the IDE.

And my main computer I'm building on is Windows Vista 32 bit.


texts:
I programmed a game in c++. Now I want to pack the finished product.
Game runs fine from within the compiler.
But how can i link the assets(like images, music etc) of the game to the exe ?
When I run the executable, it says it is not able to load any assets and terminates immediately. How can I bind the assets with the executable ?


texts:
I have a project where a minion overlaps the tower.

Needless to say, the problem occurs when more than one minion overlaps the tower at the same time.

It turns out I've figured out how to go through this problem, or at least ways.

It is only to condition a certain event/function once and define a loop.

I can cause the damage to be applied to the tower correctly if I make the code in the tower (adding an information about the amount of minions overlapping the tower).

Blueprint:

The problem is that the overlap oscillates. This disrupts the reception of variable information, since the minion at some point stops overlapping the tower.

I tried to fix this by adding a parameter to the event, but using it I can not reference the tower variable:

Not even using the construction script:

I thought of something like a variable receive the reference of the tower, and if at the time of receiving the variable the reference of the tower fails, use it.

But all that I tried in this sense, something similar happened to that shown in figure 2.


texts: How is terrain editing implemented like a sculpt tool?

texts:
Some creativity/sandbox games have a terrain editing feature. When thinking of a terrain, I'm thinking of a grid of vertices. The elevation of each vertex is then determined by a heightmap (image). And the user can edit this elevations, so you get mountains and valleys.

Most times terrain editing is 'just' changing the height component of the positions of vertices in an existing grid of a fixed amount of vertices.

Now I see some games that make it possible to do the following:

This seems way more complex than just a grid and a heightmap.

I have thought a lot about this, but what is the best/most common approach to implement this?

I think it's difficult to find a good data structure for the
vertices.
I'm pretty sure, during editing, vertices are also created and added
into the terrain, which also seems complex.
All attempts to create indices seems a hell of a job to me. (Think of rendering this in triangle strips)


texts:
I'm creating a mmorpg game with a little team, and we want to add a player-objets collisions system. We want players to be able to walk on a heightmap ground, and walk/be blocked by objects.

I found the bullet physics library (I already used his Java wrapper), but I don't know how to make it enough efficient for a VERY huge map, and a lot of players on it.

In this game, there will be a very huge world (loaded by a chunk system), with all players on the same world. So how can I made an efficient way to make player(AABB)-objects(shapes with triangles) collision system in a very big map?


texts: Why are there different ways of building projection matrices?

texts:
Matrix.PerspectiveFovLH documentation page says that this method uses the following formula to build a perspective projection matrix.

[w, 0, 0, 0]
[0, h, 0, 0]
[0, 0, zFar/(zFar - zNear), 1]
[0, 0, -zNear * zFar / (zFar - zNear), 0]

where

h = cot(fovY / 2)
w = h * aspectRatio

DirectXMath's DirectX::XMMatrixPerspectiveFovLH uses the same formula but with a difference. It calculates w as w = h / aspectRatio therefore creates a different matrix.

There is a difference between orthogonal projection matrix building too.

Why are there such differences or am i missing something?


texts: RPG Monster-Area, Spawn, Loot table Design

texts:
I currently struggle with creating the database structure for my RPG.
I got so far:

tables:

area (id)
monster (id, area.id, monster.id, hp, attack, defense, name)
item (id, some other values)
loot (id = monster.id, item = item.id, chance)
spawn (id = area.id, monster = monster.id, count)

It is a browser-based game like e.g. Castle Age.
The player can move from area to area.
If a player enters an area the system spawns, based on the area.id and using the spawn table data, new monsters into the monster table.
If a player kills a monster, the system picks the monster.id looks up the items via the the loot table and adds those items to the player's inventory.

First, is this smart?
Second, I need some kind of "monster_instance"-table and "area_instance"-table,
since each player enters his very own "area" and does damage to his very own "monsters".
Another approach would be adding the / a player.id to the monster table, so each monster spawned, has it's own "player", but I still need to assign them to an area, and I think this would overload the monster table if I put in the player.id and the area.id into the monster table.

What are your thoughts?

Temporary Solution

monster (id, attackDamage, defense, hp, exp, etc.)

monster_instance (id, player.id, area_instance.id, hp, attackDamage, defense, monster.id, etc.)

area (id, name, area.id access, restriction)

area_instance (id, area.id, last_visited)

spawn (id, area.id, monster.id)

loot (id, monster.id, chance, amount, ?area.id?)

An example system-flow would be:
Player enters area 1:

system creates area_instance of type area.id = 1 and sets player.location to area.id = 1

If Player wants to battle monsters in the current area:

system fetches all spawn entries matching area.id == player.location and creates a new monster_instance for each spawn by fetching the according monster-base data from table monster. If a monster is fetched more than once it may be cached.

If Player actually attacks a monster:

system updates the according monster_instance, if monster dies the instance if removed after creating the loot

If Player leaves the area:

area_instance.last_visited is set to NOW(), if player doesn't return to data area within a certain amount of time area_instance including all its monster_instances are deleted.


texts: How to force a line break before the last word of a line reach the edge?

texts:
I'm printing a sliding text by adding each letter after a short period of time. My problem is that when the text multilines, the last word of a line starts on the current line and jumps to the next when it grows too big to fit, making for an ugly effect.

So I guess I need to determine the word where the line would break and replace the previous space with line break to force the break before the word reach the edge. I'm failing to see how to do that. In addition, if there is any way to make the libgdx BitmapFont calculate that I would love to learn.


texts: Web application interacts bi-directional with server program?

texts:
I want to write a web application to play chess against the engine Crafty. I'm not new to PHP and javascript, but must learn how to interact with a server process : how can a web application and/or (jQuery) ajax interact bi-directionally with a (linux) program running on the server?

At this moment i am developing on (Apache) local host. Crafty is installed on my Ubuntu PC. This well-known chess engine has no GUI, it runs in terminal by the command

$ /usr/games/crafty

and so you can play chess against it and even see it's calculations. I can make Crafty run by PHP, using the functions proc_open() or exec(), and most documentation i found states that the output stream should be a file .. But i think i don't want such setup, because then the webpage should be constanty polling that file (eg. by ajax) to see if some new data was appended, right?

How can Crafty talk to the web page directly, saying "i have calculated another variation" or "i have decided a move" etc, then display this info on the web page and let the user give some counter move, just like in terminal. Isn't it possible to use some session / stream / listener?

I have no clue at all, can anybody point me in a right direction?


texts: How can I play an animation as long as the player is on the pressure pad?

texts:
I'm making a 2D platformer with Unity. Recently, I implemented a pressure pad system. Basically, when the player triggers the pad, a door near there should be opened. The system works properly but the only problem is when the player stays on the pad, the OpenWhenOn animation (an idle animation that is for the door opening) is not playing. I want to make this keep playing as long as the player is on the pad and if it exits the trigger, the DoorClosing animation should be played. I wrote this code mainly for playing the animation but it doesn't work and I get Null Reference error all the time.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;

public class PressurePad : MonoBehaviour
{
    private Animator anim;
    public UnityEvent OnActivate;
    public UnityEvent OnDeactivate;
    public GameObject door;

    public float deactivationDelay = 2f;

    int objectsInContact;
    Coroutine waitingToDeactivate;

    IEnumerator Timer()
    {
        yield return new WaitForSeconds(deactivationDelay);

        // Tell our listeners we're switched OFF.
        if (OnDeactivate != null)
            OnDeactivate.Invoke();

        // Return to ready-to-activate state:
        waitingToDeactivate = null;
    }

    void OnTriggerEnter2D(Collider2D other)
    {

        if (other.CompareTag("Player"))

        {
            anim.Play("OpenWhenOn");

        }

        door.GetComponent<Animator>().Play("OpenWhenOn");

        objectsInContact++;

        // Pressure pad pressed.
        if (objectsInContact == 1)
        {

            if (waitingToDeactivate != null)
            {
                // Cancel deactivation timer.
                StopCoroutine(waitingToDeactivate);
                waitingToDeactivate = null;

            }
            else if (OnActivate != null)
            {
                // Tell our listeners we're switched ON.
                OnActivate.Invoke();
            }

        }
    }

    void OnTriggerExit2D(Collider2D other)
    {
        objectsInContact--;

        // Pressure pad released.
        if (objectsInContact == 0)
        {
            // Start a delay before telling anyone.
            waitingToDeactivate = StartCoroutine(Timer());
        }
    }
}

 This is my Animator Controller. HasExitTime is disabled for all the transitions. The condition for the transition   between OpenWhenOn and DoorClosing is set to false.


texts: Help in understanding atmospheric scattering shading

texts:
I have a made a planet and wanted to make an atmosphere around it. So I was referring to this site:
Click to visit site
I don't understand this:

As with the lookup table proposed in Nishita et al. 1993, we can get the optical depth for the ray to the sun from any sample point in the atmosphere. All we need is the height of the sample point (x) and the angle from vertical to the sun (y), and we look up (x, y) in the table. This eliminates the need to calculate one of the out-scattering integrals. In addition, the optical depth for the ray to the camera can be figured out in the same way, right? Well, almost. It works the same way when the camera is in space, but not when the camera is in the atmosphere. That's because the sample rays used in the lookup table go from some point at height x all the way to the top of the atmosphere. They don't stop at some point in the middle of the atmosphere, as they would need to when the camera is inside the atmosphere.
Fortunately, the solution to this is very simple. First we do a lookup from sample point P to the camera to get the optical depth of the ray passing through the camera to the top of the atmosphere. Then we do a second lookup for the same ray, but starting at the camera instead of starting at P. This will give us the optical depth for the part of the ray that we don't want, and we can subtract it from the result of the first lookup. Examine the rays starting from the ground vertex (B 1) in Figure 16-3 for a graphical representation of this.

First Question - isn't optical depth dependent on how you see that is, on the viewing angle? If yes, the table just gives me the optical depth of the rays going from land to the top of the atmosphere in a straight line. How to find the optical depth in the case where the ray pierces the atmosphere and goes through it to the camera?
Second Question - What is the vertical angle it is talking about...like, is it the same as the angle with the z-axis as we use in polar coordinates? (I am having a very hard time understanding this angle)
Third Question - The article talks about scattering of the rays going to the sun..shouldn't it be the other way around? like coming from the sun to a point?
Any explanation on the article or on my questions will help a lot.
Thanks in advance!


texts: Character from downloaded AssetBundle renders as magenta in Unity

texts:
I'm currently using Unity 5.3.5f1 free edition.

I have a character in an assetbundle that I load from my server at runtime. The target platform for the asset bundle is Android. The default shader that I use for all the materials in the character is Mobile/Diffuse.

My problem is that when I download and instantiate the character, the whole character appears solid magenta. Please see the below screenshot:

Interestingly, if I open the scene window and switch the shader to something else (anything) the material starts to display correctly even when I switch it back to Mobile/Diffuse. Obviously, doing this in game isn't a choice so what causes this behavior and how can I fix this? Is this a bug?


texts: How to change a Variable on an Instance of a Player with Network Manager?

texts:
So I am trying to change a variable on a player object by clicking a button using Unet. However, I am having trouble getting the instance of the player object. Is there a way to get the instance of a player from the Network Manager component? I can change the variable before the player connects but once they are connected I can no longer modify it.

Is there a way to do this?

I have a PlayerController script and all I basically want to do is change an integer on my player object based on a button press. I have tried referencing the gameObject attached to the script with gameObject and this. That doesn't seem to work and I have also tried player.GetComponent<PlayerController>().myInt and that doesn't seem to change it either.

All of these methods work until I connect as a Host or client and then it just doesn't do anything once I am connected.


texts: How to handle angles in an isometric game?

texts:
I am working on my first isometric game, and I am not sure how to go about angles and rotation. Basically, I want the player's forward movement and rotation to coincide with the isometric angles.

I drew an image to represent what I am talking about.

The player's movement is based on the direction they are pointing. Being an isometric game, there are many sprites in the player rotation animation, and I want the sprites to match up with a certain rotation. Since the rotation of an isometric sprite is different to a straight 2D sprite, I'm not sure how to implement this.
Any help would be appreciated.


texts: Z rotation causing skew Android OpenGL ES 2.0

texts:
If I rotate about the X, or Y axis there is no skewing however for a pure 2D game that does not help me.  When I try to rotate about the Z axis however the quad I am rendering for the sprite starts to skew until it disappears at 90 degrees appearing again shortly after a slowly resuming a quad shape.  As far as I can tell I have written the code correctly, it is as I have written it before on 2D projects and it worked there I am either missing something stupid or OpenGL ES 2.0 does something different then what I expect, some excerpts of code follow:

Projection/View:

Matrix.setLookAtM(ViewMatrix, 0, 0, 0, 3, 0f, 0f, 0f, 0f, 1.0f, 0.0f);
Matrix.orthoM(ProjectMatrix, 0, -width/2, width/2, -height/2, height/2, 0 , 100);

Rotation/Scale/Translation(For in place set to identity first):

Matrix.translateM(Translation, 0, x, y, 1.0f);
Matrix.setRotateM(Rotation, 0, angle += 0.05f, 0.0f, 0.0f, 1.0f);
Matrix.scaleM(Scale, 0, 64,64,1.0f);

Multiplication of Matrices:

Matrix.multiplyMM(MVPMatrix, 0, ProjectMatrix, 0, ViewMatrix, 0);
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Translation,0);
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Rotation, 0)
Matrix.multiplyMM(MVPMatrix, 0, MVPMatrix, 0, Scale, 0);

Thanks for any help.


texts: I have two points (A, B) and the length of d. How can I find point C?


texts:
I'm a bit confused.  The official documentation (http://msdn.microsoft.com/en-us/library/windows/desktop/bb509588(v=vs.85).aspx) says that ddx(input) is the partial derivative of the input with respect to the "screen-space x-coordinate."

My calculus is fine, but how can it tell what the input is coming from?  If I passed it a function, fine, I can imagine what it would do, but the derivative of a number is always zero...?

Is it just a scaling?  Like, this would get scaled to one tenth of its size at this distance, so it returns one tenth?  But then it doesn't need an input...

Can someone give a quick explanation of what's actually happening?


texts: LibgGDX drawing two separate Textures in FrameBuffer

texts:
So I am trying to combine multiple TextureRegions in to one by using a FrameBuffer. This works extremely well when the TextureRegions originate from the same Texture object/file but as soon as I try to combine TextureRegions with different textures of origin, only the TextureRegions from one texture file are drawn. The TextureRegions with different textures of origin do not get drawn.

For example I have two textures:

Texture tex1 = new Texture(path to texture 1);
Texture tex2 = new Texture(path to texture 2);

TextureRegion reg1a = new TextureRegion(region from tex1);
TextureRegion reg2a = new TextureRegion(region from tex2);

TextureRegion reg1b = new TextureRegion(another region from tex1);

I set up my FrameBuffer like this:

buffer = new FrameBuffer(Pixmap.Format.RGBA8888, WIDTH, HEIGHT, true);

In my draw method I do the following:

buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg2a, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

Using the above draw method, ONLY reg2 is drawn. reg1 does not show up at all.

buffer.begin();
batch.draw(reg1a, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

Using this draw method reg1 IS drawn, so there is nothing wrong with the textures.

buffer.begin();
batch.draw(reg1a, x, y);
batch.draw(reg1b, x, y);
buffer.end();

batch.draw(buffer.getColorBufferTexture());

This draw method renders BOTH reg1a and reg1b because they both come from the same Texture object/file.

What I want to be able to do is draw to TextureRegions from different Texture objects in the same FrameBuffer and have them both show up.

I have tried having everything from one Texture in one FrameBuffer, and the other in another FrameBuffer, then drawing those two FrameBuffers into a new FrameBuffer, but that produces the same problem.

Any help would be greatly appreciated!


texts:
I am currently trying to resolve collision between two AABBs. I already have a function that can detect if the the two boxes are colliding and returns true if the two boxes are colliding.

The problem is that I do not know what to do next. All I want to do is make sure the boxes do not penetrate each other. Where do I start?

I am really confused about how to start and any help would be great. I also cannot use any libraries as this is an assignment


texts:
In a typical MMORPG, when I hold down the right click button and drag, the cursor disappears and stays in the same position.

How does one do that?


texts:
I have only one object in the scene and it is lit with a directional light. It uses the mobile/diffuse shader. The issue is that on iPhone 4 the FPS drops from ~42FPS to ~11FPS when the directional light is enabled. Rendering is set to forward rendering and there are no other light sources. Shadows are not enabled.

Scene stats give a total of five draw calls, 3k tris and 2.6k verts. Having a single directional light should not have that kind of effect on FPS. What could cause this FPS drop?


texts: Finding the line segments where 2 polygons share an edge

texts:
I am working on code to place doors between rooms on my levels.  Rooms are lists of points which make up a polygon.  In order to find a place for a door between two rooms, I need to find what line segment(s) are along the edge of both polygons.  Here are some examples, where I would need to identify the highlighted segment(s):

The code which generates the room polygons will always create polygons that don't overlap, but only touch.  How would I go about finding a shared edge like this?  I am using Godot with the built-in scripting language, but the language doesn't matter as much as the algorithm itself.


texts: Simulating Gas Density and Pressure in a 2D World

texts:
I'm building a small spaceship simulation app that looks a lot like a game for an upcoming talk I'm giving where I use this sample app to teach the F# programming language.

This small app is something like FTL meets Oxygen Not Included where you have a top-down 2D grid of tiles (similar to an old RPG) where each tile has its own mixture of gasses - right now oxygen and carbon dioxide, but potentially others.

I've got a few things I'm trying to simulate:

When new gasses are added to a tile by something like a vent or a life support system, that gas should expand to neighboring tiles if possible
When a pressure changes (e.g. opening a door to another area of the ship or a hull breach), air should flow from the high pressure tile to the low pressure tile next to it.

Given this, and given that some gasses naturally sift to the top of others, I'm trying to figure out a small set of simple rules to govern this behavior.

Previously I had all gasses equalizing with their neighbors and no concept of pressure, but that made it very difficult to treat scenarios like hull ruptures, so I'm looking for something a bit more realistic without getting complex or hyper-accurate.

For example, given tile A with 15g oxygen and 6g CO2 and neighboring tile B of 3g oxygen and 1g CO2, some air should clearly flow from A to B. However, what flows? Is it the lightest gasses? The heaviest gasses? A random or representative sampling of gasses in A? Are there any relevant physics principles I should be aware of?

Note: I posted here instead of in physics because I don't care extremely about nuanced accuracy, just something simple and believable


texts: Why does my disable z-depth test shader do not work?

texts:
I wrote the following shader which purpose is to force draw a mesh over the rest, regardless z-depth :

Shader "Custom/AlwaysOnTop"
{
    SubShader
    {
        Tags { "Queue"="Overlay" "RenderType"="Overlay" }
        ZTest Always

        CGPROGRAM
        #pragma surface surf Lambert

        struct Input
        {
            float4 color : COLOR;
        };

        void surf (Input IN, inout SurfaceOutput o)
        {
            o.Albedo = 1;
        }
        ENDCG
    }
    Fallback "Diffuse"
}

It works great, however transparent objects still get draw over it. Setting the queue as Overlay should have solved the problem.

White = AlwaysOnTop shader
Green = Transparent diffuse
Blue = Diffuse

The left face of the white cube should be white, no tinted in green.


texts:
I am trying to create a repeating background. I have a main DIV with a grid of small 16x16 DIVs. I am trying to scale the main DIV in CSS; when the small DIVs simply have a red background color everything works great, but when there is a background image in the small DIVs then borders become visible between the tiles.

This image explains the problem:
http://cl.ly/FpNW/o

Check the HTML in these examples:

With BG-COLOR: http://jsfiddle.net/pTLXw/

With BG-IMG: http://jsfiddle.net/vkpuY/

Does anyone know what is causing this problem and how to fix it? If it is not possible to fix while using DIV, is there another way to do this?

Thanks you so much!


texts:
I'm looking for resources describing art style - setting - gameplay relationship (from game design perspective).

For example, Fallout's colour palette most often is the dark one, models - realistic and not cartoonish. Setting - post nuclear holocaust. Auditory - mature players.

I could also take a different example like Borderlands. Art style is cartoonish, comic but not childish. Setting - vault raiding/monster killing on an alien planet. Auditory - mature players, but still appealing to teenagers (I suppose 13 and up).

Pixar and Nintendo games tend to be both cartoonish and childish. Setting - simple or movie based. Auditory - definitely kids, yet can be entertaining for adults for a limited time.

GTA - cartoonish, comic and somehow childish (especially the first one), yet auditory is definitely mature. Setting - working for crime syndicate/free roaming.

Let's say I create and epic fantasy game (setting). How should I choose most appropriate art style for my game? Are there any canons in art style like there are canons in literature (western, eastern, etc...) How does art style alone suggest what kind of gameplay one should expect? One can release concept art, but setting is generally kept secret so that player could uncover it while playing.


texts:
I am currently working on writing a shader for combination lighting. The idea behind it is to apply directional light, point light, and spot light in a single pass. I believe I can do this by:

Calculate the color after directional light is applied.
Calculate the color after the point light is applied.
Calculate the color after the spot light is applied.
Return the final color of the pixel.

I believe this will allow me to have multiple point and spot lights that effect the pixel currently being handled by the pixel shader.

I believe the math for this will be:

return directional + pointLight + spot;

However, my concern is that this will create just a solid white object and I am unsure as to how to prevent that. Maybe each portion is normalized to a specific percentage of full intensity and the result would be:

directional = calcDirectional() * 0.3f;
pointLight = calcPoint() * 0.3f;
spot = calcSpot() * 0.3f;
return direction + pointLight + spot;

But again, I am not 100% sure on this.

What is the proper way to additively calculate colors in this scenario?


texts:
I am going to work on my next game project, however there are some issues I want to correct since my last one. Here is one of them:

This is a problem I think I can already solve, but I'd like to hear any criticisms on said solution, and perhaps hear other solutions that may exist.

The problem:

I have a window 800W by 600H, and my player's position is stored as pixels down, and pixels right. Lets say this player can run to the edge of the screen. This works fine until someone say, changes the size of the window, thus the player can run further out, where he should not be. In one of my first game attempts (a TD), enemies were dependent on the pixel position of game objects (Tiles), and thus by resizing the window, they ended up wandering off path.

A solution:

Represent the world with boundaries placed at 0 and 1 (or any other numerical pairing), and place entities as a percentage across. e.g. Player.positionX = 0.5, would mean that the player is half way across the map. Perhaps instead of 0, 1, it was 0, 1000 instead? With floating/double error in mind, what choice might I make?

So I think that would work fine in most cases, do you think so? What is a typical approach? What other approaches exist? How might platform/game type affect this choice?
 What if for some reason, the world size were to change dynamically? (Odd, but I'll throw it in there)


texts:
I have been learning how to make a game with LWJGL for a while now by following YouTube tutorials online but I've recently been having a problem understanding Vertex Buffer Objects. I've looked at several tutorials including the one at the LWJGL Wiki, but I still don't understand how to use them.

Can someone please clarify how Vertex Buffer Objects should be used? I understand the code behind it but I don't know how it should be used. I know that the VBO should only be created once and be rendered every frame/loop. But my main question is, is there one Vertex Buffer Object per game or one per Object to be drawn? Also, what's the difference between VBOs and Interleaved VBOs?


texts: Why does XNA create two GraphicsDeviceManager services?

texts:
While working with XNA today, I looked at the debugger information for Game.Services to retrieve the GraphicsDeviceManager so that a component could utilize it. Instead, I found two different objects:

[IGraphicsDeviceManager, GraphicsDeviceManager] KeyValuePair<Type, object>
[IGraphicsDeviceService, GraphicsDeviceManager] KeyValuePair<Type, object>

Or rather, what I assume to be one instance of an object, but indexed according to two different interfaces. Why?

(For context, I'm trying to understand all the different Graphics/Device classes so I can make a ScreenComponent that moves it cleanly away from the main Game object.)


texts: "Optimal" game loop for 2D side-scroller

texts:
Is it possible to describe an "optimal" (in terms of performance) layout for a 2D side-scroller's game loop?  In this context the "game loop" takes user input, updates the states of game objects and draws the game objects.

For example having a GameObject base class with a deep inheritance hierarchy could be good for maintenance... you can do something like the following:

foreach(GameObject g in gameObjects) g.update();

However I think this approach can create performance issues.

On the other hand all game objects' data and functions could be global.  Which would be a maintenance headache but might be closer to an optimally performing game loop.

Any thoughts?  I'm interested in practical applications of near optimal game loop structure... even if I get a maintenance headache in exchange for great performance.


texts: How to discern boxes and spheres when importing from fbx

texts: I can import scene from FBX file into my engine, and i want spheres, boxes and capsules to be imported as colliders. So, how i can check if imported instance is one of them? Thanks.


texts: Algorithm for spreading labels in a visually appealing and intuitive way

texts:
Short version

  Is there a design pattern for distributing vehicle labels in a non-overlapping fashion, placing them as close as possible to the vehicle they refer to? If not, is any of the method I suggest viable? How would you implement this yourself?

Extended version

In the game I'm writing I have a bird-eye vision of my airborne vehicles. I also have next to each of the vehicles a small label with key-data about the vehicle. This is an actual screenshot:

Now, since the vehicles could be flying at different altitudes, their icons could overlap. However I would like to never have their labels overlapping (or a label from vehicle 'A' overlap the icon of vehicle 'B').

Currently, I can detect collisions between sprites and I simply push away the offending label in a direction opposite to the otherwise-overlapped sprite. This works in most situations, but when the airspace get crowded, the label can get pushed very far away from its vehicle, even if there was an alternate "smarter" alternative. For example I get:

  B - label
A -----------label
  C - label

where it would be better (= label closer to the vehicle) to get:

          B - label
label - A
          C - label

EDIT: It also has to be considered that beside the overlapping vehicles case, there might be other configurations in which vehicles'labels could overlap (the ASCII-art examples show for example three very close vehicles in which the label of A would overlap the icon of B and C).

I have two ideas on how to improve the present situation, but before spending time implementing them, I thought to turn to the community for advice (after all it seems like a "common enough problem" that a design pattern for it could exist).

For what it's worth, here's the two ideas I was thinking to:

Slot-isation of label space

In this scenario I would divide all the screen into "slots" for the labels. Then, each vehicle would always have its label placed in the closest empty one (empty = no other sprites at that location.

Spiralling search

From the location of the vehicle on the screen, I would try to place the label at increasing angles and then at increasing radiuses, until a non-overlapping location is found. Something down the line of:

try 0°, 10px
try 10°, 10px
try 20°, 10px
...
try 350°, 10px
try 0°, 20px
try 10°, 20px
...


texts: How can I prioritize the call order of decoupled scripts?

texts:
I have a player with many individual components that each handle a behavior such as jump, block, attack, duck, etc..  None of the scripts know about one another. Each listens for a specific input to fire. Some behaviors share the same input depending on the characters state such as ok the ground, in the air.

I'm running into issue where the wrong behavior will fire that has shared input (down+attack instead of down+attack being held down for x seconds).

I'm looking for advice on how to manage these behaviors and have more control over what can happen when.

I've tried resolving this issue by creating a method that will disable other behaviors temporarily while completing the action and I've changed the script execution order.

I thought about adding a discrete player state and restricting what behaviors are able to be performed at any given time but this increases the complexity quiet a bit.


texts: Will an optional bad words censoring system affects the age rating as well?

texts:
My game project is a 2D top down RPG with dating simulator & visual novel elements in it, and I have a few parts of dialogue in my game that have bad words and used often by a character.

However, I'm afraid those bad words will affect the age rating up to 17+, so I decided to censor bad words optionally. This means player can enable bad words after confirming legal disclaimers.

Will this feature results more friendly age rating? I'm targeting for 15+ age rating.


texts:
I'm currently developing a game using OpenGL and my dev has run into a small problem. I'm having some problems understanding how "array of vectices works with animated object". For example, if we have a 3D object is there a different array for each frame of the animation or is there an instruction which does the animation ?

So, does a 3D objet file look like this :

Idle
Frame 1 mouvement animation
Frame 2 mouvement animation
Frame 3 mouvement animation

All of the above being big array containing vertices and texture coords ?

Thank you for the answer and explaning this thing to me !


texts: Understanding the Seek steering behavior

texts:
I'm currently studying steering behaviors. Have recently learned about Seek.

I have a question about this.

Seek is supposed to turn the agent slowly in the direction of it's target, and then move in that direction.

However, I don't understand how Seek turns the agent around slowly. It seems to me like it should make the agent change direction immediately.

This is the code for a Seek function:

Vector Seek(Point target){

    Vector toTarget = new Vector(target - agent.getPosition());
    Vector desiredVelocity = toTarget.normalize() * agent.getMaxVelocity();

    return desiredVelocity.subtract(agent.getVelocity());

}

And then here is the update() function of the agent.

void update(){

    Vector force = seek(target);
    Vector acceleration = force.divideBy(mass); // mass = 1.
    velocity = velocity.add(acceleration);
    position = position.add(velocity);

}

Anybody mind explaining to me where the gradual change of velocity takes place? Thanks


texts:
I have an idea for a game. Also I have almost everything worked out considering coding.

What interests me the most is how can I know if that game can be published.

As it would be for iOS and android, these markets are of the geratest interest for me.

I found on apples store something similair to what I would make and it's published by some big game developer. How can I be sure I am not breaking any laws when publishing the game? Can I make a game like board game 'Risk'?

I don't have any knowledge considering licencing. This game would be avaliable for free, with an option to donate, so money isn't my objective (but it won't hurt) [:


texts: How to detect collision only in non-transparent texture?

texts:
I am developing a game using libGDX. I am trying to detect the collision between bee and tube. I am using the following code to detect the collision.

if(player.getBounds().overlaps(boundsBot)){

}

player is a bee and boundsBot is Rectangle of tube. Since there is some transparency in bee image, this returns true even if it doesn't seem to collide. I understand the reason why this is returning true.

I read this solutions. I understood the theoretical concept to the solve the problem but I couldn't achieve it using libGDX.

Here is what I tried,

if(Intersector.intersectRectangles(player.getBounds(), boundsBot, rectangle)) {
    //Gets the intersected rectangle
    System.out.println("Rectangle Bottom: " + rectangle);

    //Converting texture to pixmap
    Texture texture = player.getTexture().getTexture();
    if (!texture.getTextureData().isPrepared()) {
        texture.getTextureData().prepare();
    }
    Pixmap pixmap = texture.getTextureData().consumePixmap();

    //Trying to find transparency.....
    System.out.println("Format: "  + pixmap.getGLFormat());
}

How can I solve this issue?

Thank You!


texts: Changing location after CommitAnimations

texts:
I'm using the following code to move a UIImageView:

shootImg.image = [UIImage imageNamed:@"Projectile Left 1.png"];
[UIView beginAnimations:nil context:nil];
shootImg.center = CGPointMake(shootImg.center.x+1000, shootImg.center.y);
[UIView commitAnimations];

This works but what I want to do is after [UIView CommitAnimations]; I want to set the location of shootImg using CGPointMake. If I just put it after commitAnimations then the animation doesn't fully complete. Any suggestions? I'm not using any frameworks like cocos2d and if you need to see any more code just ask.


texts: In a 2D physics engine, how do I avoid useless collision resolutions when objects come to a rest?

texts:
In a physics engine I'm developing (for learning) using love-2d, I implemented collision resolutions in this way:

FixedUpdate(dt)  // I use fixed timestep
 foreach collide c1 in allNotStaticColliders
   c1.integartePhysic // i.e. apply gravitational force..
   foreach collider c2 "near" c1 // "near"= I use spatial hashing
      if collide(c1,c2)
        resolve collision (c1,c2)  // the heavy operation
        collison callbacks c1
        collison callbacks c2
        ...

As you can see at the end of the gif animation, there's a FPS decay when all colliders are almost grounded over a static object.

This because the number of collision resolutions grows as objects spend more time touching as they settle. However, many of the calculations are "useless" because objects have already settled into stable positions against each other.

What's the best practice (hopefully not requiring a physics degree) to avoid these "useless" collision detections?

Edit : accepted DMGregory hints and come to this result   (not yet optimal)

(Red=static, Blue=active, Green=sleeping)


texts: Set Rigidbody velocity in FixedUpdate() or Start()?

texts:
I'm developing a simple 2D game in Unity (balls hitting bricks), so I have a ball and I want to fire the ball to hit bricks. Now, to fire the ball I have to set velocity on the Rigidbody component attached to the ball's GameObject.

There are two ways to do that:

Method 1:

Set the velocity inside the Start() method

private void Start()
{
    rb.velocity = direction * speed;
}

Method 2:

Write a FixedUpdate() method and put the statement in there. because:

  Use FixedUpdate when using Rigidbody. (Unity Docs)

private void Start()
{
    _setVelocity = true;
}

private void FixedUpdate()
{
    if (!_setVelocity) return;

    rb.velocity = direction * speed;
    rb.angularVelocity = 0;
    rb.gravityScale = 0;
    _setVelocity = false;
}

But the thing is: I don't need the FixedUpdate() method for anything else, because I only fire the ball once in its script's lifespan, so after I fire the ball Unity will continue to run the FixedUpdate() method and check for _setVelocity's value and return (exit) every time because it will always be false after I shoot the ball the first time.

And this will happen every fixed time step which is expensive I guess for just setting the velocity only once.

SO:

Is it expensive to have a FixedUpdate() method that checks for false value and returns every frame?
Which of the two methods performs better in this case?


texts: Frustum culling with an octree: one AABB per bone or one AABB per object?

texts: I've constructed an octree for use in frustum culling. The question is, should I insert an AABB for each bone of each object, or just the one AABB for the object?


texts:
Is there a general purpose algorithm to determine a route between rooms of a building?

Imagine a fixed-layout, single-level house with 50+ rooms. Assume I have a data structure that defines the exits of each room and the room to which each exit leads. I'd like to know how to get from room 4 in the NW corner to room 37 in the E side, say. I want the shortest list of rooms that need to be traversed. (I don't need to see this graphically in real-time.)

Is it worth finding such an algorithm or should I just 'map out' the level and use the pathfinding abilities of my game dev platform of choice..

edit: removed the A* reference


texts: Minecraft Modding Errors (.java to .class compression errors)

texts:
Recently I started making a personal modpack. I ran into a block ID conflict and decided to fix it. I figured out how, and managed to change a .class file to .java so I was able to edit it. Now comes the issue.

When I try converting my files from .java to .class using the command prompt javac command, I get the following errors:

E:\Users\Jeff\Desktop\bettertools_164.s... error: '.' expected /* 3: */ import akc;

E:\Users\Jeff\Desktop\bettertools_164.s... error: ';' expected /* 3: */ import akc;

E:\Users\Jeff\Desktop\bettertools_164.s... error: class, interface, or enum expected /* 4: */ import aqz;

E:\Users\Jeff\Desktop\bettertools_164.s... error: '.' expected /* 5: */ import ard;

E\Users\Jeff\Desktop\bettertools_164.sr... error ';' expected /* 5: */ import ard;

E:\Users\Jeff\Desktop\bettertools_164\b... error: class, interface, or enum expected /* 6: */ import cpw.mods.fml.common.registry.GameRegistr...

I'm not sure if that is enough information to solve my problem, but thanks in advance to anyone able to answer it!


texts: Vulkan rendering of Minecraft-like world in C++

texts:
I decided on using 16x16x16 (4096 total) chunks of blocks.

Problem is with textures.
First idea was about texture atlas but it would require a lot of calculation and possible problems in dividing UV (1) by atlas size (power of 2).
Then I was thinking about using array of textures or sampler2darray.

I do not have fixed amount of textures and I reserved uint16 (65,535) for block-only textures (those textures are not used anywhere else, even items have their own item-only textures).
All those textures are loaded before the world (based on loaded "mods").

I got so far that array of textures should be best solution because they support different resolutions (8x8, 16x16, 32x32, 64x64...) without duplicated pixels (which sampler2darray would require when even 1 texture has higher resolution because all textures would be re-scaled to fit it).

Problems I found with array of textures are:

the length must also be defined in shader (which I would need to recompile at runtime)
limited length (256 to 2048 based on vulkan.gpuinfo.org but even Minecraft has 229 block types, some with multiple textures)

Advantages are:

possible "greedy" mesh optimization reducing number of vertices utilizing VK_SAMPLER_ADDRESS_MODE_REPEAT (GL_REPEAT in OpenGL)

Which type of storage for textures is best in this case?

Or should I separate faces by textures, create VkPipeline for each texture and render them one by one?

EDIT:
Each block has at least 1 texture (most time unique) but can be higher then 6 (different texture for each face) when 1 block is made of multiple cubes = non-solid.


texts: Best Method to Create Side Scrolling Levels? - Cocos2D

texts:
I am looking to start my first side scroller project using Cocos2D, but I am curious. What is the preferred/best method of creating you levels? For large levels I see hand making it very laborious, is there a more visual way of doing so, as punching in coordinates for everything at a guess seems wrong. Which is why Im here to learn from you guys.

So any help would be much appreciated, thanks.


texts:
I have my rope, and I have my rectangles.

The rope is similar to the implementation found here: http://nehe.gamedev.net/tutorial/rope_physics/17006/

Now, I want to make the rope properly collide with the rectangle such that the rope will not pass through a rectangle, and wrap around the rectangle and all that good stuff.

Currently, I have it set so no rope node can pass through a rect (successfully), however, this means a rope segment can still pass through a block. Ex:

So the question is, what can I do to fix this?

What I have tried:

I create a rectangle between two nodes of a rope, calculate rotation between the nodes, and get myself a transformed rectangle.

I can successfully detect a collision between rope segments and a (non-transformed) rectangle.

Create a new node or pivot point around the corner of the block, and rearrange nodes to point to the corner node. Trouble is determining what corner the rope segment is passing through. And then the current rope setup goes wonky (based on verlet integration, so a sudden change in position causes the rope to wiggle like a seismograph during a magnitude 8 earth quake.) Among other issues that might be solvable, but its turning into a case by case thing, which doesn't seem right.

I think the best answer here would just be a link to a tutorial (I simply can't find any, most lead to box2D or farseer, but I want to at least learn how it works before I hide behind an engine).


texts: Programmatically set brightness of a PointLight

texts:
I'm a beginner, so there is definitely something I'm missing here. I'm trying to set brightness of my PointLight object from the in-game command line.

Here is what I tried, but it doesn't work:

class MyCustomGameInfo extends GameInfo;

exec function myTest(float brightness)
{
    local PointLight pointLightOut;
    local PointLight pointLight;

    foreach AllActors( class 'PointLight', pointLightOut )
    {
        pointLight = pointLightOut;
    }

    pointLight.LightComponent.SetLightProperties(brightness);
    pointLight.LightComponent.UpdateColorAndBrightness();
}

defaultproperties
{
}

So when I compile it, go to my UDK project, run it, press tab and start typing myTest, the command line autocomlpete works perfectly, and even shows the float parameter. However, it doesn't work. I have a feeling that the way I'm retrieving the object is wrong.


texts:
What is the best practice coming to where to place the code in this scenario.

I have a gamobject called player. It has lots of child objects. One of them is sword.
Like this:

Player

Body

Head

Torso

Sword

So i have code that controls the player in player. It controls movement and triggers an attack animation which swings the sword. The code that checks if the sword is swinging and if it has hit something is at the moment inside the sword. My question is, what model is best practice? I can think of some:

All code in player. player checks if sword is colliding and handles what happens to the enemy that was hit.
sword checks for collision but player handles it by polling sword and takes care of what happens with enemy and player after.
sword checks for collision but player handles it  by listening to an event that sword triggers and takes care of what happens with enemy and player after.
sword handles everything by handling what happens to enemy and player communicating with parent through a reference.


texts: How to pass depth buffer from OGRE to CUDA?

texts:
I am using OGRE for rendering some objects. At every frame, I would like to pass the resulting depth buffer to CUDA for running some kernels on it and computing a result.

How can I achieve this? How do I get access to depth buffer in OGRE? How do I pass this to CUDA for processing? I do not need to write to the depth buffer in the CUDA kernels, it can be read-only.


texts: Synch clocks between client and server in Java

texts:
We're developing a simple boggle game in Java for a college project (purely academic purposes, so we're trying to keep it simple).
Our application is composed by a client portion and a server portion. The idea is that when a game starts all the participants have a fixed amount of time (3 minutes) to find words from the grid.
Of course we have to ensure that all timers start at the same time and players with higher ping don't get penalized. By searching on Google and other forums most people suggest the correct approach is to implement the (S)NTP algorithm, even though for a similar question here someone suggested that NTP is overkill. Is it or is it not?
Our idea is basically this: when the game starts, the server sends to all the participants a future datetime to start the timer task and then simply waits for the clients to communicate the results. If indeed NTP is the best approach I'd like to know if there are alternatives to the already available Apache Commons Net library since we're using Java 14 with modules and JavaFX, so we need to use jlink and it doesn't allow for non-modular dependencies. Thanks in advance


texts: What are perimeter and aspect ratio, in the context of 3D mesh approximate convex decomposition?

texts:
I'm trying to understand the logic behind Mamou and Ghorbel's algorithm in their paper A Simple And Efficient Approach For 3D Mesh Approximate Convex Decomposition.

I cannot understand what is the aspect ratio of a surface as defined by the author. It includes the perimeter of two vertices v and w. These two vertices represent two triangles in the original mesh as they come from the dual graph as the authors define it. So I'm guessing they are talking about the perimeter of the two triangles these vertices correspond to. What is the perimeter of two triangles? Do they mean the sum?

The algorithm proceeds like this:

Create a dual graph of the mesh, where each vertex corresponds to a triangle of the original mesh, and two vertices are connected by an edge iff their corresponding triangles share an edge.
Iteratively choose and collapse an edge, so that two vertices are merged into one. We keep track of the "ancestors" of each vertex, A(v) that have been merged into it in this way.

Here's where I get confused:

  The decimation process described in the previous section is
  guided by a cost function describing the concavity and the
  aspect ratio [5] of the surface \$S(v, w)\$ resulting from the unification
  of the vertices \$v\$ and \$w\$ and their ancestors:

  $$S(v, w) = A(v) ∪ A(w) ∪ {w, v}. (2)$$

  As in [5], we define the aspect ratio \$E_{shape}(v, w)\$ of the
  surface S(v, w) as follows:

  $$E_{shape}(v, w) = \frac{ρ2(S(v, w))}{4π × σ(S(v, w))}, (3)$$

  where \$ρ(S(v, w))\$ and \$σ(S(v, w))\$ are respectively the perimeter
  and the area of \$S(v, w)\$.


texts: How to obtain touch events from a GL Viewport, not the whole screen?

texts:
Background

I'm implementing viewport resizing in order for my game to maintain the same display ratio on all devices.

However, I've found an issue with getting touch events.

Basically, if my viewport, for example, uses the whole of the physical screen's width and height then there is no issue.  However, if it is resized say in the vertical, then my touch events are thrown off, because touch events are registered from the top of the physical screen.  Hence if I put a sprite at say position 50 in the Y direction then it put's the sprite 50 pixels down from the top of the viewport, not the top of the actual screen.

Do I have to manage this myself by adding my viewport's offset to my touch events or is there a way to tell Android to register 0, as the top of the viewport as opposed to the actual screen.

Here is a graphic to illistrate what I mean, any help would be appreciated


texts: Mirror problems after building game in unity

texts:
Hi I am facing a weird problem in unity when I build a particular scene.

Here is the screenshot of how the mirror looks when I play the game from inside the unity editor:

And here is how it looks once I build this scene and then play it:

The quality settings at Edit->Project Settings->Quality are these:

And the player settings at File->Build Settings->Player Settings are these:

So how do I fix this? What do I need to change or is there any other entity?


texts: How to do profiling and memory pooling per system?

texts:
I have been interesting in profiling and keeping a managed memory pool for each subsystem, so I could get statistic on how much memory was being used in something such as sounds or graphics. However, what would be a design that works for doing this? I was thinking of using multiple allocators and just using one per subsystem, however, that would result in global variables for my allocators (or so it would seem to me). Another approach I have seen/been suggested is to just overload new and pass in an allocator for a parameter.

I had a similar question over on stackoverflow here with a bounty, however, it seems as if perhaps I was too vague or just there is not enough people with knowledge in the subject.