texts: How can I implement view wobble when my player is running?

texts:
I'm creating a FPS in XNA.  So far its' going great.  What I'm looking at doing is replicating the camera movements that you see in Modern Warfare.  So, if you are walking the camera stays pretty still except for the slight weapon movement, but if you sprint then it shakes left and right.  Here is a good example :  Modern Warfare 2 camera motion

Has anyone achieved this?  If so, can anyone give any pointers or articles that I can take a look at?


texts: libGDX map transition via try & catch exeption

texts:
I have a simple question.  Some explination first, however:

I am using libGDX and making a Legend of Zelda-type top-down game and I'm having an issue with map transitions.  When I made the tilemap and added the (currently crappy) collision detection to it, I noticed that the IDE threw an error when the character walks off the map (where there are no tiles to test the collision possibility against).  I thought, cool, I can use that.

Knowing that the program would throw an exception when the player left the screen, I caught that exception and used it to decide to which map the player was trying to transition and switch accordingly.  I played a little transition from the scene2d actions and to the next map we went.

BUT, I got to thinking that while catching that exception is a great thing, I probably shouldn't rely on it for map transitions.  I'm betting you all will agree: handle the exception just in case, but don't rely on it.

SO, this means that I need to handle a transition before the user gets off the map.  I tried using transition tiles from within the collision detection:

If the tile had the transition property, figure out where the user is attempting to transfer and then play the transition effect and on to the next map.  The only problem with this system is that it doesn't look right.  The user transitions just as collision is made while there is still room left in the tile to transverse.

My question to you all, then, is this:  Is there a middle ground between the two?  Is there a way to tell end of map or last tile, allow the user to transverse the tile just prior to transitioning?  Or are my two ways the only ones?


texts: How to get text width in pixels in direct2d

texts:
I am making the simple editor on direct2d and i want to make adaptive buttons size. When i create a button i pass text to it and a button gets width based on text width in pixels. I have tried to use IDWriteTextLayout and the method GetMetrics but i get the weird result where height more than width.
D2D1_SIZE_F Direct2D::get_text_size(const char *text)
{
    IDWriteTextLayout *text_layout = NULL;
    DWRITE_TEXT_METRICS text_metrics;

    wchar_t *wtext = char_string_wchar(text);
    HR(write_factor->CreateTextLayout(wtext, wcslen(wtext), text_format, 0.0f, 0.0f, &text_layout));

    text_layout->GetMetrics(&text_metrics);

    DELETE_ARRAY(wtext);
    RELEASE_COM(text_layout);

    D2D1_SIZE_F size;
    size.width = text_metrics.widthIncludingTrailingWhitespace;
    size.height = text_metrics.height;
    return size;
}
```


texts: Efficient way of detecting a touched object in a game?

texts:
Imagine a Sims-like 2D game for a touch based mobile phone where one can interact with virtually any object in the scene.

How can I efficiently detect which object is being touched by the player?

In my short experience, looping through all the visible objects in the scene and checking if they're touched has so far done the job, but when there may be many many moving objects in the screen that sounds kind of inefficient isn't it? Keeping the visible moving objects list can consume time in itself as one may have to loop through all of them each frame.

Other solutions I've thought are:

Spatial hashing. Divide the screen as a grid and place the visible objects in the corresponding bucket. Detection of the clicked object is fast but there's additional overhead for placing the objects in the correct bucket each frame.

Maintaining a quad-tree. Moving objects have to be rearranged all the time, the previous solution looks better.

What is usually done in this case?


texts: Can I use trilinear filtering for my sprites, but keep their outlines unfiltered?

texts:
Suppose that I have two images of equal size. They both contain a square:

https://i.stack.imgur.com/BI62X.png
https://i.stack.imgur.com/Nev5Z.png

When overlapped, both squares will appear next to each other.

If both images use Point (no filter), they will contact without issues regardless of the amount of zoom or scale:

If you use either Bilinear or Trilinear, there will be an artifact visible in certain zoom/scale levels:

Of course, that is to be expected from the very nature of the filters. As much as I would like to just leave it at Point (no filter), my game looks far better using Trilinear instead - except of course, for the "borders" or points of contact.

The ideal scenario for me as bizarre as it may sound, is to be able to use Trilinear filtering generally, but force the "outlines" of my sprites to stay as if they were Point (no filter). This way, my game looks painterly when zoomed in/out (the game isn't pixel art), and I also avoid the "glitch" in specific contacts.

Yes, the glitch is only noticeable if you use a scale/zoom that is higher than 100%. Unfortunately, due to the nature of the game, the player should be able to zoom in/out if they desire, so I can't just pick "the" ideal camera size or sprite scale because it can't be constant.
I've tried using Canvas and its Pixel Perfect checkbox to no avail. I didn't really expect that to work though.

What can I do to achieve the desired effect, then?


texts: Inconsistent read violation when using game state machine

texts:
I am getting some very inconsistent read violation errors with my FSM. It is very hard to reproduce but it always happens when the FSM is switching between states. It breaks at this block:

void MenuState::update()
{
    for (int i = 0; i < m_gameObjects.size(); i++)
   {
        assert(m_gameObjects[i] != NULL); //the program breaks at this line
        m_gameObjects[i]->update();
   }
}

It's very strange because it occurs right when I am switching from my "MenuState" to my "PlayState". Using console outputs, I know for I fact that the state is changed to the PlayState, but the FSM still calls the update function from the MenuState.

void GameStateMachine::changeState(GameState *pState)
{
if (!m_gameStates.empty())
{
    if (m_gameStates.back()->getStateID() == pState->getStateID())
    {
        return;
    }
    if (m_gameStates.back()->onExit())
    {
        delete m_gameStates.back();
        m_gameStates.pop_back();
    }
}

m_gameStates.push_back(pState);
m_gameStates.back()->onEnter();
}

Change state when button is pressed:

if (InputHandler::Instance()->getMouseButtonState(LEFT) && m_bReleased)
{
    m_currentFrame = CLICKED;

    m_callback(); //this callback calls the FSM changeState member

    m_bReleased = false;
}

I've looked all through my code and I can't find the error, and this error only occurs 10% of the time I change states, which makes this whole thing even more confusing. Any tips or advice would be much appreciated.


texts:
I have a 2D tile-based lighting system which is drawn onto a Render Target.
I am also drawing a background which involves mountains, sun/moon, and clouds.
There is also the unlit game; blocks, character, etc.

Here is the order in which everything is drawn:

1. Background
2. Game World
3. Lighting

The problem is that the LIGHTING is covering up the BACKGROUND when it's dark:

Although it's perfectly fine in the day because the light is full:

You might ask, well, why don't you just blend each block, not drawing the lighting on a RenderTarget?

Because that would prevent me from performing smooth lighting, as seen in the pictures. To produce the smooth lighting, I draw squares of light onto a RenderTarget, perform a Gaussian blur and then draw that RenderTarget.

How about not drawing a square of light in empty spaces?

The light blurs onto any adjacent blocks, and not all objects in my game affected by lighting are square, so they would look like a sprite with a blurry square on top of it.

Light NOT being drawn in empty spaces:

Light being drawn everywhere:

Is there any way to keep the background visible, or something else that would help my predicament?

USING THE STENCIL BUFFER

I put in the stencil buffer code that you said should cause "little overhead"

As you can see the background blocks, due to the effect, are not darkened like they should be. The FPS here is ~15 as opposed the the steady 60 FPS it runs at without the stencil method. Also the character is somehow not being drawn correctly.

It does in fact work though despite the more than annoying lag.


texts: I'm working with a deferred shading technique. I have diffuse, normal and depth buffers, which I combine for the final scene composition. Where and when exactly do I apply an anti-aliasing pass (such as FXAA)? Just on the color buffer before lighting or any processing? Or as a separate pass on the final scene? Or something in-between?


texts: Why my charchter fluctuate instead go down stairs?

texts:
My player is a capsule with:

First person controller
Charchter controller

When my player go up stairs, it works well.
When my player go down stairs, it fluctuate in air.

What am i wrong ?

Thanks


texts: How is it possible to use Android libraries in libGDX?

texts:
I want to make an android application game that uses both android API like Location, even Google Maps API and also use libGDX framework as well. How is this possible?

I noticed there's an Android and a core folder created when making a libGDX project, where do all the classes go, but I'm very confused.


texts: What is the difference between the marching cubes algorithm and metaballs?

texts: After doing some research, I found out about the marching cubes algorithm and "metaballs". How exactly do they differ?


texts: Accessing a C++-based optimization library in FlashPunk

texts:
Some time ago I launched my FlashPunk primer, an adaption of Asteroids, which mainly served as a basis for trying out a simple optimization algorithm.

Now I'm planning to take this concept a level further and program a version of Lunar Lander. This would require to incorporate a sophisticated external C++-based numerical optimization library into my Flash Punk code.

When looking for a solution I came across the Crossbridge compiler. If I got it correctly, it would allow for writing native C++, accessing flash functions via the AS3 header and have it compiled to a *.swf-file.

Would that mean I have to give up FlashPunk and write the whole piece in C++/AS3?


texts: How to fix a crowbar mesh deformation problem

texts:
I am having a problem exporting my model to Garry's Mod.
Every time i compile the model in crowbar it comes out deformed like this

when the model is really suppose to look like this

how do I fix this is there something wrong with the collision?
I am also ready to provide whatever files/information are needed to solve this problem.
I should also mention that the mesh has multiple objects from each sphere that are joined but not connected.
I went to the arqade for this at first but they said it was offtopic and that I should come here instead.


texts: Unknown error XNA cannot detect importer for "program.cs"

texts:
I am not too sure what I have done to cause this, but even after undoing all my edits, this error still appears

  Error 1   Cannot autodetect which importer to use for "Program.cs".
  There are no importers which handle this file type. Specify the importer that handles this file type in your project.
  (filepath)\Advanced Pong\AdvancedPongContent\Program.cs   Advanced Pong

After receiving this error, everything between #if and #endif in the program.cs fades grey

using System;

namespace Advanced_Pong
{
#if WINDOWS || XBOX
static class Program
 {
    /// <summary>
    /// The main entry point for the application.
    /// </summary>
    static void Main(string[] args)
    {
        using (Game1 game = new Game1())
        {
            game.Run();
        }
    }
 }
#endif
}

I have searched this and could not find a solution anywhere. Any help is appreciated.


texts: Any way to track speed of hand movements below iPhone 3.2?

texts:
I have used the pan gesture for tracking the Pixel-Per-Second (or speed of the movement of the hand) but the real trouble is that the PanGesture library doesn't support any deployment target less than 3.2.

So how would I track the speed of hand movements below a deployment target of 3.2?


texts: How to reduce image size without pixelation?

texts:
I see lots of games with smooth edges characters and high res images, however when I try to reduce images to say 64x64 for my character I just get a pixelated mess. even if I start with a 64x64 canvas I get pixelated edges.

Should I be scaling with OpenGL? or is there some technique perhaps with photoshop or pixen that I am unaware of?


texts: How do game bots perceive the game world & other entities?

texts:
This question has been on my mind for a while...mainly because I see bots for all sorts of games like WoW and others. My question is; how do the bots know what is appearing on the screen? I don't play WoW so my example may be wrong but if for example there is a monster, how does the bot know where that monster is on the screen and how does it know how to interact with it?

Can you apply this to any game or is it specific for each game? I'm sorry if the question isn't clear...and I'm not asking how to make a bot, more asking how they detect things on the screen as its quite fascinating to me!

Thanks in advance :)


texts: Mouse joint isn't restricting the ball from going to the other part of the screen

texts:
I'm developing a application in cocos2d using the Box2D framework, but unfortunately I am having issues. I'm not able to restrict the orange ball in the half screen area, taking the image below as reference, I don't want to allow the ball to go to the opposite part of the screen.

I'm using the b2MouseJoint to move the ball around the screen. b2PrismaticJointDef seems to restrict on any particular axis, but I need to restrict on a particular rectangular area of the screen.


texts: Set a minimum distance with navmeshagent

texts:
I am totally newb. How to set a minimum distance between AI chasing a player if AI has navmeshagent
        if (Vector3.Distance(transform.position, target.position) > minDistance)
        {
            enemy.destination = player.position;
        }

What I need is it works similar to this code below:
if (Vector3.Distance(transform.position, player.position) > minDistance)
{
    transform.position = Vector3.MoveTowards(transform.position, player.position, moveSpeed*Time.deltaTime);
}

But using destination property or SetDestination


texts:
I'm developing a candy crush game and it works just fine on desktop, my mobile (Honor9) and the one I'm using as emulator. But, for my surprise, it lags on my girlfriend's mobile, which is way better then mine (Samsung s10), when I'm doing the starting game animations (pieces falling to their position).
I believe the problem is not how I'm loading assets because it just lags on that specific animation. Does anyone know what I might be doing wrong?


texts: Connecting a model's joint to the joint of another model

texts:
I am trying to figure out the math behind orientating and translating a model so that a specified point on the model will connect with a specified point on another model. For example, given the following objects and respective "joints":

Where a joint is defined (relative to the model's untransformed position) as something like:

struct Joint
{
    Vector3 position;
    Vector3 normal;
}

I would like a function that can take a base model and a connecting model that modifies the "world" matrix of the connecting model. Something like:

public void ConnectModels(Matrix baseModelWorld, Joint baseJoint, Matrix connectingModelWorld, Joint connectingJoint)
{
    //Code to re-orient and re-position the connecting model's world matrix
    //Note: The joint position/orientation/normal need to be transformed by
    //      the model's current world matrix

    //1. Transform the baseJoint/connectingJoint by the baseModelWorld/connectingModelWorld
    Vector3 baseJointPos = Vector3.Transform(baseJoint.position, baseModelMatrix);
    Vector3 connJointPos = Vector3.Transform(connectingJoint.position, connectingModelMatrix);

    Vector3 baseJointNorm = Vector3.Transform(baseJoint.normal, baseModelMatrix);
    Vector3 connJointNorm = Vector3.Transform(connectingJoint.normal, connectingModelMatrix);

    //2. Orient the connecting model to match (opposite directions) base joint's normal

    //3. Translate the connecting model such that the connecting joint connects
    //        to the base joint.

    //4. ????

    //5. Profit
}

But, I'm not very good at matrix math and I'm not sure what this actually translates to in code (or if this is correct/the best way).
Also, I'm wondering if there is a better way to define a joint (i.e. just a Matrix, would that be possible?). Any help is appreciated!


texts: How do I convince my team to use less VO?

texts:
I am a firm believer in using voice over (VO) only for necessary elements such as game narrative, and here and there to drive game play (e.g. instructions coming in over intercom, that sort of stuff). I think that game design should speak for itself, and generally, when lots of VO instructions are needed to drive game play, good design is lacking.

Unfortunately, my team doesn't really consider this, and feels that everything needs to be commented on by the main character's companion. As a result, I (sound designer) got a huge script in which I had virtually no say, with in my opinion lots of useless lines. Some examples:

  When there's only one tree in the scene with a very obvious squirrel in it.

  "Look at that squirrel in the tree!"

-

  In a room with one door.

  "I wonder what's behind that door."

-

  When facing a lot of bad guys.

  "Those are a lot of bad guys."

I feel we're dumbing down the player, and taking away lots of attention from the actual environment and player's initiative. However, whenever I mention this to the script writer or lead director (who is partially responsible for the script to), they're quite protective about it. I feel I have to ask line-by-line if this is really necessary, and this is not good for the atmosphere or productivity.

How can I convince my team that something more fundamental is wrong with the script?

Edit: Does someone have some good examples of games that use the above in a bad way, that I can use to demonstrate my point?


texts:
HI All,
 what is the steps of to install the unity package in to iphone and create a build (app file )that my client can also able to install in his iphone .

Thanks,
balraj.


texts: Why isn't particle hair more popular in games?

texts:
Blender 2.80 introduced EEVEE, a new realtime renderer, and after interacting with it for a while I was impressed by how well it handles particle hair in terms of performance and visuals. It even manages to reflect light through SSR.

Sphere with 200 parent hair particles, 50 child particles per parent

Blender isn't a game and they probably have different concerns and priorities regarding the performance of the application, so this might be a good reason not to see this being implemented in games right now but still, seeing how well EEVEE manages it and also knowing that games have user-customizable graphic settings, I don't understand why we're still using planes with textures and other techniques like that as our best effort for realtime graphics in games.

Of course having one million strands makes even Blender struggle to keep a reasonable framerate, but a game probably wouldn't need such a dense hair to look convincing and could cheat by having baked hair textures on the scalp in case gaps become visible close-up.

A friend of mine has said Nvidia HairWorks accomplishes just this, but looking at some screenshots I doubt that's the case (if it is, then maybe the technology has evolved a lot lately and nvidia has some catch up to do? I don't know but from what I've seen it doesn't look that good).

So, why isn't particle hair more popular in games?


texts: Objects Imported from Blender to Unreal have really zoomed Materials

texts:
I've been learning how to use Blender for UE4. I just started figuring out how to define which sides should have materials on them. In particular, I wanted this building to have different materials for the sides and top. However, when I apply the Materials, they're very zoomed in.

At first I thought it was a scale issue, but Unreal supposedly converts the models from FBX units to Unreal units. The scale of the model is exactly the same as the one I made in Blender. And yet, I have this issue.
Since it seemed like a conversion of units issue, I made sure to change Blender to also use centimeters just like Unreal, with no scaling or conversion, and yet the issue still arises. I have tried to find a way to shrink the material, with no luck. It seems the only way to do this would be to copy the texture and modify it, but that seems unnecessary. If I wanted to use the same building with a different material, I'd need to do that over and over again.
Is there something I'm missing when Exporting from Blender and Importing into UE4?
I am using Unreal Engine 2.25.1, and Blender 2.83.1
Thanks for your help!


texts: CGVectorMake to move SKNode at a certain speed towards the middle of screen?

texts:
I am trying to launch my ball sprite towards the middle of the screen at the same speed every time I launch it.

let vel: CGFloat = 1000

dx = size.width / 2 - ball.position.x
dy = vel - size.height / 2 - ball.position.y

ball.physicsBody?.velocity = CGVectorMake(dx, dy)

This works in that it does launch the ball towards the center of the screen but at differing speeds depending on where the ball starts from.


texts: C99: Dynamic dispatch in math library depending on SIMD

texts:
Say I am developing a Math library and I want it to be such that it will detect whether or not user's machine support SSE (and which version) and based on that, different functions will be called. I can think of three ways to implement that:

Have global function pointers in the library and let user call mathInit() i their source. When they do, figure out the hardware details and assign the function pointers to different functions.
Same, except instead of having global function pointers, put them in a struct which is returned by mathInit(). This way, user will have to call math.vec3Add(...) or similar.
Same as 1, but instead of having global pointers, make mathInit() a macro so that the function pointers will have local scope in user's main() function (and require mathInit() to be called from main()).

Is any of these methods preferable? Is there some other, better way?


texts: still has issues. Flash works but... requires flash (an issue for iOS). What do you use in Javascript for audio?


texts: Updating game objects already placed in scene

texts:
I have about 20 game objects placed in certain positions in my scene.  I then realized i need to attach two additional game objects to each one of these as children.

Is there a simple way of doing this?  I really don't want to remove them all update the prefab and then place them back.

Is there a way that i can add the two children to the prefab and all 20-something objects in the scene will also be updated?


texts: How can I position a large amount of boxes to prevent overlap efficiently

texts:
I've been working on an asset to position labels like they do in Diablo or Path of Exile, but I'm having trouble finding an algorithm to position the labels efficiently.

Currently I just boxcast in each of the 4 directions until there is no overlap, compare their distances, and take the smallest value to place it, but this just seems too much hassle and too slow with a large number of labels.

Especially when you look at this video clip from Path of Exile without loot filter.
There's no way they can iterate over that many labels and place them instantly.

I think they keep some kind of array that says "there are X open spots for this label group currently, select the nearest one or any", and update it when a label gets placed.

I know this question has been asked and I know about automatic label placement etc. but I don't think it really applies in this case. At a certain point it doesn't really matter where the labels get positioned, they just need to be positioned around another label as fast as possible without overlap.

Basically, I'm looking for a way to save occupied/unoccupied space around a label and retrieve that value somehow.


texts: How to maximize enclosed area and minimize perimeter on a grid with obstacles?

texts:
Developing an RTS game, I have a tile-based terrain (grid) filled with obstacles. It looks like this (red shapes are obstacles):

Now I need to plan an enclosed area on the terrain with some restrictions:

tile marked with a "star" must be included (it is a seed)
area needs to be at least 20 tiles (for this example)
farthest area tile from the seed needs to be no more than 7 steps away (for this example)
area needs to traversable by moving in 4 directions
area should be bound by existing obstacles and by new fences
new fences building takes time and resources, it is beneficial to use existing obstacles as much as possible and have the smallest number of fences placed.
there are cases where terrain could be free of any obstacles, or contrary to that - be a maze-like labyrinth)
it is okay to fail (e.g. there's not enough walkable tiles around the seed), or the area/fences ratio is too low.
processing is done on CPU (if that matters)

So, here are some "manual" attempts at outlining an area of required size using the least fences:

As you can see, there are 3 enclosed areas (green, blue, orange) with very similar perimeters, yet different areas. Best one in this case would be "green" one - it has the least fences added (just 10) and has the sufficient area (21).
What is the algorithm to allow to plan area of given size (~20) while minimizing the amount of additional fences required?

So far I have tried to take the larger area and try to clip it - using BFS to get the area within possible reach (7 steps), clipped the last step (since it is touching the unexplored and has no neighbor info) and clipped the obvious protruding buds - leaves plenty of tiles to work with. I'm out of good ideas on how to improve from that:

yellow tile is the seed
red tiles are walkable (saturation shows distance from the seed)
dark grey tiles are obstacles
light grey tiles are obstacles that also need fences
purple tiles got clipped by existing incomplete algo
black tiles are unexplored
yellow dashes are required fences

As you can see, it looks quite sub-optimal, but I'm at loss as to how to proceed.


texts:
I have a 3D complex shape composed of simpler primitive geometric shapes. The geometric shapes are made of triangles.

I already know how to draw the edges of a single object (geometric shapes). In this case I am comparing each pair of triangles that are adjacent and comparing its normals. If the normals are not the same then it's an edge, so I draw a line.

However, when combining primitive shapes to form a more complex shape (current rendering), I don't know how to remove the edges of the faces that are coplanar with the faces of the adjacent shape.

How can I know what lines are not anymore edges in the complex shape so I get the desired rendering?


texts: Is it a good plan to use 2D physics for a 3D racing game?

texts: I am working on a 3D racing game using SDL and OpenGL. I thought it would be easier to use a 2D physics engine, since I really don't need the 3rd dimension. There will be no flying cars or jumps, they will just be stuck to the floor, so I would use 2D colliders and that things to simulate collisions in a plane but render the actual game from a 3D perspective. So the real question is: is it possible, is it a dumb idea, what else can I do?


texts: How to Incorporate two loops: One for Turn Based Gameplay, and another for ongoing actions

texts:
I'm working on a roguelike using libtcod.

So far everything works well with the turn-based functions. Essentially, when a player takes a turn, it triggers everything to advance.

What if I have an item, such as a torch, and I want to animate that cell? Whether or not the player has taken a turn, purely for aesthetics, I'd like this torch's cell to rotate between some various colors.

How would you incorporate animation like this?


texts: What online games would let me practice AI development?

texts:
I am working on a project experimenting with Artificial Intelligence design methodologies for online world avatars. Online world here is quite open to interpretation; Second Life is just as applicable as Counter Strike, for example. To carry out these experiments, I must first develop an intelligent agent for the world in question. However, I am honestly quite stuck as to which game I could use for this.

My preference was to develop an intelligent "bot" to play an MMORPG, but the legal restrictions of such games prevent me. Likewise with most FPS games the use of an intelligent agent in place of a human player is considered cheating.

The alternative, of course, is to create an NPC bot; an intelligent agent that populates the world alongside the player(s) rather than replacing a particular player. However, I'm struggling to find a game that would enable me to create an intelligent opponent either.

I suppose the main requirements would be a game allows a third party program to use the function calls usually utilised by players and read feedback on the state of the world.

Quake III and Unreal Tournament have been suggested before, but they have already been the subject of work on this research project.

Short of writing my own online game from scratch, what games would allow me, through middleware, an API, or otherwise, to create either an artificially intelligent player or a bot?


texts: I'd like to make game, where one part is managing planet (building cities, factories, roads, etc.) but I'd like to avoid 3D - only what I want is nice 2d. But if I represent planet's surface as a grid, it will be strange to move near poles (if I go up, I won't appear in the bottom of the map, but in the top - only in different place) and it will be hard to have nice terrain (poles will be stretched). Do you have any ideas how to do that?


texts: Publishing a game on Steam without going throught Greenlight

texts: Is there any possible way to publish a game on Steam without going through Steam Greenlight?


texts:
I'm new to 3D OpenGL/DirectX world and I found out that OpenGL 4.1 and GLSL specifications were just released today.

A friend of mine gave me the Red Book for OGL v2.1 but, as far as I've read, 3.x and 4.x differ a lot from 2.x and a lot of things are deprecated now.

Can I use the book to start learning the basics of 3D and CG or is it better to find a newer copy?


texts: What are the GPU requirements for XNA 4.0?

texts:
I tried to build a sample application using XNA, but I got an error saying that Pixel Shader 1.1 was required, so I got a used Radeon X300 GPU that supports Pixel Shader.
I tried to build it again, but I got another error saying that "Your current graphics card does not support the XNA HiDef profile" and would not build.

Since that card seems to not be compatible, I guess I need to buy another one. What features should I look for to make sure that it's compatible with XNA?


texts: How to make procedurally generated terrain look realistic

texts:
I generated a terrain using a technique from this blog post, everything worked well and I got the wanted result.
This is what my generated island looks like:

As you can see the terrain have a polygon structure.
Here is the graph that generated this mesh:

This is the code used to generate this mesh from the graph:

    void DrawPolygons(){
    List<Vector3> vertices = new List<Vector3>();
    List<int> triangles=new List<int>();
    List<Color32> colors = new List<Color32>();

    foreach(Center c in centers){
        float zp = zScale*c.elevation;
        vertices.Add(new Vector3(((Vector2)c.point).x,zp,((Vector2)c.point).y));
        Color c0 = getColor(c);
        colors.Add(c0);
        int centerIndex=vertices.Count-1;
        var edges = c.borders;
        int lastIndex = 0;
        int firstIndex = 0;

        for(int i =0;i<c.borders.Count;i++){
            if(edges[i].v0 == null && edges[i].v1 == null)
                break;

            //get voronoi edge
            Corner corner0 = edges[i].v0;
            Corner corner1 = edges[i].v1;

            //get vertices height
            float z0 = zScale*corner0.elevation;
            float z1 = zScale*corner1.elevation;

            //add color
            if(edges[i].river>0){
                c0 = Color.cyan;
            }else{
                c0 = getColor(c);
            }

            colors.Add(c0);
            colors.Add(c0);

            //creat voronoi edge points
            Vector3 v0 = new Vector3(((Vector2)corner0.point).x,z0,((Vector2)corner0.point).y);
            Vector3 v1 = new Vector3(((Vector2)corner1.point).x,z1,((Vector2)corner1.point).y);

            //add points to vertices
            vertices.Add(v0);
            var i2 = vertices.Count - 1;
            vertices.Add(v1);
            var i3 = vertices.Count - 1;

            //add triangles calculating surface normals so i can always add triangles clockwise correctly
            var surfaceNormal = Vector3.Cross (v0-(new Vector3(((Vector2)c.point).x,zp,((Vector2)c.point).y)), v1-(new Vector3(((Vector2)c.point).x,zp,((Vector2)c.point).y)));
            if(surfaceNormal.y>0)
                AddTriangle(triangles, centerIndex, i2, i3);
            else
                AddTriangle(triangles, centerIndex, i3, i2);

            firstIndex = i2;
            lastIndex = i3;
        }
    }

    //calculating uv's
    Vector2[] uvs = new Vector2[vertices.Count];
    for (int i = 0; i < uvs.Length; i++)
    {
        uvs[i] = new Vector2(vertices[i].x / SIZE, vertices[i].z / SIZE);
    }

    mesh.Clear();
    mesh.vertices = vertices.ToArray();
    mesh.triangles = triangles.ToArray();
    mesh.uv = uvs;
    mesh.colors32 = colors.ToArray();
    mesh.RecalculateNormals();
    mesh.RecalculateBounds();
    meshFilter.sharedMesh = mesh;
    meshCollider.sharedMesh = mesh;

}

I would like to know if it's possible to have a noisy/realistic looking terrain from this. How would I implement such a thing?

Basically I want something with no hard edges, terrain that looks smooth but not too smooth, something like this video shows:


texts:
I'm currently working on a renderer for Tiled's .tmx maps. Among one of the features there is that layers and tilesets are independent, so that a layer can use any tile set on any tile. It's not so much of a problem, though, as my Image type is basically:

data Image = Image { imageTexture :: TextureObject
                   , imageMinTex2 :: TexCoord2
                   , imageMaxTex2 :: TexCoord2
                   } deriving (Show, Eq)

Drawing an image is therefore

Bind texture
Render Quad using min/max texture coords

A quite simple implementation. However, if every Tile is an Image, in my implementation, then this would mean that on every tile, a texture is bound. Often times it will be the same, and quite often just a few tiles have entirely different texture.

So how expensive is a texture binding in OpenGL? Do I have to sort the Tiles by texture or will the OpenGL drivers do that for me?


texts:
need help with collision between ball and rect. i dont know how to test if ball hit the rec from top, bottom, right or left.

x = ball x
y = ball y
radius = ball width and height
rx = rect x
ry = rect y
rheight = rect height
rwidth = rect width

main game loop:

x += dx;   //keep the ball moving so i can test the collision
y += dy;

//collsion between ball and box
if(x+radius > rx && x < rx+rwidth)
 {
if(y+radius > ry && y < ry+rheight)
{
  if(y+radius == ry)
    {
    System.out.println("top");
    }
   else  if(y == ry+rheight)
    {
     System.out.println("bottom");
    }
   else if(x+radius == rx)
        {
    System.out.println("left");
        }
     else if(x == rx+rwidth)
    {
     System.out.println("right");
    }
   }
}


texts: Efficient Method of Rendering Massive Terrain in XNA

texts:
I'm creating an XNA game that requires a huge space for players. Currently, the test heightmap I'm using is 4096x4096, and is saved as a 4-bit BMP.

What I'm trying to do is take that huge heightmap file and render it in the game. The problem I'm running into is the fact that it's inefficient to load the entire terrain into memory at once, as it will use majority of available memory.

Another problem I've run into is that I cannot render the terrain all in one primitive because of a hard-limit set within XNA.

With that said, I've come across a number of solutions, all of which I have listed below:

Rendering based on the current user's location - basically drawing a square around the user no matter their orientation within the world. This isn't exactly what I wanted either, because you're still rendering space that the user does not see.
Rendering based on the user's orientation and position - I found a formula to retrieve a triangle that is supposed to have what pixels of the heightmap are supposed to be rendered, but this proved to be very difficult.
Splitting the terrain into multiple chunks and rendering which ones are closest to the user - Still not very efficient as you're still rendering chunks that people won't see. And it's work-intensive because then I have to split my heightmap into several pieces, and scalability becomes a large problem.

After trying those solutions, I'm fresh out of ideas for what to do. I've received some answers where people are telling me to do these complex algorithms, but I simply have no idea even how to approach doing them.

So basically I'm asking for a simple, straightforward way of rendering humongous terrains in XNA with utmost efficiency.

I'm rather new to game development in general, but I am willing to research if it seems promising.

Update 1: After researching the geoclipmapping method, I started to code with that. I have all the math done, and the game runs. However, it is extremely inefficient - which is probably bad coding on my part. It runs at 2FPS and uses an entire core of my CPU. I'm going to try and improve the code, but I think I'll need more help, so here is a Pastebin of the code for the Terrain manager class. I'll post back with more results later if I ever get it to be more efficient.


texts: Computing chance of winning when dealing with fuzzy numbers

texts:
Computing chance of winning in a one player and one enemy battle when using fixed numbers is quite easy; for example if we have these numbers:

  Player : Attack : 5 - Health : 30 - Attack Interval : 2s
  Enemy : Attack : 10 - Health : 20 - Attack Interval : 5s

When both player and enemy start battling together at the same time you can say for 100% the player will win this battle because it takes the player 8 seconds to kill enemy but enemy needs 15 seconds to win, so it is certain the player would win this battle.

Now considering using not fixed numbers (Attack and Attack Interval are fuzzy), for example for these numbers:

  Player : Attack : (5>10)10% - Health : 30 - Attack Interval : (2s>5s)50%
  Enemy : Attack : (10>15)20% - Health : 20 - Attack Interval : (5s>7s)10%

Note: (5>10)10% means for 90% of times when a player attacks it would have 5 hit points and for 10% of times it randomly can be from 5 to 10 point.

Note: (2s>5s)50% means for 50% of times player attack interval is 2s and for 50% of times it randomly can be from 2 to 5 second.

Now this changes choosing the winner for some numbers; either the player or the enemy can win the battle. How can we compute the chance of winning? For example, concluding that the player has 34% of winning in this battle, etc.

UPDATE : I'm creating probability tree for player and enemy for my example with a little change in numbers to get rounded numbers. example is this :

  Player : Attack : (5>10)10% - Health : 30 - Attack Interval : (2s>5s)70%
  Enemy : Attack : (10>15)20% - Health : 20 - Attack Interval : (5s>7s)10%

now i achieve two probablity/winTimeNeeded chart like these :

Now how can i get player overall win probability with these chart and numbers?

Update : with @realUser404 solution i can say player have exactly 82.0028% of winning in this example (if player and enemy have exactly the same time we consider this a lost.)
still if some one have better solution I'll be happy hear about it I'll wait til the end of bounty.


texts: Unity Collider2D is causing the game object to disappear upon collision

texts:
I have gone through just about everything to try and isolate this bug.

I have isolated it down to the enemy collider, but have not solved the issue.

When my player collides with my enemy, the enemy game object is destroyed and removed from the hierarchy (until reset).

Removing the enemy collider fixes this issue of course. However removing the player collider does not.

Neither the player nor the enemy has collider code written into their scripts, so I can't blame that. I did have an OnEnterCollision2D script added to the enemy game object, but have since removed it in an effort to debug the situation, and it did not do a thing.

There are no other scripts at play - only the relationship between player and enemy colliders.

I'm newish to Unity and coding, but I can't seem to find anything on this issue. Any help is much appreciated!

What. The. Heck.

If you're wanting to read through the scripts, you can here:
https://forum.unity.com/threads/oncollisionenter2d-is-destroying-my-game-objects-and-i-cannot-figure-out-why.710837/


texts: MMO sending player position to other players

texts:
When it comes to sending data to a player in MMOs, is this what the server is basically doing? (pseudo code)

every gametick:
    for each player connected:
        compile `string` of positions of all other players in range
        if `string` different `lastString`:
            send data to player
            set `lastString` to `string`


texts: Calculating normals after displacement mapping

texts:
I'm using C++, DX11 and tessellation. After tessellating a triangle I apply displacement mapping to the new vertices. But they still have the original triangle's normal so the lighting calculation behaves like the surface was flat.

So I see two solutions: sampling a normal map (corresponding to the displacement map) or sampling the displacement map in a few more places to calculate the normal myself (both would be done in the shader).

Since I'm using already using another normal map (with more detail than the displacement map contains) a 2nd normal map seems a little like an overkill. And calculating the normals myself seems inefficient.

Both solutions would work though so my dilemma is really this - am I overthinking it? Should I just go with one of the above solutions? Or is there a better approach?


texts: Why aren't my pieces rotating on my chess board in Java?

texts:
I am developing chess game in Java using the Netbeans IDE. Instead of rotating the whole board at each move, I thought of changing position of the pieces themselves, while the board remains same. All my pieces and squares are JLabels and are in a JLayeredPane, with pieces being in top layer. All the squares are part of a JLabel array named labels and same for white and black pieces.

WinitialLocation and BinitialLocation are Point Arrays for initial positions of white and black pieces.

But running the following code in mouseReleased() event of the pieces, only the piece which we moved changes place, the rest remain at their position.

Can anybody help me, Please?

void reLocate() {
     for(int i = 0; i < 6; i++ )
     {
        for(int j=0, n=labels.length; j<n;j++)
        {
            if(labels[j].getLocation().equals(WinitialLocation[i]))
               wPieces[i].setLocation(labels[63-j].getLocation());

            if(labels[j].getLocation().equals(BinitialLocation[i]))
               bPieces[i].setLocation(labels[63-j].getLocation());
        }

        layer.moveToFront(wPieces[i]);
        layer.moveToFront(bPieces[i]);
    }
}


texts: Is it possible to make windows games using Havok's Project Anarchy?

texts:
I'm interrested in Havok's Project Anarchy as I plan to learn how to make 3D Games, so I've done some research and it seems focused on mobile platforms.

So before I engage myself I would like to know if it is possible to make PC Windows games with It since it is not explicitly mentionned.


texts:
I have a simple snake game, where I have other NPC snakes on the field.
How do I calculate the movement of those other snakes so that they did not hit walls, and each other?

So far I have it like this:

I check for current coordinates and when there is a wall nearby I change direction to some other one. And so on, this way the snakes never collide the walls.

But not actually colliding other snakes, how do I prevent this?

I figured I could probe for the direction I'm heading and if there is anything there I would change direction too, but there is a set of situation where this won't work, for example if another snake will block off all exits later.


texts: How do I use coroutines to animate properly?

texts:
I have a coroutine, which I called from the Update() method on every click.

First, I call AddTrunk() to add to my trunkList, then I use my coroutine to move the animation for 0.3 seconds. After 0.3 seconds, it calls Destroy(), and then it changes transform.position. However, before completing the animation, it runs transform.position; it first my tree down first, and then does the animation.

This is where I call my coroutine:

void Update ()
{
    if (Input.GetMouseButtonDown (0))
    {
        AddTrunk ();

        if (!isRunning)
        {
            StartCoroutine (BranchOutAnimation ());
        }
    }
}

Here is the coroutine BranchOutAnimation():

IEnumerator BranchOutAnimation()
{
    while (true)
    {
        isRunning = true;
        iTween.MoveTo (trunkList[index],
            new Vector3 (trunkList[index].transform.position.x
            - 5f, trunkList[index].transform.position.y,
            trunkList [index].transform.position.z), 0.3f);
        yield return new WaitForSeconds (0.3f);

        Destroy (trunkList [index]);
        trunkList.RemoveAt (index);
        transform.position = new Vector3 (transform.position.x, transform.position.y
            - treeHeight, transform.position.z);
        isRunning = false;
        yield break;
    }
}

What am I doing wrong?


texts:
How do I achieve navigation to different views in Marmalade? Like what using startActivity(intent) in Android does.
I know that there's only a single view in Marmalade, but still couldn't figure out how to make a similar example.


texts: What programming languages would be used to make an Apple App like Angry Birds or Cut the Rope?

texts:
I'm currently working in the Multimedia industry and although I'm better at design then development. I have knowledge of HTML, CSS, very basic jQuery, Actionscript.

What programming Languages would you need to know?

What else would you need to know to develop an application?

I am assuming you would need to know xcode and Objective-C?


texts: Alternative to entity system in a game engine?

texts: I have been developing a game engine. I was wondering what I should use for a component system. I've read up on entity component systems, but what other alternatives are there? The idea of searching through a "master list" of all entities in the entire game world seems inefficient and slow. I need the most efficient one possible (3D and 2D, if that matters). Using object oriented programming (C++)


texts: Libgdx unable to enter input in TextFields

texts:
Hello I am trying to make login screen for my game, I use TextField's.

1. I am not satisfied with how they look I want it to look like this but simpler - basically to have a white field next to the name of the field.

2. When I run the game it shows just 2 labels, and I can't edit them or anything.

3. Here is my code:

public class FirstTime implements Screen {
private Stage stage;
private UVeggFruit uVeggFruit;
private Music music;
private MenuStage menuStage;
private TextField.TextFieldStyle textFieldStyle;
private OrthographicCamera camera;
private float densityT = 60 * Gdx.graphics.getDensity();
private BitmapFont bitmapFont;

public FirstTime(UVeggFruit uVeggFruit,Music music){
    this.uVeggFruit = uVeggFruit;
    this.music = music;
}

@Override
public void show() {
    stage = new Stage();
    camera = new OrthographicCamera();
    Viewport vp = new StretchViewport(1280, 720, camera);
    stage = new Stage(vp);
    Gdx.input.setInputProcessor(stage);
    ButtonClickListener buttonClickListener = new ButtonClickListener();
    SceneLoader sc = new SceneLoader();
    CompositeItemVO sceneComposites = new CompositeItemVO(sc.loadScene("Login").composite);
    CompositeActor UI = new CompositeActor(sceneComposites, sc.getRm());
    music.setLooping(true);
    music.play();
    stage.addActor(UI);
    UI.getItem("regisbutton").addListener(buttonClickListener);
    UI.getItem("loginbutton").addListener(buttonClickListener);
    FreeTypeFontGenerator FTFG = new FreeTypeFontGenerator(Gdx.files.internal("Karmakooma.ttf"));
    FreeTypeFontGenerator.FreeTypeFontParameter FTFP = new FreeTypeFontGenerator.FreeTypeFontParameter();
    FTFP.color = Color.WHITE;
    FTFP.size = Math.round(densityT);
    bitmapFont = FTFG.generateFont(FTFP);
    FTFG.dispose();
    textFieldStyle = new TextField.TextFieldStyle();
    textFieldStyle.font = bitmapFont;
    textFieldStyle.fontColor = Color.WHITE;
    TextField username = new TextField("Username",textFieldStyle);
    TextField password = new TextField("Password",textFieldStyle);
    password.setPosition(400, 400);
    username.setPosition(400, 500);
    stage.addActor(username);
    stage.addActor(password);
}

@Override
public void render(float delta) {
    camera.update();
    Gdx.gl.glClearColor(0, 0, 0, 1);
    Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
    stage.act(delta);
    stage.draw();
}

@Override
public void resize(int width, int height) {
    stage.getViewport().update(width, height, true);
}

@Override
public void pause() {

}

@Override
public void resume() {

}

@Override
public void hide() {

}

@Override
public void dispose() {
    bitmapFont.dispose();
    music.dispose();

    }
 }

I will be happy if you can answer both of my questions.


texts:
For our game we decided to give SECTR (https://www.assetstore.unity3d.com/en/#!/content/15356) a try. SECTR loads scenes additively into the main scene, which enables us to work on it concurrently. It also unloads scenes when they aren't used.

Time is very important in our game and objects have to perform actions at a certain time or have to be in a certain state at a time. We decided to have those actions/events local to the sector. So now when the sector is unloaded, we lose the current progress of our action/event.

What is a good way to save this progress and how could we apply differences in time between unloading and loading to this progress?
How do we handle events happening while the sector is unloaded?

The obvious solution is to use global state for these events, but we'd like to keep it local to the sectors.


texts: Why do we have to resize the screen in LibGDX

texts: In a lot of the libgdx tutorials that I have took until now, I am told to resize the screen of the game using the SetToOrtho() of the orthographic camera. However, I don't get this part. Why do I have to resize the screen and make the sprites look bigger when I can just make the sprites themselves big at the first place?


texts: How to make progress bar adapt to various aspect ratios in Unity3d

texts:
Can anyone help me with this problem:
I want to make a time progress bar in my game. I have two textures: progressBarFrame and progressBar. Currently I'm doing the following:

void OnGui() {
    GUI.DrawTexture ( Rect(x,y,width,height), progressBar );
}

It works, but it doesn't adapt to different screen sizes.

I also tried this: Create GUITexture in the hierarchy and add a texture to it, after adjusting  its size and location as I need, progress bar stretches/squishes with different aspect ratios and keeps its position relative to other GameObjects (that's what I want). But I don't know how to animate it properly because the figure of the textures is not a simple line.


texts: How can I change the splash screen for a standalone game in Unity3D?

texts: I want to change the normal Unity splash screen to be customized for my game and every time I change the splash image in the player setting it does not appear. So how can I do that please?


texts: How to use Particle start color in unity3d 2017

texts:
I want to create a particle(prefab) and use another object color to change those particle's color but it seems everything is changed and I don't know the new method to use it.

Here my code:

 GameObject breakpart = Instantiate (smoke, gameObject.transform.position , Quaternion.identity) as GameObject;

 breakpart.GetComponent<ParticleSystem>().startColor = gameObject.GetComponent<SpriteRenderer>().color;

So how can I fix it?


texts: Resources for 2D rendering using OpenGL?

texts:
I noticed that there is quite some difference between 3D and 2D rendering using OpenGL, the techniques are different - pixel-perfect placing is a lot more desirable, among other things.

Are there any good (complete) references on using OpenGL for rendering 2D graphics? There are quite a few "tutorials" around on the net that help you open a window, set up a half-decent environment and draw a sprite, but no real good information on rotation, blending, lightning, drawing order, using the z-buffer, particles, "complex" primitives (circles, stars, cross symbols), ensuring pixel-perfect rendering, instancing and many other staple 2D effects/techniques.

Any books, great blogs, anything? Any particular awesome libraries to read?


texts: Setting SteamVR Camera Target Eye before SteamVR installed in Unity

texts:
I'm writing a plugin that can be used in both VR and non-VR projects. I have a Camera that is used to display UI containing some game info on a secondary monitor. My problem is that when the end-user adds my plugin and then imports steam vr, this UI camera's Target Eye is set to "Both" by default.

I can't have any SteamVR code in my plugin. But I can't adjust Target eye property of the camera without it. I just want it so that the camera doesn't change when a user imports SteamVR. I want it to always render to the main display (target eye = none)

So just to clarify,

I have my plugin, written in a non-vr project with a standard Unity camera. There is no Target Eye setting for this standard camera.
User wants to use it in VR project, imports plugin into SteamVR Project
Camera used to render UI gets automatically converted (wrongly) into SteamVR camera
Defaults to Target Eye = Both
Need it to be Target Eye = None

At the moment to avoid users submitting countless bug reports, I have to provide warnings in like 6 places telling users to dig way into my built-in prefabs to adjust this setting manually if they use SteamVR. It's not easy for new Unity users, and I want to make adoption as easy as possible.


texts:
I'm currently trying to implement a ArcBall Camera which should fly around a given XMFLOAT3 position stored in a cb with a spezified distance to the position. I used the code from Allen Sherrod for this but the constant buffer that should pass the viewmatrix and the second one for the position to the shaders doesn't update. Any ideas?

This should return the view mat:

    XMMATRIX ArcCamera::GetViewMatrix()
{
    XMVECTOR zoom = XMVectorSet(0.0f, 0.0f, distance_, 1.0f);
    XMMATRIX rotation = XMMatrixRotationRollPitchYaw(xRotation_, -yRotation_, 0.0f);

    zoom = XMVector3Transform(zoom, rotation);

    XMVECTOR pos = XMLoadFloat3(&position_);
    XMVECTOR lookAt = XMLoadFloat3(&target_);

    pos = lookAt + zoom;
    XMStoreFloat3(&position_, pos);

    XMVECTOR up = XMVectorSet(0.0f, 1.0f, 0.0f, 1.0f);
    up = XMVector3Transform(up, rotation);

    XMMATRIX viewMat = XMMatrixLookAtLH(pos, lookAt, up);

    return viewMat;
}

The rotation (xRotation, yRotation) increases every frame.

The shaders:

Texture2D colorMap : register( t0 );
SamplerState colorSampler : register( s0 );

cbuffer cbChangesEveryFrame : register( b0 )
{
    matrix worldMatrix;
};

cbuffer cbNeverChanges : register( b1 )
{
    matrix viewMatrix;
};

cbuffer cbChangeOnResize : register( b2 )
{
    matrix projMatrix;
};

cbuffer cbCameraData : register( b3 )
{
    float3 cameraPos;
};

struct VS_Input
{
    float4 pos  : POSITION;
    float2 tex0 : TEXCOORD0;
    float3 norm : NORMAL;
};

struct PS_Input
{
    float4 pos  : SV_POSITION;
    float2 tex0 : TEXCOORD0;
    float3 norm : NORMAL;
    float3 lightVec : TEXCOORD1;
    float3 viewVec : TEXCOORD2;
};

PS_Input VS_Main( VS_Input vertex )
{
    PS_Input vsOut = ( PS_Input )0;
    float4 worldPos = mul( vertex.pos, worldMatrix );
    vsOut.pos = mul( worldPos, viewMatrix );
    vsOut.pos = mul( vsOut.pos, projMatrix );

    vsOut.tex0 = vertex.tex0;
    vsOut.norm = mul( vertex.norm, (float3x3)worldMatrix );
    vsOut.norm = normalize( vsOut.norm );

    float3 lightPos = float3( 0.0f, 500.0f, 50.0f );
    vsOut.lightVec = normalize( lightPos - worldPos );

    vsOut.viewVec = normalize( cameraPos - worldPos );

    return vsOut;
}

float4 PS_Main( PS_Input frag ) : SV_TARGET
{
    float3 ambientColor = float3( 0.2f, 0.2f, 0.2f );
    float3 lightColor = float3( 0.7f, 0.7f, 0.7f );

    float3 lightVec = normalize( frag.lightVec );
    float3 normal = normalize( frag.norm );

    float diffuseTerm = clamp( dot( normal, lightVec ), 0.0f, 1.0f );
    float specularTerm = 0;

    if( diffuseTerm > 0.0f )
    {
        float3 viewVec = normalize( frag.viewVec );
        float3 halfVec = normalize( lightVec + viewVec );

        specularTerm = pow( saturate( dot( normal, halfVec ) ), 25 );
    }

    float3 finalColor = ambientColor + lightColor * diffuseTerm + lightColor * specularTerm;

    return float4( finalColor, 1.0f );
}

Must I update all subresources and stuff before every time I call the context's draw method to render every my objects by the way?


texts: Layers with parallax in a game with zoom out by a transformation matrix

texts:
I'm trying to implement a parallax rendering to my multi layered backgrounds. It's a classic 2d fighting game like The King of Fighters and Street Fighter.

It may have a stage composed by 5 layers.

Layers:

1 = Factor of 100% (the original, where generally the characters and the floor are present)

2 = Factor of 75%

3 = Factor of 50% (half of movement and scale of the first layer)

4 = Factor of 25%

5 = Factor of 0% (static, generally stuff very far away of the camera, like the sky, moon, stars etc.)

The camera with scale 1 shows 640 x 384 pixels, and with the max zoon out (scale 0.5) shows 1280 x 768 pixels.

Ie, all the stages of the game have a maximum size of 1280 x 768

These would be the sizes of the images of each layer aforementioned:

100% = 1280 x 768

75% = 1120 x 672

50% = 960 x 576

25% = 800 x 480

0% = 640 x 384

Every works fine when my transform matrix is with scale of 1, since it's only needed to multiply the actual camera position to the factor of the current layer being rendered.

The difficulty arises when the scale of the camera changes. It seems that I need to compensate the scale of the matrix in the parallax factor of the layers, but I can't figure out how.

Any sugestion?

--UPDATE--

Here some images of an example of a layer with 50% factor (960 x 576):

The first image the camera matrix is with scale 1 (no zoom) and is positioned in left edge of the screen. The second is the same but in the right edge and the last image is with the max zoom out (0.5).

I already correct the scale of the layer, the problem is correct the offset of its translation.

This layer is draw at the position (0, 0) relative to the stage size (1280 x 768) and with a origin Vector of (160 x 96).

--- UPDATE2 ---

I don't think my problem is in the camera matrix, because the sprites without the parallax processing are drawing correctly with any zoom, but here it is:

var gameResolution = new Vector2(640, 384);

var currentScale = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width / gameResolution.X * camera.Zoom,
                               GraphicsDevice.Viewport.TitleSafeArea.Height / gameResolution.Y * zoom);

var middleOfScreen = new Vector2(GraphicsDevice.Viewport.TitleSafeArea.Width - 1) / 2f,
                                 GraphicsDevice.Viewport.TitleSafeArea.Height - 1) / 2f);

var currentTranslation = new Vector2(middleOfScreen.X - cameraPosition.X * currentScale.X,
                                     middleOfScreen.Y - cameraPosition.Y * currentScale.Y);

var cameraMatrix = Matrix.CreateTranslation(currentTranslation.X, currentTranslation.Y, 0);

cameraMatrix.M11 = currentScale.X;
cameraMatrix.M22 = currentScale.Y;


texts: Where do I place XNA content pipeline references?

texts:
I am relatively new to XNA, and have started to delve into the use of the content pipeline. I have already figured out that tricky issue of adding a game library containing classes for any type of .xml file I want to read.

Here's the issue. I am trying to handle the reading of all XML content through use of an XMLHandler object that uses the intermediate deserializer. Any time reading of such data is required, the appropriate method within this object would be called. So, as a simple example, something like this would occur when a character levels:

public Spell LevelUp(int levelAchived)
{
    XMLHandler.FindSkillsForLevel(levelAchived);
}

This method would then read the proper .xml file, sending back the spell for the character to learn. However, the XMLHandler is having issues even being created. I cannot get it to use the using namespace of Microsoft.Xna.Framework.Content.Pipeline. I get an error on my using statement in the XMLHandler class:

using Microsoft.Xna.Framework.Content.Pipeline.Serialization.Intermediate;

The error is a typical reference error:

  Type or namespace name "'Pipeline' does not exist in the namespace 'Microsoft.Xna.Framework.Content' (are you missing an assembly reference?)"

I THINK this is because this namespace is already referenced in my game's content. I would really have no issue placing this object within my game's content (since that is ALL it deals with anyways), but the Content project does not seem capable of holding anything but content files.

In summary, I need to use the Intermediate Deserializer in my main project's logic, but, as far as I can make out, I can't safely reference the associated namespace for it outside of the game's content. I'm not a terribly well-versed programmer, so I may be just missing some big detail I've never learned here. How can I make this object accessible for all projects within the solution? I will gladly post more information if needed!


texts: Ranking system in an Android Open Source project

texts:
This is my first question in any stackexchange board, but I've been reading Stack Overflow answers for a few months. I hope this question is appropriate for this one.

I am developing a simple Android game using Java and libgdx. I want to make a typical ranking, a player who completes a level is awarded some points, and his score is compared with other players who sent theirs. This is all ok (well I still need to find a way to store players' scores). On the other hand, I may want my project to be released as an open source project, so others can look at its code freely. My question is, if anybody can get this code, modify it in order to get some advantatge, compile this game, and load it onto an Android device, how can I stop him/her from sending his/her score? It would by unfair to let them send highscores with a different game.


texts: Sending a struct containing a string over network

texts:
I'm trying to send structs as neatly sorted packets using iPhone Game Kit..

I have a struct which looks like:

typedef struct {
   int coolStuff;
   char playerID[100];
} MyStruct;

Then I'm using strncpy() to copy the NSString I want into MyStruct.playerID. However, I would like to be able to send a playerID (string) of any size and possibly multiple strings per struct. Any suggestions?

There is a chance I'm  making this more difficult than it actually is..


texts:
I'm in the process of developing a game engine and I would like to refer to game objects and assets by an integer id rather than by their string name.  This should avoid any string comparisons at runtime.  As a result I'm trying to implement the string hashing approach that Jason Gregory describes in Game Engine Architecture.
I've got the actual hashing working, using FNV-1a in my case, but there are some parts of the design from the book that I don't understand.
static StringId sid_foo = internString("foo");
static StringId sid_bar = internString("bar");
...
[stringid.h]

typedef U32 StringId;
extern StringId internString(const char* str);

[stringid.cpp]

static HashTable<StringId, const char*> gStringIdTable;

StringId internString(const char* str)
{
    StringId sid = hashCrc32(str);
    HashTable<StringId, const char*>::iterator it
        = gStringIdTable.find(sid);

    if (it == gStringTable.end())
    {
        // This string has not yet been added to the
        // table. Add it, being sure to copy it in case
        // the original was dynamically allocated and
        // might later be freed.
        gStringTable[sid] = strdup(str);
    }
    return sid;
}

Presumably HashTable is a custom hash table implementation as no such class exists in C++?  Is there any problem with my current setup of storing the hashed strings in a std::unordered_map<StringID, const char*>?
From my research, making the hash table static means that it is only accessible inside this translation unit.  a)  Why is it defined this way, and how would you then access the hash table in the rest of the game engine?  b) Or do you call internString for every string and store the returned hash in a header #included in every file that needs access?
What is the purpose of making externString extern?

Thanks.


texts: Procedural Turn Based Puzzle Generation?

texts:
Alright, we have a large set of possible moves (what the player is allowed to do). We also have a well defined state of success that defines the desired goal.
We want to generate a configuration where for the purpose of this question, only 1 set of moves leads to a victory within k steps. We also have a solver that can find all possible solutions for a given configuration problem.

For example let's take Chess, how would you place a set of chess pieces on a board such that only a specific set of moves by White will result in Check Mate?


texts: Validating victory report to PHP leaderboards

texts:
I have decided to begin working on some sort of leaderboard server for my PC game.

For starters, I decided to write some PHP scripts to handle it. The script doesn't actually receive a score - it just receives a player ID. Then the server increases their score. When submitting a "victory", the game performs a connection to the server of this form:

http://www.example.com/doVictory.php?ID=Joe

As you can see, the server just receives the player ID and then it does its own scoring stuff (the score value of a victory changes overtime).

My concern is pretty simple: what if some guy figures this out? They would be able to spam the above address several times and keep increasing their score.

One option:

Don't accept victories from the same player within a short amount of time.

Due to the nature of the game, players can have a victory as fast as within 1 minute. If somebody is having a victory every minute, I would not be able to tell whether they are cheating or just very good.

I have found an answer here: https://gamedev.stackexchange.com/a/4185/4779

  Send a JSON message over plain HTTP (not HTTPS). Include a MD5-hash of all fields plus a magic string.
  On the server, check the integrity of the message with the same operation.

But as far as I'm concerned, this doesn't quite work with my scenario because I am not really sending a score - just reporting a victory.


texts:
I've seen a lot of rhetoric over the year about not using a Public Static class to store global variables or methods that are used across an application.

I understand the philosophy about code maintenance issues that this might present in business software with a number of developers but is there any real performance issues this introduces?

Specifically if the items that have been made public static are used from most classes in the game and prevent multiple instances of a given class from being created. e.g. collision detection, playing audio samples etc.


texts: Reconciling external events with the game loop

texts:
Is there any way I can program (in Java or Python, but open to other solutions) some game logic based on events, timed and sent by player input, without dealing with it inside the game loop, by having a game state that has a number of scripts listening for events, and those scripts can themselves fire events that change the game states and by consequence the scripts listening for events? An example bellow

class BombScript {

    private GameObject bombReference;

    void bombDefused() {
        // change the script listening for events
        bombReference.destroy();
    }

    void bombExplode() {
        // launch some events, change the script listening for events
        stopListeningForEvent("bombDefused");
        bombReference.destroy();
        sendEvent("bombExplode", bombReference);
    }

    void bombPlanted() {
        // if somehow the server receives a defuse command
        onEvent("bombDefused").execute(bombDefused);

        // else, if 6 seconds pass without an "bombDefused" event
        onTimeout(6).execute(bombExplode);
    }
}

I'm having trouble imagining a concrete implementation for that, specifically the timed based "if/else"


texts:
I have been working on animation in my small game engine recently and I am implementing some interpolation to be used with skeletal animations. I know how to do interpolation but I am not sure where to put the equation that I get out of it.

Do I save an equation for each channel of every bone in the data structure? Maybe something along the lines of:

struct Channel
{
    std::string boneName;
    std::vector<KeyFrame> keyframes;

    // These equations will be used to find the position/rotation/scale of
    // the bone at t time.
    std::vector<float> rotEqX, rotEqY, rotEqZ;
    std::vector<float> translateEqX, translateEqY, translateEqZ;
    std::vector<float> scaleEqX, scaleEqY, scaleEqZ;
};

Do I just calculate the equation every time I want to update the animation? (Seems a little inefficient?)


texts: Speech recognition and AI in language learning platform

texts:
I work for a publishing company that is looking to create an online virtual environment for English Language Learners.

We are keen to create something immersive (virtual 3D world) through which the learners can experience 'real' interactions.  Part of this is that we really want them to be able to speak in the environment (and for the game NPCs to be able to respond/register the learner's utterances). Is there tech out there that could help us achieve this? Is there currently anything like this out there?


texts: Why not derive velocity from position updates in games?

texts:
Is there a reason why retrieving velocity of a 3d object in a game engine vs deriving it from position updates is preferable?

I am currently polling position at every step and deriving current velocity, however, there is also a "get velocity" option. I already need position but I'm wondering if the velocity in the game engine is preferable for some reason like it has less latency than the derivative.


texts: Camera math: How to calculate the horizontal and vertical angle from the look at vector

texts:
I'm using the PerspectiveCamera class in C#/WPF to implement an FPS style camera.

For that, I would need to offset the camera's horizontal and vertical angles every time the mouse is moved. The problem is that PerspectiveCamera doesn't store those angles and only provides a lookat vector.

So, is there a way to calculate those angles from the lookat vector ?


texts: What is the speed difference between cross platform HTML5 games and native mobile games?

texts:
Microsoft is advertising and promoting cross platform HTML5 game development. I am thinking of creating a simple 2D side scroller game and I am trying to decide what engine should I use for creating it. I am trying to understand if there is a big difference between developping once in Unity and exporting to different platforms or simply develop it once in HTML5 in Visual Studio and publish it everywhere.
What are the drawbacks and benefits for each? Is there any speed/lag difference?
any tips are useful


texts: Problem trying to lock framerate at 60 FPS

texts:
I've written a simple class to limit the framerate of my current project.
But it does not work as it should. Here is the code:

void FpsCounter::Process()
{
    deltaTime = static_cast<double>(frameTimer.GetMsecs());
    waitTime = 1000.0/fpsLimit - deltaTime;
    frameTimer.Reset();

    if(waitTime <= 0)
    {
        std::cout << "error, waittime: " << waitTime << std::endl;
    }
    else
    {
        SDL_Delay(static_cast<Uint32>(waitTime));
    }

    if(deltaTime == 0)
    {
        currFps = -1;
    }
    else
    {
        currFps = 1000/deltaTime;
    }

    std::cout << "--Timings--" << std::endl;
    std::cout << "Delta: \t" << deltaTime << std::endl;
    std::cout << "Delay: \t" << waitTime << std::endl;
    std::cout << "FPS: \t" << currFps << std::endl;
    std::cout << "--       --" << std::endl;
}

Timer::Timer()
{
    startMsecs = 0;
}

Timer::~Timer()
{
    // TODO Auto-generated destructor stub
}

void Timer::Start()
{
    started = true;
    paused = false;
    Reset();
}

void Timer::Pause()
{
    if(started && !paused)
    {
        paused = true;

        pausedMsecs = SDL_GetTicks() - startMsecs;
    }
}

void Timer::Resume()
{
    if(paused)
    {
        paused = false;

        startMsecs = SDL_GetTicks() - pausedMsecs;

        pausedMsecs = 0;
    }
}

int Timer::GetMsecs()
{
    if(started)
    {
        if(paused)
        {
            return pausedMsecs;
        }
        else
        {
            return SDL_GetTicks() - startMsecs;
        }
    }
    return 0;
}

void Timer::Reset()
{
    startMsecs = SDL_GetTicks();
}

The "FpsCounter::Process()" Method is called everytime at the end of my gameloop.

I've got the problem that the loop is correctly delayed only every second frame, so it runs one frame delayed at 60 FPS and the next without delay at over 1000 fps.

I am searching the error quite a while now, but I do not find it.

I hope somebody can point me in the right direction.


texts: Why does a translation matrix need extra row?

texts:
Following recommendation of this answer I've recently read the series of articles of Wolfire about linear algebra. I'm somewhat familiar with matrices and I came to a conclusion that vector and a matrix multiplication is in fact multiplication of 2x2 and 2x1 matrices:

\begin{equation*}
\begin{bmatrix}
a & c \\
b & d
\end{bmatrix}
\qquad
\begin{bmatrix}
x \\
y
\end{bmatrix}
\end{equation*}

In the article the author reveals that to accomplish translation in addition to rotation we need to add a row and a column to the translation matrix:

  If we want to translate by a vector (e,f), we can just tack it onto our change-of-basis matrix like this:
  \begin{bmatrix}
a & c & e\\
b & d & f\\
0 & 0 & 1
\end{bmatrix}
  And then we add an extra 1 to the end of each position vector like this:
  \begin{bmatrix}
x\\
y\\
1
\end{bmatrix}

P.S. I edited the direction of the vector to make it comply with matrix multiplication conditions.

The 1 at the third row of the vector is totally understandable: to multiply 2x3 matrix we need a 3-row matrix.

What I didn't get here is why we need extra row for translation matrix? I can't see any difference in multiplication (except for the useless 1):

\begin{equation*}
\begin{bmatrix}
a & c & e\\
b & d & f\\
0 & 0 & 1
\end{bmatrix} *
\begin{bmatrix}
x\\
y\\
1
\end{bmatrix} = \begin{bmatrix}
ax + cy + e\\
bx + dy + f\\
0 + 0 + 1
\end{bmatrix}
\end{equation*}

\begin{equation*}
\begin{bmatrix}
a & c & e\\
b & d & f\\
\end{bmatrix} *
\begin{bmatrix}
x\\
y\\
1
\end{bmatrix} = \begin{bmatrix}
ax + cy + e\\
bx + dy + f\\
\end{bmatrix}
\end{equation*}

So the same question for 3D matrices, just it's easier to convey with a 2D case


texts: Batching Homogeneous Render Objects in XNA, 2D Component-Entity Engine?

texts:
I've been working on my component-entity engine for about 3 months now, and have managed to get nearly every constituent system working with little effort or compromise. My system has the following attributes:

Components are mostly comprised of data.
Services (physics, networking, rendering, etc) operate on these components' data in a type-agnostic manner.
Components register themselves with their respective service provider on start-up.

One of the services I've been struggling to implement is rendering. I want a rendering service that keeps a list of my drawn components in an ordered list depending on what kind of drawing operations they require from the graphics device (i.e. different shaders, textures, draw order, etc) and then every frame iterates over the the list, grabs the indexed vertex arrays from the component and renders them using the settings specified in the "DrawContext."

In my research, I've stumbled upon the Nuclex.Graphics package which seems to solve a great deal of my concerns. It has an excellent implementation of vertex buffer object batching, queuing and such but it is not necessarily tailored towards a component-entity system. With Nuclex's design, all that is required is for my components to "queue" vertex buffer objects with the service which then batches them according to their "DrawContext."

My question is, how I can hide all of these vertex objects from the user? How can I enable my rendering service to draw both simple textured quads and complex stencil shadows while remaining type-agnostic? If you've worked on a component-entity system, how did you tackle complex rendering schemes?


texts: LibGDX Bounding system with tiledMap, 3D model player and ortho cam

texts:
Begins explaining my achieve: as I said in my last question, I am tryna makin' a 2D game with 3D player as Factorium. For hours I am tryna to make a kinda of bounding system:
1)Camera will follow player untill the left border of the screen will reach the left edge of the map
2)If left edge has been reached, only player keep walking towards left
3)Once player come back, camera will follow player again only when it will have reached the right distance
These steps for each side

First image: left edge of the map still not reached, so camera keep following player constraints it at its center.
Second image: camera reached it, but layer kept waling, then begins come back
Thirds image: distance between player and left edge is at lest as half camera viewport, so camera begins follow player again.
Of course, I tried something...
/**
 * Using tile map proeprties
 * @param translateCords how much player has to be moved
 * @return if the player can me moved
 e.g. if the camera will not be over the map's edge
 * after have been moved
 */
private boolean canPlayerMove(Vector3 translateCords) {
    Vector3 playerPos = this.entityPlayer.getPosition();
    Vector3 futurePos = playerPos.add(translateCords.x, translateCords.y, 0);

    TiledMapTileLayer.Cell cell = ((TiledMapTileLayer)this.tiledMap.getLayers().get(0)).getCell((int)futurePos.x, (int)futurePos.y);
    return cell.getTile().getProperties().containsKey("blocked");
 }

This for move camera
     /**
 * @param translateCords how much camera has to be moved
 * @param camPos current camera position
 * @return if the camera can me moved
 e.g. if the camera will not be over the map's edge
 * after have been moved
 */
private boolean canCameraMove(Vector2 translateCords, Vector3 camPos){
    if( (translateCords.x < 0 && camPos.x - this.viewportWCam >= 0) ||
        (translateCords.x > 0 && camPos.x + this.viewportWCam <= this.widthWorld) ||
        (translateCords.y < 0 && camPos.y - this.viewportHCam >= 0) ||
        (translateCords.y > 0 && camPos.y + this.viewportHCam <= this.heightWorld)) {
        return true;
    }
    return false;
}

I tried a lots of other stuff...


texts:
I am trying to implement a deep reinforcement learning IA with TensorFlow for a checker game in Unity. How can I do this?

I've searched for it on Google and found a lot of videos and tutorials on how to use machine learning agents with Unity, and other people who explain how to import a TensorFlow trained neural network in Unity, but I didn't see anything related to using directly TensorFlow in Unity to create (and train) neural networks.

If someone knows another package to create CNNs with C#, I am interested.


texts:
I have clicked on check for updates but it says I have latest Unity.

But latest is 5.6.

How to update it to 5.6?


texts:
Im having some trouble with locomtions (Unity3D asset) IK feet placement. I wouldn't call it "very bad", but it definitely isn't as smooth as the Locomotion System Examples.

The strangest behavior (that is probably linked to the problem) are the rendered foot markers that "guess" where the characters next step will be. In the demo, they are smooth and stable. However, in my project, they keep flickering, as if Locomotion changed its "guess" every frame, and sometimes, the automatic defined step is too close to the previous step, or sometimes, too distant, creating a very irregular pattern.

The configuration is (apparently)Identical to the human example in the demo, so I guessing the problem is my model and/or animation. Problem is, I can't figure out was it is =S

Has anyone experienced the same problem? I uploaded a video of the bug to help interpreting the issue (excuse the HORRIBLE quality, I was in a hurry).


texts: Rotate a rigid body not around its centre of mass

texts:
I have a rigid body (a boat) whose centre of mass is towards the front of the object. However, this makes the rotation look strange as the rudder that is turning the object is at the back of the boat so the rotation would be around that point.

How can I rotate the object from the a separate point (using forces) without changing the centre of mass?

Applying a force at a location still causes the object to rotate around the centre. In real life, you need to pin down the point that you want to rotate around, forcing the object to rotate around that point.

This would suggest using constraints but I can't figure out how that would work. You sort of need the rotation point to act as a hinge, but when I apply a suitable constraint, but that would just block the rotation rather than convert it into a rotation around the new point.

I want to resolve this using physics driven operations in Unreal Engine 4.

I don't want to move the Centre of Mass, admittedly for not a particularly good reason, but this still feels like a valid question even if that was an option - what if you want to rotate around two different points.


texts: The game I'm creating is a bullet hell game, so there can be quite a few objects on the screen at any given time. It probably maxes out at about 40 enemies and 200 or so bullets. That being said, I'm splitting up the playing field into a grid for my collision checking. Right now, it's only 8 cells. How many would be optimal? I'm worried that if I use too many, I'll be wasting CPU power. My main concern is processing power, to make the game run smoothly. RAM is not a big concern for me.


texts: I understand that a wave bank is a collection of .wav data files and that a sound bank is a collection of tracks, each having a .wav with properties. But what is a cue?


texts: Getting world space vertex coordinates in Unity

texts:
I'd like to get world space coordinates for a specific mesh vertex. Transform.TransformPoint() seems to be what I need however I'm unable to get the correct position.

In the scene I have an object called "head" at Pos (0, 0, 0) Scale (0.03, 0.03, 0.03) and I'm trying to get the position of vertex id 590 in order to spawn another object at that specific location.

Mesh mesh = GameObject.Find ("head").GetComponent<MeshFilter>().mesh;
Vector3[] vertices = mesh.vertices;
Vector3 newPos = transform.TransformPoint (vertices [590]);
Debug.Log (newPos);

The value of newPos is not on the head object.


texts: Why specular reflection work only in center of virtual scene?

texts:
How to calculate this cpecular reflection?

HLSL

void calculateSpecular(
    in float4 Normal,
    in float4 SunLightDir,
    inout float4 Specular
){
        Specular = specularLevel * pow(saturate(dot(reflect(normalize(abs(eyePosition)), Normal), SunLightDir)), specularExponent);
}

/// in pixel shader
float4 Specular = float4(0.f,0.f,0.f,1.f);
calculateSpecular( input.normal, -sunLightDir, Specular );

///sunLightDir it's just camera position + vec3(0,10,0)

/// in vertex shader
output.normal = mul( float4( input.normal, 0.f ) , World );


texts: Why do RPGs let you know how much XP you need to level up?

texts:
I was reading this article called Behavioral Game Design, and it says:

  ...how do we make players maintain a high, consistent rate of activity? ... the answer is a variable ratio schedule, one where each response has a chance of producing a reward.

RPGs (I'm thinking of traditional JRPGs like Final Fantasy 1-6) don't do this when it comes to leveling up characters.  You can always pause the game and look at how much XP you need to level up again.  I haven't played WoW before, but I suspect it lets you know how much XP you need to level up, too.  In WoW, there's plenty of examples of "variable ratio schedule" elsewhere in the game, so why not when it comes to XP you need to level up?

I suspect most professional game designers know the lessons in this article.  So why is it typical for the XP you need for the next level to be known?  They could design the game so that it's random, where you never know how many enemies you need to kill for that next level.  So why don't they use this as an opportunity to have a "variable ratio schedule"?


texts:
Can HTTPS webserver host an HTML page that uses JS to connect with secured web socket protocol multiplayer game just like node js?
If so point me in the correct direction to read more.


texts: Is a game's world-wide visibility in app stores affected by the publisher's country of residence?

texts:
I've noticed on Apple Store (and I assume on Google Playstore too) I find different games and apps in France than in the US. Does this mean if my company resides in a small country and I register my game in this country, it'll only be shown to users of my country? Or is it just a matter of some settings and I can decide to be shown all around the world, for instance for American users (which is a larger market than my country), same as game producers living there?

Does a game developer's country of residence influence how many downloads world-wide he can reach at all?

My question is about Apple Store and Google Playstore, but answers for other platforms are welcome too.


texts: Can I rely on SoundEffects being stopped when unloaded?

texts:
I am using XNA's SoundEffect class to play sounds. I have to unload all sounds from the corresponding ContentManager for technical reasons, while some of them are still playing.

What happens to sounds that are still playing (via SoundEffect instances) when being unloaded? It seems that they just stop abruptly. Is this a deterministic behaviour I can rely on? Can it cause any errors when unloading sounds that are currently playing?


texts: Applying texture inside of an Icosphere?

texts:
I have implemented a code to generate an Icosphere procedurally in Unity 5.3.4f, which works pretty well. However, what I need to do know it tweak the code to make the sphere to receive texture only in its inside triangle-faces, not outside. Searching trough the Unity forums, many have said that it's simply the case of flipping the normals of all triangles (i.e. multiplying them by -1). I tried it and it is not the case.

What is the correct way of changing the triangles (not trough shaders) so the Icosphere mesh can only be textured inside (e.g. in a skydome)?

EDIT: After Kromster's answer, I did some research and ended up implementing the following code:

Mesh InvertMeshFaces(Mesh _mesh)
{

    //Flip the triangles
    int[] triangles = _mesh.triangles;

    int numtriangles = triangles.Length / 3;
    for (int t = 0; t < numtriangles; t++)
    {
        int temptriangle = triangles[t * 3];
        triangles[t * 3] = triangles[(t * 3) + 2];
        triangles[(t * 3) + 2] = temptriangle;
    }

    //reseting the UV
    Vector2[] uvs = _mesh.uv;
    for (int uvnum = 0; uvnum < uvs.Length; uvnum++)
    {
        uvs[uvnum] = new Vector2(1 - uvs[uvnum].x, uvs[uvnum].y);
    }

    //reseting normals
    Vector3[] normals = _mesh.normals;
    for (int normalsnum = 0; normalsnum < norms.Length; normalsnum++)
    {
        norms[normalsnum] = -norms[normalsnum];
    }

    //setting the new values of triangles, normals and UVs
    _mesh.triangles = triangles;
    _mesh.uv = uvs;
    _mesh.normals = normals ;

    return _mesh;
}

So far, it works only partially. Applying that function to my Icosphere mesh, now it is possible to see the sphere rendered when camera is inside it. However, oddly enough, it's still also possible to see the sphere from outside. It means, both inside and outside are visible - the outside is not culled as expected.


texts:
Projection matrix? Renderer? Where is the error?
I recently started studying NDK to create better performing android games ... but ... An error I didn't expect to deal with appeared a few weeks ago

The projection works perfectly on my device if I ignore some errors in the depth test
On my device:

On my device.gif because yes:

But...
You must ask yourself what is the impossible mistake of this noob, right?
Let's look at another device with similar specifications:

Only the cube has disappeared ... the text works and the only difference between them is the projection.

Is it possible for a matrix4 to work only on specific devices?

On some devices the cube appears after clicking on the screen even though it is not related to rendering "with many
depth glitch's"
Device 1

Device 2

My projection:
    auto fd =(float)( 1.0 / tan((fovy * (PI / 180.0))/2.0F));
    float a1 = (far+near)/(near-far);
    float a2 = (2* far * near)/(near-far);

    val[M00] = fd/aspectRatio;
    val[M01] = 0;
    val[M02] = 0;
    val[M03] = 0;

    val[M10] = 0;
    val[M11] = fd;
    val[M12] = 0;
    val[M13] = 0;

    val[M20] = 0;
    val[M21] = 0;
    val[M22] = a1;
    val[M23] = a2;

    val[M30] = 0;
    val[M31] = 0;
    val[M32] = -1;
    val[M33] = 0;

How I use it:
projection->setToProjection( 0.0f, 200.0f, 75.0f, 1.0f);


texts: Game Design. Question about balance progression

texts:
Playing in the main mode, the player receives Glory for victory, and for defeat, loses it. When the player reaches the required number of Glory, he moves to the next League. There are N Leagues in the game.
Each League has a recommended Promotion (level) of the Hero. When a player has a Hero's Promotion below the recommended one, he loses more often. The Hero has K Promotions.
And Quastion
Player must complete N Leagues for 360 days. How can i reach this?


texts: How can I make sure my game runs on older GPUs than mine?

texts:
My game must stay at 75fps to be playable (I'm developing for the Oculus Rift) and I'm optimizing with that hardware in mind.

My mid-range Nvidia GTX 650 Ti struggles a little with some Rift demos, but most do OK at medium-low graphics settings. I believe it's a reasonable optimization target if I want to enable more people to play my game.

Now, I've acquired a better-performing GTX 970, but I'd like to still optimize for older hardware. I don't want to be spoiled by my current better performance and develop something that could run only on high-end cards. In a few days, I won't have my old card available to me anymore.

While developing, how can I test if my game still runs at acceptable frame rate on older GPUs?

What I have in mind is to benchmark my GTX 650 now with some software, then underclock my GTX 970 until I get to the older card benchmark score. Is that a good approach? Would it effectively have the same performance?

If yes, what about memory and shader clocks? How can I objectively benchmark them separately?

(If relevant, I'm using Unity and Unreal Engine 4.)


texts: Dynamic chunk loading with high FPS. But still chops

texts:
I am creating a voxel world, (like any other person), but I currently have a small performance hit when loading/unloading chunks.

Right now I can load and unload chunks dynamically with "infinite" type world. I am using VBO's to store chunk data with float buffers. Also, (my big point), I am using Greedy meshing to only render the edges I need. My only thought of why it's not loading well is that I am using SSAO shading, which should have a hit on my FPS, but my FPS stays in the high 200's. Also, I am using frustum culling and normal culling. What I want is the player to have a really large render distance without actually rendering the chunks until the player is close. Almost like fog but instead of covering up unloading, it's actually reducing the detail as you move away.

Also, when a player creates a voxel or destroys a voxel (basically any change in the chunk) it saves the chunk to a file in the corresponding world folder.

Any ideas?

Here is a video of the game in its' current stage.

Here's a screenshot with a far render distance. Anything with a render distance that is far, hits the performance BAD


texts: How can I draw dashed or dotted lines with a pixel shader?

texts:
I am trying to draw the 2D graphics (like line, polyline, polygon etc.) using Direct3D for drawing I am using LINE_LIST. Now I want to make the lines thicker and apply patterns to the line as described here.

I am able to draw the thick lines using a geometry shader to draw a quad but to apply patterns I need to write a pixel shader that will do all the stylization of line that is which fragment should be drawn and which fragment of line should be left behind.

I would really appreciate if, anybody could help in writing the pixel shader or provide me any reference to write it.


texts:
First of all, I have done some research on this topic before asking, and I'm asking this question as a mean to get some opinions on this topic, so I don't make a decision only on my own, but taking into account other people's experience as well.

I'm starting a 2D online RPG project. I am using SFML for graphics and input and I'm creating a basic game structure and all for the game, creating modules for each part of the game.

Well, let me get to the point I just wanted to give you guys some context.

I want to decide on how I'm going to work with collision detection. Well I'm kinda going to work on maps with a tile map divided in layers (as usual) and add an extra 2 layers - not exactly in the map - for objects. So I'll have collisions between objects and agents (players - npcs - monsters - spells etc) and agents and tiles. The seconds one can be easily solved the first one need a little bit of work.

I considered both creating a basic collision test engine using polygons and a quadtree to diminish tests since I'm going to be working with big maps with lots of objects - creating both a physical and graphical world representation. And I also considered using a physics engine like Box2D for collision tests.

I think the first approach would take more work on my part but the second one would have the overhead of using a whole physics engine for just collision detection and no physics.

What do you guys think ?


texts:
I have a set of squares (pixels coming in from an image) that I want to triangulate.

I narrowed my choices down to 2 possible routes:

A, breaking the squares into lager rectangles, or
B, generating a set of vertices and triangulating them.

B is better, as it generates fewer vertices.

I'm dumb, and couldn't find a way to implement route A. But oddly enough, I found it simpler go with route B and generate the vertices. I'm checking neighbor pixels and using a simple lookup table to determine where to place a vertex. That is done and easy.

But with that collection of vertices, I'm stuck. It might contain holes, or be composed of multiple islands of polygons. So from there, I don't know where to go. Any ideas?

Also, if it makes any difference, I'm using these triangulated images to build up a voxel mesh, marching through the voxel data in 6 directions and looking at it in cross sections. At the end, I'll piece them all back together. It's kind of similar to the "trixels" used in Fez.


texts: How to move an object while the animation is going on?

texts:
I added a jump animation with the character in unity and to move the character I have some code like this:

if (Input.GetKeyDown(KeyCode.Space))
    {

        transform.Translate(Vector3.forward * 1 * jumpSpeed);
        Anim.SetTrigger("is_jumping");
    }

But here the character first moving its position (like a glitch) and then doing the animation. How can I make them happen at the same time?