texts: Is it possible to index different vertex attributes with different index buffers?

texts:
Let's say I've got a vertex which is part of many triangles. I can just reference those with an index buffer.  But is it possible to share it's position but have different texture coords for each triangle?  e.g.

+--+--+
|\ |\ |
| \| \|
+--X--+
|\ |\ |
| \| \|
+--+--+

The center vertex, X, is shared. If I want each square to have a different texture then I would need to store four distinct UV coordinates for the centre vertex.  Is this only possible by creating it four times?


texts: How to use SDL_RWops and SDL_RWseek to read text files, line by line?

texts:
I'm right now looking for alternative ways to read text files on a line-by-line basis, for cross-platform compatibility (Windows / Linux).

My current solution is to go look for (or seek out) the newline (line break) in a text file using SDL2.

To demonstrate, I have a simple text file, with just 2 lines of gibberish text:

Hello world,
This is a new line with a line break.

On some text editors, you are able to display newlines or line breaks, and the above text would look somewhat like this:

Hello world,↵
This is a new line with a line break.

I want to use SDL_RWops, and if possible, use SDL_RWseek, or (SDL_RWops*)->seek(SDL_RWops*), to find the newline (line break), denoted by ↵ in the above example. That way, I can write a shorthanded version of SDL_RWreadToLine or some method that allows me to fetch text, line by line.

I believed the current method is very inefficient to check to see if I reached a newline, using psuedo-code:

//File reading/writing (We're only going to read)
//edict2 is a gigantic UTF-8 Japanese <-> English dictionary text file.
//That text file is useful for text operations (read/write) testing purposes.

SDL_RWops* edict2 = SDL_RWFromFile("edict2u", "r");         //The "u" stands for UTF-8 compatible.
if (edict2) {
    Sint64 currentBytePointer = 0;              //Holds the current pointer.
    Sint64 currentReadPointer = 0;              //Holds the current read pointer.
    Sint64 fileSize = edict2->size(edict2);     //Grabs the file size of the file.
    char* buffer = new char[256];               //Some buffer to capture the read text characters.
    while (currentBytePointer < fileSize && currentReadPointer != 0) {
        Sint64 length = edict2->seek(edict2, 1, RW_SEEK_CUR);       //Reads 1 byte from current read position.
        Sint64 temp = edict2->read(edict2, buffer, length, length); //Implicit C conversion from void* to char*.
        if (buffer[0] != '\0' && buffer[0] == '\n') {
            //Found, do something about it
        }
    }
    delete buffer;
}
else {
    //File doesn't exist, do nothing.
}

I'm sure there are bugs that I may have missed out on, considering that I'm reading from a text file that may contain multiple bytes.

And that's why I wanted to look for SDL2 alternatives.

Does anyone know of a better way to read text line by line using SDL2?


texts: How can I change the appearance of the mouse cursor in libGDX?

texts: How can I change the mouse a cursor to a picture using libGDX?


texts: How do you replace a tile in a Tileset in TILED without destroying entire map?

texts: I want to make an early version of a map for my game but then I want to be able to change some of the tiles for new and improved ones without destroying my entire map...is this possible?


texts: SDL.NET no longer detecting modifier keys

texts:
I'm using SDL.NET with C#.
Recently, a bug has appeared where the library does not detect if the shift key is held down; although it used to do so.

private static void KeyboardEventHandler(object sender, KeyboardEventArgs args)
    {
            case (Key.Comma):

                if (args.Mod == ModifierKeys.LeftShift || args.Mod == ModifierKeys.RightShift || args.Mod == ModifierKeys.ShiftKeys) { actionBuffer = GameAction.MoveU; Console.WriteLine("Going up..."); }
                else { actionBuffer = GameAction.Pickup; }
                break;

            case (Key.Period):
                if (args.Mod == ModifierKeys.LeftShift || args.Mod == ModifierKeys.RightShift || args.Mod == ModifierKeys.ShiftKeys) { actionBuffer = GameAction.MoveD; Console.WriteLine("Going down..."); }
                else { actionBuffer = GameAction.Wait; }
                break;

            default:
                actionBuffer = GameAction.Null;
                break;
        }
    }

However, recently, the checks to see if a shift key is held have returned incorrectly false, despite previously previously evaluating to true.

This means the function never returns the "MoveU" or "MoveD" values, just the "Pickup" and "Wait" values.
Why is this?
Thanks in advance.


texts: Start Countdown on Resuming Game (Unity)

texts:
I am pausing game by setting Time.timeScale to 0. And When the Game resumes Time.timeScale is set to 1f again, and game resumes. Now I want to add timer before actually resuming game. It shows 3,2,1,Go and player starts running. But problem is that It is not counting as Time.timeScale is set to zero. And if i set Time.timeScale to 1, the player starts running immidiately and countdown also starts perallaly. Actually I want to start countdown first and then to resume game. I've added the code below, that i've used. The game and timer both is activated perallally by following code.

IEnumerator WaitToResumeGame()
{
    for (int i = 0; i <= 3; i++) {
        yield return new WaitForSeconds (1f);
        TimerText.GetComponent<Text> ().text = "" + i;
    }
    TimerText.SetActive (false);
}

public void ResumeGame()
{
    pausePanel.SetActive (false);
    TimerText.SetActive (true);
    Time.timeScale = 1f;
    StartCoroutine (WaitToResumeGame ());
}


texts: I am trying to find a way to create a Wii game using SDL2, but I can't find any tutorials on how to do it. How can I use SDL2 to build and privately distribute a Wii game without hacking/modding the Wii?


texts: I've been writing my own engine with C++ and DirectX 11. I've got 3d models loaded in with diffuse maps, normal maps, and shadows. There's other things with the engine but my question doesn't pertain to those parts. What estimated framerate should I be getting from a simple cube with all the maps on it. And a moving shadow? Obviously my computer specs make the biggest difference. But lets say anywhere from Nvidia 500 series to 700. Personally I have a GT 750m. So whats a rough estimate of framerate to be getting? Dont want to keep building something that has a major framerate flaw.


texts:
Let's say I have a bunch of points:

What is the best way to get a certain amount of closest neighbors.
For example I wan't the 8 closest points for point no 57.

This without using brute force.

O yeah, if possible, it would be great if it's efficient for moving points as well.


texts: DirectX9 rendering missing in Release Build

texts:
I have a c++ application which outputs to screen using entirely DirectX9, running on Win7 64 Home.

It runs as normal in these circumstances:

Debug Build, from within MSVC 2008.
Release Build, from within MSVC 2008.
Debug Build, by opening the compiled
executable itself.

However, strange things happen when I run the compiled executable of the release build. The window is created as expected but no screen output. Nothing.

I can hear the sound working and the log file fills up. I thought maybe the working directory was wrong when running the executable but the log file reports the CWD is correct and indeed all filepaths to data files work.

I am stumped as to why my application will work fine in 3 of the four permutations, but not the most important one - the standalone release executable!

If anyone can contribute, I'd be most grateful.

Thanks

Si


texts:
I'm having weird performance problems with a GLSL shader I'm working on. This small example fragment shader:

#version 450
out vec4 fragColor;

struct ST { float a; float b; float c; float d; float e; };

void main() {
    ST s = ST (0.0,0.0,0.0,0.0,0.0);
    ST[1] stack;
    int ptr = 0;
    for (int i = 0; i < 32; i++) {
        if (i > -1) // Always true
            stack[ptr++] = s;
        s = stack[--ptr];
    }

    fragColor = vec4(1.0);
}

has horrible performance, but the same shader with almost anything taken out, for example, removing e from the struct, performs fine. I'm just using these on a fullscreen triangle.

I can't figure out what's going on, and how I could fix this problem in my actual shader. Any ideas?


texts: Importing z-brush cube to 3ds max causes shadow issues

texts:
I have created cube model in z-brush then I exported it to .obj format. Seems vertex count is the same as in 3ds max as in z-brush.

In all my viewports I see cube, but in perspective I see not a cube but some like "extra shadows" on the each side of cube, like cube has not plane sides.

When I render it it also has not plane sides and some ugly shadows. How can I fix it, maybe I should know some tricks about it.


texts: Flatten transform hierarchy at build time

texts:
Nested hierarchies cause a performance overhead when they include moving objects.

  Every time a GameObject moves, altering its transform, we need to let every game system that might care about this know. Rendering, physics, and every parent and child of the GameObject needs to be informed of this movement in order to match. As the scope of a game increases, and the number of game objects skyrockets, just the overhead of sending out all these messages can become a performance problem.

However, nested hierarchies are useful in organising a scene and keeping logical groups of gameobjects separate.

What options exist to save performance whilst keeping the hierarchy?  Is there any pre-existing solution to flatten a hierarchy when building only?


texts:
I am trying to implement checkCollision function in my game, I used AABB method but the problem is that my sprites are rotated so it's not really precise. I could finely describe my Sprites with rotated ellipses. Is there any more precise way of detecting the collision if I have the following attributes of entities:

entity.x
entity.y
entity.width
entity.height
entity.angle

Here is what I have coded so far (x and y are in the middle of my sprite):

this.checkCollision = function(entity1, entity2) {
  return (entity1.x - (entity1.width*this.COLLISION_EPSILON_WIDTH)/2 < entity2.x + (entity2.width * this.COLLISION_EPSILON_WIDTH)/2 &&
   entity1.x + (entity1.width*this.COLLISION_EPSILON_WIDTH)/2 > entity2.x - (entity2.width * this.COLLISION_EPSILON_WIDTH)/2 &&
   entity1.y - (entity1.height*this.COLLISION_EPSILON_HEIGHT)/2 < entity2.y + (entity2.height*this.COLLISION_EPSILON_HEIGHT)/2 &&
   (entity1.height*this.COLLISION_EPSILON_HEIGHT)/2 + entity1.y > entity2.y - (entity2.height*this.COLLISION_EPSILON_HEIGHT)/2)
}

PS: my cousin told me to do it with three circles (which creates a shape very similar to the ellipse) but I do not really know how to do it.


texts: Is there a way to create steam beta branches automatically

texts:
OK, here I have a situation.
We are developing a game and our CI is building many branches for it -- "megafeature", "releaseittomorrow", "hotfix-to-test" et cetera. Of course names of these branches differs in time.
Every branch is uploaded into steamworks beta branches with the same name, but I have to create this branch in admin panel manually.
Is there a way to create steamworks beta branch automatically? Something like
steamcmd +login MyLogin MyPassword +create_beta_branch my_another_feature +exit

?
I've looked through official documentation and found nothing. Maybe I looked in a wrong place?


texts: I am working on generation 3d perlin noise. The C# Math library seems like overkill for what I need since most of its functions use double percision. I use Math.Sin() in several places to generate the noise. Does anyone know of a faster sine function?


texts:
I'm using C#/XNA and have been told quite a few times not to mix update code with draw code -- and I'm certain I'm not! But could anyone please describe what exactly is 'logic code'?

As seen here: http://blogs.msdn.com/b/shawnhar/archive/2007/07/25/understanding-gametime.aspx

  [...] make sure you put all your game logic inside the Update method (not in Draw!) and everything will run at a nice constant speed.

I'm asking this since my game's speed is fluctuating relative to the FPS. Slow FPS equals slow-moving objects and visa versa. And yes, I am including the expected position += speed * (float)gt.ElapsedGameTime.TotalSeconds; code.

This is probably a big rookie question, but I just want to be absolutely clear on the definition of this.


texts: "Render" unsigned integer values to texture without clamping to [0,1]

texts:
I am trying to render to an unsigned integer texture, with a blending function enable, so that in the end, the value in each texel will be the number of objects rendered on the texel.  So I assume I cannot use normalized integers.

For example, if I have a 2x2 texture, and I render [ (0,0) (0,0) (0,1) (1,0) ], the texture result should be, [ 2 1 ; 1 0 ].

I am trying to set up the frameBuffer, but the call to glTexImage2D, causes the GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT when I use the formats I assume I need.

// this works
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1024, 768, 0, GL_RGB, GL_UNSIGNED_INT, 0);

// this causes GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT
glTexImage2D(GL_TEXTURE_2D,
             0,
             GL_RGB32UI,
             width,
             height,
             0,
             GL_RGB_INTEGER,
             GL_UNSIGNED_INT,
             0 );

Is what I want to do even possible?  If so, which settings do I need to use to accomplish this?


texts: jsonutility doesnt exist in the current context

texts:
I am working on converting a string into json format and sending the json formatted data to the server.Everything is working fine. I tested the project and exported the project.Current version of Unity I am using is Unity 5.3.5.

the problem is that when I imported this project package in Unity 4.7. Iam getting an error

"The name "JsonUtility" does not exist in the current context"

How can I resolve this issue by replacing with other function so as that get worked with Unity 4.7

Here is piece of code is used for converting into json format

  using UnityEngine;
  using System.Collections;
  using LitJson;
  //using SimpleJSON;

  using System.IO;
  public class JsonScript : MonoBehaviour {
  JsonData json;
  void Start()
   {
    Data1 data = new Data1();
    data.command = "state";
    data.payload = new Payload1() { text = "wwwwwww", image = "hello" };
    string json = JsonUtility.ToJson(data,true);
    P(json + "\t\n");

    }

// Use this for initialization
void P(string aText)
{
    print (aText +"\n");
}

 }

 [System.Serializable]
 public class Payload1
 {
    public string text;
    public string image;

   }

   [System.Serializable]
    public class Data1
     {
      public string command;
     public Payload1 payload;
     }


texts: Material slot is reversed in unity when importing .blend file?

texts:
I'm importing .blend file into unity. The file contains 9 separate objects. Now all objects have the same 2 materials assigned. When importing in unity one object's material slot is reversed. But in blender I set the slots correctly.

Slot in blender

Slot in unity

This is only happening for one object (Curve.076).
This is important for me as I am assigning the material from code to each slot.
Here's the .blend file if you want to look at it. Download

New Update:

Okay so playing with the object for some time I found that the problem is with only related to one face.
In the picture below see the white face between blue faces, if leave the face like this than the slot in unity is
not reversing. But if I assign the face to the inside.004 material than the slots are reversing.
I tried delete the face and again filling the area. But same result. I have to make the face same material as the upper
part to not get the problem, which I don't want. Only work arround I can use currently is that extruding the face little
forward and assinging the material to it, which is not very neat. I might be missing something as I am not very good at
blender.

Unity 2018.3.4f1

Blender 2.79b


texts: LibGDX--constant high score in top corner

texts:
I'm currently programming a game using LibGDX and box2D. I have a sprite (player) that moves up the screen, kind of like doodle jump.

I'd like to have my camera to be centered around the player at all times--the sprite will be in the center of my screen as they move up, or as they fall down.

I'd also like to have a high score panel that is always at the top left corner of the screen.

As of now, I have this done, to an extent. As long as the player doesn't move to far up the screen at a time, it will remain centered, and the high score will generally be in the top. Sometimes it'll move off the screen, but it will come back as the player falls down.

Most of my confusion lies from the LibGDX coordinate system, so if you could explain that, that would enhance my understanding of the problem.

Here is the code I have:

//Access the world's reference to Player, and update the position of it's sprite with respect to the body
  world.getPlayer().updatePosition();
  world.getBlock().updatePosition();

  //Have the camera follow the player, but only in the y position
  batch.setProjectionMatrix(camera.combined);
  camera.position.set(camera.position.x, world.getPlayerSprite().getY() - 75, 0);
  camera.update();

  //Begin batching sprites here. This will include blocks and the player
  batch.begin();

  debugMatrix = batch.getProjectionMatrix().cpy().scale(100f,
        100f, 0);

  //Render the Player sprite here
  batch.draw(world.getPlayerSprite(), world.getPlayerSprite().getX(), world.getPlayerSprite().getY(),world.getPlayerSprite().getOriginX(),
        world.getPlayerSprite().getOriginY(),
        world.getPlayerSprite().getWidth(),world.getPlayerSprite().getHeight(),world.getPlayerSprite().getScaleX(),world.getPlayerSprite().
                getScaleY(),world.getPlayerSprite().getRotation());
  batch.draw(world.getPlatformSprite(), world.getPlatformSprite().getX(),
          world.getPlatformSprite().getY(),world.getPlatformSprite().getOriginX(),
          world.getPlatformSprite().getOriginY(),world.getPlatformSprite().getWidth(),
          world.getPlatformSprite().getHeight(),world.getPlatformSprite().getScaleX(),
          world.getPlatformSprite().getScaleY(),world.getPlatformSprite().getRotation());
  batch.draw(world.getBlockSprite(), world.getBlockSprite().getX(),
          world.getBlockSprite().getY(),world.getBlockSprite().getOriginX(),
          world.getBlockSprite().getOriginY(),world.getBlockSprite().getWidth(),
          world.getBlockSprite().getHeight(),world.getPlatformSprite().getScaleX(),
          world.getBlockSprite().getScaleY(),world.getBlockSprite().getRotation());

  Gdx.app.log("Position", "" + camera.position.y + " " + world.getPlayerSprite().getY() + " " + (camera.position.y - 275));
  font.draw(batch, "Score:" + (int)Math.ceil(22-world.getPlayerBody().getPosition().y), 0, camera.position.y - 275);

  batch.end();


texts:
Suppose I have 2 IMUs that output 2 quaternions.

I place one IMU on my left hand and another one on my right hand.

I put both my hands flat on the table and point it forward to the same direction. What I expect is that they should give very similar quaternion. But it turns out that the IMUs reading differs about 10-20 degrees around the Y axis when plotted in Unity3D.

This means I cannot just apply the quaternion to the hand model inside Unity directly. I need to know the exact offset of this 10-20 degrees error in order to make the hand model point in the same direction.

How do I figure out this offset automatically? Or is there another way that I can align both IMUs? How do people deal with this IMU problem?

PS. Putting the IMU on the hand is just an example. I can put them both directly on the table near each other and they still give slightly different quaternions.


texts:
So I have a CCSprite subclass, well call this Spaceship. Spaceship needs to move on a loop, until I say othersise by calling a method. The method should look something like

- (void)moveForeverAtVelocity
{
  // method logic
}

The class Spaceship has two relevant iVars, resetPosition and targetPosition, the target is where we are headed, the reset is where we set to when we've hit our target. If they are both off-screen this creates a permanent looping effect.

So for the logic, I have tried several things, such as

CCMoveTo *move = [CCMoveTo actionWithDuration:2 position:ccp(100, 100)];
CCCallBlockN *repeat = [CCCallBlockN
  actionWithBlock: ^(CCNode *node) {
    [self moveForeverAtVelocity];
}];

[self runAction:[CCSequence actions: move, repeat, nil]];
self.position = self.resetPosition;

recursively calling the moveForeverAtVelocity method.

This is psuedo-code, so its not perfect. I have hard-coded some of the values for the sake of simplicity.

Enough garble: The problem I am having, how can I make a method that loops forever, but can be called and reset at will. I'm running into issues with creating multiple instances of this method. If you can offer any assistance with creating this effect, that would be appreciated.


texts: Math behind simulating a simple light source for rotated rectangle?

texts: Say I have a 2D Rectangle. By offsetting its position by x y and rendering a shadow by an offset, it gives the illusion of a shadow. If I rotate the rectangle Z degrees and try it with the same offset, it appears as though the light source has moved. How can I compensate for the angle so it appears as though the shadow is always coming from the same direction?


texts: How can I convert a mouse click to a ray?

texts:
I have a perspective projection.  When the user clicks on the screen, I want to compute the ray between the near and far planes that projects from the mouse point, so I can do some ray intersection code with my world.

I am using my own matrix and vector and ray classes and they all work as expected.

However, when I try and convert the ray to world coordinates my far always ends up as 0,0,0 and so my ray goes from the mouse click to the centre of the object space, rather than through it.  (The x and y coordinates of near and far are identical, they differ only in the z coordinates where they are negatives of each other)

GLint vp[4];
glGetIntegerv(GL_VIEWPORT,vp);
matrix_t mv, p;
glGetFloatv(GL_MODELVIEW_MATRIX,mv.f);
glGetFloatv(GL_PROJECTION_MATRIX,p.f);
const matrix_t inv = (mv*p).inverse();
const float
    unit_x = (2.0f*((float)(x-vp[0])/(vp[2]-vp[0])))-1.0f,
    unit_y = 1.0f-(2.0f*((float)(y-vp[1])/(vp[3]-vp[1])));
const vec_t near(vec_t(unit_x,unit_y,-1)*inv);
const vec_t far(vec_t(unit_x,unit_y,1)*inv);
ray = ray_t(near,far-near);

What have I got wrong?  (How do you unproject the mouse-point?)


texts: How to access multiple 2DTexture which is assigned in Unity3D inspector panel created by an array in C#?

texts:
I am making a puzzle game, i made 5X5 cube, lets take example of orange. very left column is orange, upper with orange dot is static and lower with orange dot is also static. inbetween there are 3 orange tile, if i click on one orange tile color gets change on every click, if i click 5 times, five different color will appear as i told earlier. i want to connect the orange dot with orange tile as shown in figure(mark as tick),

I assined all 5 color texture in array having 1 to 5 indexPointer using inspector panel... All tile has same TagName "CubeTag" but object Name is different for all tile.

my question is how to tell the engine that all 3 orange tile is connected. and print "Orange is Connected"

For Example take orange texture:

I want to make a path of orange ..if I click on 3 orange tile (tick mark)then If indexpointer of OrangePath1 == 3 and indexpointer of OrangePath2 == 3 and indexpointer of OrangePath3 == 3 then print ("Orange connected")

Here is my code for assigning all 5 2dTexture array:

 using UnityEngine;
 using System.Collections;

 public class Raycast : MonoBehaviour
 {
     public Ray ray;
     public RaycastHit hit;
     public Texture2D[] diffuseTextures;
     public int indexPointer = 0;

     void Update()
     {
         ray = Camera.main.ScreenPointToRay(Input.mousePosition);
         if(Physics.Raycast(ray, out hit))
         {

             if(Input.GetMouseButtonUp(0)){
                 if(hit.transform.tag == "CubeTag"){
                     hit.collider.gameObject.renderer.material.SetTexture("_MainTex", diffuseTextures[indexPointer]);
                     indexPointer++;
                     print (indexPointer);
                     if (indexPointer >= diffuseTextures.Length) {
                         indexPointer = 0;
                     }
                 }
             }
         }
     }
 }


texts: How do I get the number of online players in a Minecraft server from outside the client?

texts: I know that the Minecraft client can query the server for number of players and maximum players, even when the server properties has enable-query set to false, but how do I do this outside of the client? I am trying to implement this as part of a mobile (Android) app.


texts: Best way to manage sprite sheets on Android using NME

texts:
I'm creating a 2D game for mobile touchscreen devices, specifically Android and iOS. I would like to know what is the best way (regarding performance and best practices) to manage sprite sheets.

Should I create different sprite sheets (for ldpi, mdpi and hdpi) and then scale according depending on the screen resolution or there is a better solution?.

I know that maybe the solution that someone could provide me would be platform independant but I'm using the NME framework (http://www.nme.io/), perhaps you know a good solution using this framework.


texts: Why do I get 3 lines of log at Monitor.exe when using Debug.Log in Unity?

texts:
I'm debugging a real device.
In a GUILayer.Button I've put a single Debug.Log() message, like in this code

Code:

if( GUILayout.Button( "Click to Test." ) )
{
    Debug.Log( "XAVI Clicked!" );
}

But in monitor.exe I get 3 lines, like the following ones:

To filter out messy messages from other applications, my filter is "tag:unity".
The APK is compiled with Development Build unchecked.

Problem:

I expected to see only one log line, with the text XAVI Clicked! but I also got a blank line and a line referencing a filename that I don't know what is it.

Those 2 lines are a consequence of "logging", not a consequence of "clicking the button", as if I remove my log sentence, then I do not receive my log but also I don't receive those phantom two lines (zero log lines then).

Questions:

Is there any way I get rid of those lines I don't want to see?
Is there any way I can create my own filtering tag inside the Unity?
How do you handle if you want to see exclusively your logs but not "extra logs" placed by the system?
Is there any reason that I should keep watching those lines? Are they carrying meaningful intormation? What do they tell to me that is relevant to me?

Thanks.


texts:
I have created a Grid:

At each point along the grid, is a vertex (Intersection Points):

Each of these points has an x,y,z position. Vector3f(x,y,z). In an attempt to animate the grid into a group of ocean waves, I used this formula to adjust the y position of each “Vertex”:

This is my attempt at implementing the formula into java:

private float sineY(int x, int y, float time) {
Vector2f position = new Vector2f(x, y);
float yPos = (float) ( (2 * amplitude) *Math.pow((Math.sin((wavenumber.dot(position))  + temporal_angular_freq * time +  initiatory_phase) + 1)/2, k));
    return yPos;
}

This function is running from inside a for loop that is updated every ms:

Time ++;
for (int y = 0; y < sizeY; y++) {
        for (int x = 0; x < sizeX; x++) {
            float xPos = x;
            float yPos = 0;
            float zPos = y;
            xPos += 0;
            yPos += sineY(x,y,time);
            zPos += 0;
            waterVertexPos.set(xPos, yPos, zPos);
            vertBufArray[index++] = waterVertexPos.getX();
            vertBufArray[index++] = waterVertexPos.getY();
            vertBufArray[index++] = waterVertexPos.getZ();
        }
    }

As you can see, for each vertex, along the grid, the yPosition of the vertex is set to whatever value the sineY method returns, which is whatever the above formula returns.
Running this code reults in this:

WHEN K = 1.0:

WHEN K = 1.5

As you can see, they both do not follow in accordance with this image here:

All the formulas and graphs have been retrieved from this pdf file. The aim of this program is to simulate water using the presented equations. The pdf is really interesting have a read if you like :)

Source:
http://http.developer.nvidia.com/GPUGems/gpugems_ch01.html

Thank you VERY MUCH for all of your time :)

EDIT:

After implementing the fix suggested by msell. It fixed this previous issue, however a new issue arose when the waves peaks still do not look as they did in the above graph:

WHEN K = 2.0:

The pdf specifies:

A common complaint about waves generated by summing sine waves directly is that they have too much "roll," that real waves have sharper peaks and wider troughs. As it turns out, there is a simple variant of the sine function that quite controllably gives this effect. We offset our sine function to be nonnegative and raise it to an exponent k. The function and its partial derivative with respect to x are.

And then refers to the formula mentioned above, and another formula:

Is there something wrong with my implementation?

And again. I cannot thank you enough for your time :)

Sidney de Vries


texts: Difference between Vorbis OGG and M4A/MP4/AAC?

texts:
From what i know m4a and aac are the same thing with mp4 allowing video while the former only allows audio.

Whats the difference between vorbis ogg and m4a? I looked it up and it seems that m4a/aac are patent free. What are reasons i may want to choose one from the other?

Assume source will always be lossless (wav/aiff/flac) and i am choosing the encoding to distribute with my game/demo


texts: To-hit formula for turn based isometric battle RPG

texts:
I am an amateur using Unity 5 to create the aforementioned type of game. I am trying to write a function to determine whether a close quarters combat(melee) attack lands or not but am extremely terrible at math. How bad? Despite tutoring for 2-3 hours every day after class and doing my homework assignments multiple times for practice even after submitting them, I still failed business calculus 3 times and had to abandon college. Math simply does not click for me. I found a sweet sales job in the booze industry so it's all good though, but I digress. If anyone could humor me and point me in the right direction I would appreciate it. Here are the details, let me know if I'm being inarticulate.

Combat is turn based, in the same vein as Ogre Battle, Heroes of Might & Magic, and Final Fantasy Tactics. Hopefully this gives you an idea of movement and engagement, if not let me know and I'll elaborate with specifics.
Whether or not an attack lands is determined by (what I'll call for simplicity) the two combatants "Weapon Proficiency." This system is based on a 100 percentile system. For Example, if both attacker and defender have a Weapon Proficiency of 50, then the attacker has a 50 percent chance to hit the defender.

My issue is I have no idea how this mathematical function works when weapon proficiencies are of disparate values. For example, if the attacker has a weapon proficiency of 35 and the defender has a weapon proficiency of 85, what percent chance does the attacker have of scoring a hit?

Any help would be extremely appreciated, again forgive me if I'm not explaining the subject lucidly.


texts: 3D title Rendering in Maya For babylon Js Game Engine

texts:
I created a 3D title in Maya and applied color through Lambertian shading and rendering with mental ray.

The problem is when the title is rendered in the game engine, it is looking very sad. The colors are faded also the lighting is not the same as Maya's rendered output.

Please tell me how can I make the in-game version look more like the result in Maya. I saw lots of 3D games whose titles and objects are very beautiful, bright and colorful with lighting.


texts: Character controller collision edge cases

texts:
Im trying to implement a basic 3d character controller. The way i currently do collision is; i check wether or not the character is inside any geometry before movement. If this is the case, i find the closest point of this geometry, and subtract the vector from the character to the point from the characters velocity. This works for some surfaces, but of course has a lot of issues. There are two that i am trying to figure out right now.

If the character moves into a wall and the floor at the same time, it will be moved out in two frames, because they are seperate objects. One way to fix this is to do the check two times, but this amount increases by one for every object the character moves into, and i do not know the amount beforehand.

If the character moves into a v shape, it will bounce back and forth between the two side each frame, because the collision detection moves it into the other side.

Does anyone know how these are commonly handeled?


texts:
I would like to know whys in which one can spawn skateboard under player like we see in subway surfers.

My best two guesses are,
1.Spawnning skateboard and then making it child of player.
2.Changing current child prefab of player with skateboard attached prefab.

With first approach ,its get complicated to know exact character's leg position.

What you think is the best way? if you know any other good way then please mention .

Thanks in advance


texts:
I been currently involved in a game project and we reach the point we're want to added the GUI for menus and other stuff but the time that we maybe spent developing our own system could cost us a bit of time, and this is a part of the system that we don't want to lose too much time.

So, we're reading about some UI Libraries like GUIchan, CEGUI and recently LibRocket which apparently is very flexible and useful, so my question is if Librocket could be integrate with a project develop in SDL/OpenGL in C++? and if you know where to find information about that, because we're unable to find something like that.


texts:
How does a game process cursor movements?
I know it calculates offset from the middle of the screen, but how?
What constraints is that cursor having?
Is it locked to the middle of the screen/a certain area/teleported to the middle of the screen?

Those are my questions.I didn't ask this question for game development(but i didnt find a better subsection for it), as I want to emulate this 'different' mouse input (vs desktop usage) to fix the bug that many remote computer software have(if possible, not sure it is) on linux, by emulating the mouse movement restrictions in a game (agiain, not sure if it's possible).


texts: What's the best way to set up an OpenGL draw loop in windows?

texts:
On mac os x, there's a way to pass the system a function pointer that is triggered at an ideal time to start your drawing code. These are the CVDisplayLink tools.

I'd like to understand how to do something analogous on windows. The ideal solution would:

Call a function I specify after the previous draw loop's data becomes visible on the monitor.
Avoid screen tearing.
Minimize overhead such as #buffers. For example, avoid triple buffering, and possibly even avoiding double buffering if that is possible.

My current setup is to execute a busy loop that constantly calls PeekMessage and starts a draw loop cycle every time there's no message. This is likely to result in more than 60 draw cycles per second, which is wasting CPU effort and results in calculated frames that are never displayed.

The best answer is one that allows me to do this without a third-party library (OpenGL and Win32 are definitely ok!); but it's still useful to know of open source libraries that solve this problem since I can then dive into the code myself.

Related notes: I've seen this stackoverflow page on OpenGL vsync and the the wglSwapIntervalEXT() function. I don't think these comletely solve my problem since the wglSwapIntervalEXT function only delays buffer swaps, and waiting for glFinish ties up my event loop. I've also heard that it's bad practice to call glFinish, and I don't know how it interacts with any buffers and vsync work windows is already doing for me. Maybe they are part of a full solution that I don't know of yet.


texts: How do I get to the Terrain Tools and Advance option in Package Manager in Unity?

texts:
I am not able to find the Terrain Tools option in Package Manager when I search it. I am new to Unity and that's why I was following a tutorial. The video was about building a terrain and there he told to get the terrain tools first.
For the terrain tools we need to go: Window > Package Manager > Packages > All Packages and then search it
But in the Packages I don't have the All packages option and also I don't have the Advance option as told in the video. I am sure that the Unity editor in the video is of an old version. Currently I am using 2020.3.8 version of Unity.
If there are some major changes between that version(used in the video) and my version(2020.3.8) then where do I find the Terrain Tools and the Advance option?
Screenshot From My Computer -

[NOTE: If there are any confusions, please refer the video]


texts: How do I apply different probability factors in an algorithm for a cricket simulation game?

texts:
I am trying to write the algorithm for a cricket simulation game which generates runs on each ball between 0 to 6. The run rate or runs generated changes when these factors come into play like skill of the batsman, skill of the bowler, target to be chased. Wickets left.

If the batsman is skilled more runs will be generated.
There will be a mode of play of the batsman aggressive, normal, defensive. If he
plays aggressive chances of getting out will be more.
If the chasing target is more the run rate should be more.
If the overs are final the run rate should be more.

I am using java random number function for this.
The code so far I've written is

    public class Cricket {

public static void main(String args[])
{
    int totalRuns=0;
  //i is the balls bowled
     for (int i = 1; i <= 60 ; i++)
       {
        int RunsPerBall = (int)(Math.random()*6);
        //System.out.println(Random);
        totalRuns=totalRuns+RunsPerBall;
       }
    System.out.println(totalRuns);
}

    }

Can somebody help me how to apply the factors in the code. I believe probability will be used with this. I am not clear how to apply the probability of the factors stated above in the code.


texts:
I am making a car parking game in flash and AS3 wherein I drive my car along with other AI traffic cars moving along a specified path using Guidelines.
I am using CDK for collision detection.
The collision detection works fine with few AI cars, but doesn't seems to be working as required for few AI cars.
When an AI car is moving on a path in a straight line it works fine.... but when the AI Car turns at 90 degress..... my car goes into the AI car (Overlapping) and it hits at the center of that AI car and then collision is Detected....  .....
I made a New path and used a new Sprite for AI car... but still the problem pursues....

I have attached the png of collision.
https://dl.dropbox.com/u/53998590/Collision.png
The AI traffic comes from Top Left corner and moves down towards
bottom right corner.
The problem persist with this kind of movement.
when I change the movement of same AI cars from bottom right corner
and moves up to top left corner then the problem does not exist.
I had used CDK for collision detection.
my code is as follows.
addCollisonItem(mcAICars);

public function addCollisionItem(mc:MovieClip)
    {
        collisionlist.addItem(mc);
    }

var collArray:Array;
collArray = collisionFunction();

if (collArray.length > 0 && isCarCollided==false && game.stopCar ==false)
        {

            trace("Car Collided");

            isCarCollided = true;
            game.stopCar = true;

            if (speed >= 2) {
                speed = 1.5;
            }

            speed = -speed;

            if (accelerate && isCarCollided)
            {
                //reverse = false;
                speed = -1.5;
                //  return;
            }
            else if (reverse && isCarCollided)
            {
                //accelerate = false;
                speed = 2;
                //  return;
            }

            reduceLife();

            setTimeout(startCar, 500);

        }

Regards,
Amit


texts: Can I put a Creative Commons license on my game?

texts: Title says all, I would like to publish my game under a Creative Commons license. What licenses can I use for a game if any?


texts: Can I change previously unlocked game levels into locked locked by updating game?

texts:
I have 14 unlocked levels in my android game so that the player can play whichever he want. Can I make those 14 levels locked in next update?
Players who previously reached 8th level would have to play from level 1 after the updating game.


texts: XNA Transparency depending on drawing order?

texts:
I am drawing two 3D objects, both of them can fade from opaque to transparent independently, and they can intersect between them (so you cannot say when one of them is before the other one). Look at the image for a better understanding (one of the object is a terrain and the other one an area):

Now, if I apply transparency to both of them, and draw the terrain before the area, the terrain is not transparent respecting to the area, but the area is:

And finally, if I draw the area before the terrain, then the area is not transparent respecting of the terrain:

QUESTION: How can I make all the objects transparent to the rest of objects without depending on the drawing order?


texts: is it possible to generate the walkable area based on an image in a 2D isometric game?

texts:
I have hand drawn isometric background looked at about 35-40 degrees.

How to set walkable areas at such image?

Is it possible to use a black ("not white") and white color map sketch and set white areas to be walkable?

Or is there some other way to do it easily?

On this image, black areas represent walls at some height seen at some angle.

I also have more complex maze-like dungeon drawn:

I have searched quite some time but didn't find some satisfactory answer specific to my need.


texts: 2D converting absolute top-down coordinates into relative third-person coordinates

texts:
I'm working on 2D top down zombie game. I started working on it as having a static 2D map and on every tick you update the coordinates of every object, including the player itself relative to the static map. Every object has x, y and angle against x axis x, y, theta.

But I would like to also provide a way to see it as a kinda third-person shooter (still top down 2d just different center of coordinates), where camera and coordinates are connected to the moving player object. So the player would always have the 0, 0, 0 coordinates and every other object transformed xT, yT, thetaT coordinates.

What approach should be used in such cases? Should I still keep the static coordinates and simulate the world over a static map, and then transform the coordinates of every object into relative coordinates? So every tick there will be two transformations - world simulation and static -> relative coordinate transformation?


texts:
Introduction

This is less of a "how to" on using 2D simplex noise and more of a quest to understand what is happening both in the math and visually. I would rather not copy and paste the code I've found. I really would like to understand it.

I have done my homework on the subject and have read through Stefan Gustavson's paper and other sources many times. I feel like I understand about 70% of what my sources are saying, but when I try to manually follow my code loop through to check my understanding I either get hung up on what the variables represent or the math just doesn't add up.

I have begun to rename the variables in the code I've found in order to better understand what's going on. If someone with some knowledge of what is actually happening can cross reference the original code (basically Gustavson's code) with my code that would be most excellent. I'm not actually done with renaming the variables though, partly because I'm stuck.

My Understanding

Let's say I pass pixel (2, 3) into my noise function. At this point I'm working with a normal grid and my goal is to translate this normal grid into a simplex. This simplex is in the form of many triangles since we're working in 2D and supposedly this is better for various reasons.

To translate this point from the normal grid to the simplex grid, I must scale the point along the main diagonal line. After doing that, I apparently don't care about the decimals because I then Floor the results putting it back near the closest previous grid point.

Now I'm going to align the simplex cell to the normal grid by unskewing the simplex cell. Why I do all this work to get to the simplex cell, then undo it I'm pretty hazy on. Seriously, I think the best way for me to understand this is if someone could whiteboard out in steps what the heck is going on here. Super lost.

I didn't walk away empty handed though. I now have what I believe to be the distance between the original grid point I passed in and the simplex point I translated from that original grid point. Woo.

I think I'll stop here for now, just because I don't want this to turn into a huge wall of text. I'm pretty sure the rest of this will click once I understand the the beginning part.

Weird Math

Using the (2, 3) point from earlier, this is what I get by stepping through my own code on paper:

x = 2
y = 3

skewfactor = 1.830
unskewFactor = 1.479
unskewed_x = 1.520
unskewed_y = 2.520
simplexCell_i = 3
simplexCell_j = 4
x_distance0 = -1.520
y_distance0 = -1.520
i1 = 0
j1 = 1
x1 = -1.309
y1 = -2.309
x2 = -2.5207
y2 = -2.5207
ii = no idea why this isn't i2 or something like that. No idea what this is.
jj = same

Not sure if plotting on a graph would work, but I tried and it looks so bad. I used the original parameters (2, 3), simplexCell_i & j, i1, j1, x1, y1, x2, and y2. Doesn't make any sense visually.

Not just visually, but mathematically as well. What's with (2, 3) returning negative numbers that go off the chart? What am I doing wrong here?


texts:
I am trying to get a good camera recoil system in Unity, but what I have tried so far doesn't seem to look very good. My current method, is using Quaternion.Lerp. With the way I have my shooting system set up, the camera recoil going up all happens within one frame, so when you shoot faster, it tends to look choppy, whereas the recoil going back down is smooth and normal. My question is, is there a better way to handle the camera recoil, while keeping the same look and effect, but having it look much more smooth? I have a quick video to show how the camera recoil looks (watch as the camera moves upwards)
https://www.youtube.com/watch?v=HsS0rtoj9l4

And here is the part of my code that handles the camera recoil

void Update () {
    Recoil2();

    Vector3 cameraRecoil = weaponSettings.CurrentWeapon.cameraRecoil;
    Transform cameraClimb = generalSettings.cameraClimbHolder.transform;
    string fireMode = weaponSettings.CurrentWeapon.fireMode.ToString();

    if (fireMode == "Semi")
        if (Input.GetButtonDown("Fire1"))
            Shoot();
        else
            CameraRecoil1 = Vector3.Lerp(CameraRecoil1, new Vector3(0, 0, 0), Time.deltaTime * cameraRecoil.z / 10f);

    if (fireMode == "Auto")
        if (Input.GetButton("Fire1"))
            Shoot();
        else
            CameraRecoil1 = Vector3.Lerp(CameraRecoil1, new Vector3(0, 0, 0), Time.deltaTime * cameraRecoil.z / 3f);
}

void Shoot ()
{
    if (shoottime <= Time.time && !isBusy && !isReloading && !isRunning)
    {
        shoottime = Time.time + weaponSettings.CurrentWeapon.fireRate;

        WeaponInfo currentWeapon = weaponSettings.CurrentWeapon;
        Transform cameraClimb = generalSettings.cameraClimbHolder.transform;
        Vector3 cameraRecoil = weaponSettings.CurrentWeapon.cameraRecoil;

        CameraRecoil1 = Vector3.Lerp(CameraRecoil1, new Vector3(-cameraRecoil.x, Random.Range(-cameraRecoil.y, cameraRecoil.y), 0), Time.deltaTime * cameraRecoil.z);
    }
}

void Recoil2 ()
{
    Vector3 cameraRecoil = weaponSettings.CurrentWeapon.cameraRecoil;
    Transform cameraClimb = generalSettings.cameraClimbHolder.transform;

    cameraClimb.localEulerAngles = CameraRecoil1;
}

Anyone have any ideas? I appreciate anyone who can help me!


texts: What do I need to Mod a Unreal Engine 3 game?

texts:
what I am looking for is some advise making a mod for a certain game and how I would go about making it. The game I am talking about is Blacklight: Retribution and what I wan't to know is;
Is it possible? And if so, what programs will I need?
It is an online only game so I was unsure how plausible a mod would be for it. Plus I have never made a video game before, but I do like the game and I wanted to do some things with it. Additionally, this will be my first time making anything video game related so I would appreciate any advise.

To expand a bit, I plan to add something simple at first. A mod that would let you spectate another player in the first person. Then I plan do something a bit more complex where I want to make so the game optionally always records you playing (in short intervals most likely or you would run quickly out of memory).
After all that is done I would add items, armor, weapons, and maybe make a map or not I am not sure but this in a shell what I hope to do. I don't know much about these things but I am reading anything I can get my hands on. So if this is overly ambitious or just plain out not a possibility any advise on what I should look to instead will be welcomed warmly. Thank you.


texts:
I have been implementing a custom physics engine, and I'm pretty close to having it working as I would like it to. There is a gravitational force, collisions and collision response. Unfortunately, there seems to be some jitter among near-stationary objects, most likely due to unchangeable low physics ticks.

I have looked online, and tried some of the implementations I have found, including some of my own attempts. Here are the solutions I tried:

Damping movement when speed/momentum/potential energy is below a threshold.
Only applying gravity when speed/momentum/potential energy is above threshold.
Implementing a sleep function. that checks the position of the object for the last 60 frames, and sleeps if it hasn't moved outside a threshold bounding box.
Iterating through the objects from top to bottom when applying collision testing and resolution.

Here is my code:

for each (auto ball in m_Balls)
{
    ball->Update(t);
    ball->Accelerate(m_Gravity);
}

// This disgusting hack sorts the balls by height. In a more complete physics
// implementation, I guess I could change the sorting based on the direction of
// gravitational force. This hack is necessary to prevent balls being pulled downwards
// into other balls by gravity; by calculating from the bottom of the pile of
// objects, we avoid issues that occur when adjustments push the object towards gravity.
m_Balls.sort([](const CSprite* a, const CSprite* b)
    {return a->m_pos.m_y < b->m_pos.m_y; });

static float cor = 0.8f;

for each (auto ball in m_Balls)
{
    for each (auto collider in m_Walls)
    {
        if (collider->HitTest(ball, 1))
        {
            float offset = 0;
            auto n = Helper::GetNormal(ball, collider, offset);

            ball->SetPosition(ball->GetPosition() + (n * offset));

            auto r = ball->GetVelocity() - ((1 + cor) * Dot(ball->GetVelocity(), n) * n);

            ball->SetVelocity(r);

            ball->SetPosition(ball->GetPosition() + ball->GetVelocity() * DeltaTime());
        }
    }

    CVector adjustment;

    for each (auto collider in m_Balls)
    {
        if (ball == collider)
        {
            break;
        }

        auto diff = collider->GetPosition() - ball->GetPosition();

        float distance = diff.Length();

        if (distance <= (ball->GetWidth() / 2) + (collider->GetWidth() / 2))
        {
            auto midPoint = (ball->GetPosition() + collider->GetPosition()) * 0.5f;

            adjustment = diff.Normalise() * (ball->GetWidth() / 2
                - Distance(ball->GetPosition(), midPoint));
            ball->SetPosition(ball->GetPosition() - adjustment);
            diff = collider->GetPosition() - ball->GetPosition();

            if (Dot(ball->GetVelocity() - collider->GetVelocity(), diff) > 0)
            {
                auto n = diff.Normalise();
                auto u = Dot(cor * ball->GetVelocity() - collider->GetVelocity(), n) * n;
                ball->Accelerate(-u);
                collider->Accelerate(u);
            }
        }
    }

    if (ball->GetSpeed() > MAX_SPEED)
    {
        ball->SetSpeed(MAX_SPEED);
    }
}

How do I prevent jitter amongst near-stationary physics objects?


texts: My sprites are spwaning on top of each other with a new class?

texts:
I am making a game for college in XNA C#, however I have got to the point where I need some enemy sprites to be spawned in for the player to shoot. I did this with one enemy by itself without using arrays and for loops to load and update all the enemy's at once as I have my enemy sprites inside a class. The class I have it supposed to give the enemy a random position, load the texture in and then draw them.

So I thought I would put my enemy sprites in a form of a array, and use a for loop to load, update and draw them. However, it all works but they all spawn in the random position on top of each other, but this works with one enemy at a time without for loops or putting them in an array.

Here is some of the code I used:

This is how I decide how many enemy sprite I want.

giantManager[] giant = new giantManager[7];

Because I have to create an instants of the giantManager class before the load content I use this to do so:

        for (int i = 0; i < 7; i++)
        {
            giant[i] = new giantManager();
        }

The following is how I load the giantManager class with the texture for my giants in the load function:

            for (int i = 0; i < 7; i++)
            {
                giant[i] = new giantManager(Content.Load<Texture2D>("giant"));
            }

Then to draw them I just use:

            for (int i = 0; i < giant.Length - 1; i++)
            {
                giant[i].Draw(spriteBatch);
            }

And this is the draw method inside the class:

public void Draw(SpriteBatch spriteBatch)
    {
        spriteBatch.Draw(giantTexture, new Rectangle((int)position.X, (int)position.Y, giantTexture.Width, giantTexture.Height), null, Color.White, giantAngle, new Vector2(giantTexture.Width / 2, giantTexture.Height / 2), SpriteEffects.None, 0);
    }

To choose my random spawn location I just use the Random C# data type and use if statements to decide which spawn location to set depending on the Random number generated. This happens in the constructor here:

    public giantManager(Texture2D newTexture)
    {
        giantTexture = newTexture;
        position = randomPosition();
    }

Just to conclude this question I would like to say sorry if I have posted to much code or not explained it in enough detail, I have tried by best.

Also if you look at this image below, it shows the rectangles in a black box, now the player rectangle is a little see through, but the giant rectangle is totally black which is because they all spawn on top of each other. That is my problem.

Thanks for reading all of this and any help in advanced would be great.


texts:
I'm trying to make a nice controls for my game, but I can't achieve enough SMOOTHNESS.

if (kbState.GetPressedKeys().Length != 0 && _direction != Vector2.Zero)
    {
        _direction.Normalize();
        _position += _direction * (_speed * (float)gameTime.ElapsedGameTime.TotalSeconds);
    }
    else
        _direction = Vector2.Zero;

    if (kbState.IsKeyDown(Keys.W))
    {
        _direction += new Vector2(0, -1f);
    }
    if (kbState.IsKeyDown(Keys.S))
    {
        _direction += new Vector2(0, 1);
    }

    if (kbState.IsKeyDown(Keys.D))
    {
        _direction += new Vector2(1, 0);
    }

    if (kbState.IsKeyDown(Keys.A))
    {
        _direction += new Vector2(-1, 0);
    }

There is the code. Could you help me a little and give an advice how to make character stop smoothly. I tried many options, but could'nt find any that fit.


texts: Wwise: play specific audio clip without specific event (for dialogue)

texts:
Is it possible to play a specific audio object in Wwise without having a separate event for it? I'm implementing a dialogue system, and I have thousands of audio clips for dialogues, and making an event for each and every one would be extremely time consuming and error prone and impossible to maintain.

So either play an audio object from a bank directly or somehow giving the event an argument as to which object to play (I know that goes against the idea of events and the fact that the caller shouldn't know exactly what clip is going to be played).

I believe what I'm looking for is something akin to FMOD's audio tables.


texts: Combining assets with different licenses

texts:
Is it OK to mix assets that are Creative Commons 3.0 BY-SA with other assets that are in the Public Domain in the same project? Thanks.

For instance here.


texts: How to generate water pools on a 2D tile grid?

texts:
I'm coding a algorithm that generate a map, fixed size 2D matrix of tiles (32x32, 64x64, ...), for a game. The game map contains 2 elements, ground and water tiles. I'm trying to flood some water pools on the map, but I don't come to any ideal conclusion.

I can do it with this steps:

Fill the map with Ground
Get a random position (x,y)
Set (x,y) as Water
Walk on, in spiral sequence, from the (x,y) point to a limit of N random steps, setting randomly  tiles as Water
Jump to step 2, making K more random water pools

This is a good approach? I think not! That algorithm will make pools with ground on the inside, with irregular borders and square shape.
But I desire random shaped lakes.

Anyone can give me a idea of a better solution?


texts:
I have a game where there are about 4 empty objects that are my object "spawners". I have two scripts attached to all of them, one that will keep spawning objects from "basictable", and then switch to the other component which will then spawn objects from  "complextable".

This is my first script :

public void SpawnA() {

    if (destroyer.spawncount < destroyer.spawnchange) { //if condition

        int randomi = Random.Range (0, basictable.Length);
        Instantiate (basictable[randomi], new Vector3 (this.transform.position.x,this.transform.position.y,basictable[randomi].transform.position.z), Quaternion.identity);
        Invoke ("SpawnA", Random.Range (mini, maxi));

    }
    else if (keep){
        this.GetComponent<spawnscript2>().SpawnB();
        keep = false;
    }

And the second script :

public void spawnB()  {

        int randomi = Random.Range (0, complextable.Length);
        bobo = (GameObject) Instantiate (complextable [randomi], new Vector3 (this.transform.position.x, this.transform.position.y, complextable [randomi].transform.position.z), Quaternion.identity) as GameObject;
        StartCoroutine ("DelayedSpawnC");

}

IEnumerator DelayedSpawnC () {

        yield return  new WaitForSeconds (6);
        destroyer.spawncount = 0;
        this.GetComponent<basicSpawner> ().keep = true;
        this.GetComponent<basicSpawner> ().SpawnA();
}

Logically, this should work. And indeed it does. But the problem I'm having is that my "spawner", sometimes works, and sometimes doesn't, some objects from the complextable are always spawned, but in other cases the spawner just does nothing, until it switches to the first script. Is there anything I can do to optimize the spawning process and avoid this? I can't get ahold of why are some blocks spawned and others take much longer, while other blocks don't get instantiated at all.


texts: Loading content into an Winforms/XNA Editor's content project

texts:
So i am bulding a game editor/engine basically for teh lulz but i have encountered a problem i cannot seem to fix, i cannot load any new content through the Winforms UI during runtime.

I tried using the File.Copy method in .Net to copy the files to the content folder but this does not seem to work as the file needs to be added to the content project in order for my ContentManager object to read it.

Any thoughts on how to fix this?


texts: How should I unbind and delete OpenAL buffers?

texts:
I'm using OpenAL to play sounds. I'm trying to implement a fire-and-forget play function that takes a buffer ID and assigns it to a source from a pool I have previously allocated, and plays it. However, there is a problem with object lifetimes.

In OpenGL, delete functions either automatically unbind things (e.g. textures), or automatically deletes the thing when it eventually is unbound (e.g. shaders) and so it's usually easy to manage deletion. However alDeleteBuffers instead simply fails with AL_INVALID_OPERATION if the buffer is still bound to a source.

Is there an idiomatic way to "delete" OpenAL buffers that allows them to finish playing, and then automatically unbinds and really them? Do I need to tie buffer management more deeply into the source pool (e.g. deleting a buffer requires checking all the allocated sources also)?

Similarly, is there an idiomatic way to unbind (but not delete) buffers when they are finished playing? It would be nice if, when I was looking for a free source, I only needed to see if a buffer was attached at all and not bother checking the source state.

(I'm using C++, although approaches for C are also fine. Approaches assuming a GCd language and using finalizers are probably not applicable.)


texts: Fixing text on the screen for Oculus Rift

texts:
I would like to fix text to the screen for an Oculus Rift in Unity. The text should say something like "get comfortable and then press any key". It seems like OVRGUI.StereoBox should work for this and I've tried to copy an example I found on Github, like so:

public class TargetScript : MonoBehaviour {
    void OnGUI() {
            Debug.Log("Drawing Recenter dialog.");
            string loading = "LOADING...";
            OVRGUI guiHelper = new OVRGUI();
            guiHelper.StereoBox(300, 300, 300, 300, ref loading, Color.white);
            Debug.Log("Stereo Box should be visible.");
            Debug.Log (guiHelper);
    }
}

The log messages indicate that this code block is definitely being hit, but no text is visible on screen.

What am I doing wrong?


texts:
I am not developing a game or creating game characters. What I am trying to do is give a name to the software that I am creating in my spare time. It seems there is a game character by the same name (I am not a gamer but a google search to check the name revealed it). The software is intended to be free but might make money in the future, so I want to know this.

Are names of characters in games copyrighted and is it illegal to use them to name other unrelated software components and applications that might or might not  make money?


texts: Can I simplify the inequality "distance(p1, p2) < distance(p1, p3)?"

texts:
I am working on some vector logic, so am asking: can I save processor time by simplifying this inequality:

distance(vector1, vector2) < distance(vector1, vector3)

I see that vector1 is repeated in both cases.


texts:
We are developing an MMO using Smartfox Server. The targeted audience is kids from 7 -12 years.

There is a global chat option in this MMO.
Whatever the user types in a textbox get displayed next to users avatar after he/she hits enter.

We would like to filter abusive language / profanities from this chat.
We could capture the chat and read the text. The problem is getting the list of profanities itself.

Our questions are

Where will one get exhaustive list of all profanities?
What method is adopted in similar scenario to filter out these?


texts: Rotate Object in world space - Raytracing

texts:
I’m programming a C raytracing project.
I’ve been wanting to implement object rotations (square, cylinder) for several days but I can’t do it.
For each object I have its position (x, y, z) in the world space and its 3d normalized orientation vector.
For the moment I do nothing more than applying once of the three following functions on the 3d normalized orientation vector. I don’t know if I’m doing it right. Rotation doesn't work well.
For example I want to rotate my object left with the j key and right with the l key (x_rotation), up with the i key and down with the k key (y_rotation). I'm not sure how to use the z axis.
I'm starting to despair, can you please help me ?
I will be very grateful for your help :)
t_vec x_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x;
    res.y = vec.y * cos(alpha) - vec.z * sin(alpha);
    res.z = vec.y * sin(alpha) + vec.z * cos(alpha);
    return (res);
}

t_vec y_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.z * sin(alpha) + vec.x * cos(alpha);
    res.y = vec.y;
    res.z = vec.z * cos(alpha) - vec.x * sin(alpha);
    return (res);
}

t_vec z_rotation(t_vec vec, float alpha)
{
    t_vec   res;

    res.x = vec.x * cos(alpha) - vec.y * sin(alpha);
    res.y = vec.x * sin(alpha) + vec.y * cos(alpha);
    res.z = vec.z;
    return (res);
}


texts: Avoiding lag when rendering Texture2D for first time

texts:
I have found a similar question here, but it is about playing sounds.

I am using 2048 x 2048 textures for sprite sheets and every time I call spriteBatch.Draw using a sheet for the first time in game execution, causes a considerable lag. The lag doesn't appears for the next times.

Someone has faced this problem before? What can I do to overcome this?

Update:

I inserted a code in the end of content load routine that draws EVERY Texture2D that is loaded into ContentManager before follow to the game screen. This works well. None lag occurs when different textures are rendered over the time, EXCEPT if the IsFullScreen are changed. Apparently, changing this property makes the textures loaded in the GPU gone. Is that correct?


texts:
I've built towers of cubes where each cube is connected to the one before with a FixedJoint. At 30 high they flop about as expected, but at a certain point (demonstrated at 100 high) they explode and do something crazy, moving around at light speed.
Video: https://www.loom.com/share/8807d99f157c45a1899138b469b4dec3?from_recorder=1
Is there a limit to the amount of force/torque a FixedJoint can simulate properly? The forces are set to break at infinity.


texts: Custom arcade physics rate (e.g. bullet time)?

texts:
Is there a way to modify the rate that physics is applied, either globally or on a per-sprite basis in Phaser? That is, how can I slow down or speed up the rate at which sprites move around, or fall due to gravity? One use case would be for the "bullet time" effect - by slowing down the physics rate for everything else apart from the player character.

I understand that the way physics works is that deltas are applied to sprite bodies every frame, based on the game.time.elapsed value. One method would be to set a custom multiplier on this elapsed value so movements happen slower or faster, but is this possible?

Alternately, I could apply all the physics effects myself, but can I do this without losing compatibility with the rest of the physics system?


texts:
I have a Game class with my main game functions and instances of game objects like screen, etc. My game is made using C++ and SDL.

I was wondering, though, should main be a function of my class? Or should I do "Game game;" from "int main();" and have the loop inside main?

My doubt is - if I do it from an outside-main, then most of my stuff will have to be public, and that is kinda bad, isn't it?

Any ideas? Thank you!


texts:
I just wonder, if it's possible to initialize and use DX11 or DX9 for offscreen rendering only - meaning with no attached window.
My intention is to do some GPU benchmarking before opening actual window. In this benchmarking some test scene is rendered, but should not be visible. (Actually depending on the benchmark score different windows are opened)


texts: How to create words as objects in Unity?

texts: I am working on a game that has words as obstacles, i.e. the player needs to climb over and around them. There will be hundreds of words in the game therefore I need a way to automate the placement. I figured out how to create an object with a TextMesh in Unity but I can't figure out how to automatically generate a collider so that I can have the player interact with it. I know that there is a way to edit the verticies of Edge and Polygon colliders but I don't have a source for editing them. What would be useful is a getPoints method of the TextRender but it seems like there is no way to get that. Am I going about this the right way? Thanks in advance.


texts:
I currently am doing art for a game being made (by me...) and started to think of multiple different ways of animating.

The two I am currently debating, with myself, is single layered animation and multiple layered animation.

Single: The entire character is done on one layer, with all of the required frames.

Multiple: Different body parts on their own separate layer (i.e. arm on one, leg on another, and so on)

I would like help figuring out the pros and cons of these so then I could decide, preferably from someone who has done one or the other...or both, but anyone that could offer assistance would be greatly appreciated.


texts: Calculating the correct roll from a bone transform matrix

texts:
Read this forum topic for more info: http://blenderartists.org/forum/showthread.php?260602-transform-matrix-to-bone-%28head-tail-roll%29-bug

I'm trying to get my Blender3d modeller importer to create correct bones from my file's transform matrices.

The Blender Python API doesn't have a way to do this (anymore!), so people had to dig the Blender C source to find out how Blender does it and port that. Here's a Python port of the needed functions, not by me (I don't know C):

def vec_roll_to_mat3(vec, roll):
    target = mathutils.Vector((0,1,0))
    nor = vec.normalized()
    axis = target.cross(nor)
    if axis.dot(axis) > 0.0000000001: # this seems to be the problem for some bones, no idea how to fix
        axis.normalize()
        theta = target.angle(nor)
        bMatrix = mathutils.Matrix.Rotation(theta, 3, axis)
    else:
        updown = 1 if target.dot(nor) > 0 else -1
        bMatrix = mathutils.Matrix.Scale(updown, 3)
    rMatrix = mathutils.Matrix.Rotation(roll, 3, nor)
    mat = rMatrix * bMatrix
    return mat

def mat3_to_vec_roll(mat):
    vec = mat.col[1]
    vecmat = vec_roll_to_mat3(mat.col[1], 0)
    vecmatinv = vecmat.inverted()
    rollmat = vecmatinv * mat
    roll = math.atan2(rollmat[0][2], rollmat[2][2])
    return vec, roll

How to use them:

pos = mymatrix.to_translation()
axis, roll = mat3_to_vec_roll(mymatrix.to_3x3())

bone = armature.edit_bones.new('name')
bone.head = pos
bone.tail = pos + axis
bone.roll = roll

Sadly, it seems even the Blender C code is buggy and doesn't take into account cases when the bone is parallel to (0,1,0). So such bones can get assigned wrong (by 180 degrees) rolls and mess up animations.

Does anyone have better code for generating roll which takes into account such cases?

The old Blender 2.4 API generated correct ones. Its C code can be found here: http://svn.blender.org/svnroot/bf-blender/branches/blender-2.47/source/blender/blenkernel/intern/armature.c
I'm no C coder myself, again.


texts: How would I rotate my billboards parallel to the camera view?

texts:
I'm trying to make my own space-sim in Godot and I'm stuck trying to get the visuals of the "starfield"-effect that is a staple of the genre. I'm using a Particle system with billboards that would be parallel to the camera's view (creating something like a cylinder).

I'm struggling with the math involved in the Vertex shader to transform those billboards. Can anyone help me?


texts:
I'm making some tests with rendering stuff and I'm wondering how to design my Geometry class. For the moment, here is how I do:

Init: Stock array with positions, array with colors, array with normals, … has attributes.
Just before rendering, if my geometry have changed, I update his vertex buffer and index buffer. To do that, I compute interleaved array here and send it to my vertex buffer.

I've made some tests with particles (10000 on iPad), the heaviest function is "Geometry::computeInterleavedArray.

How can I avoid this part? Is it better to stock geometry's data inside a single array with all data already interleaved?


texts: Can frame buffer objects in openGL ES have different kinds of attachments?

texts:
This question is with regards to the QT openGL app presented in this repository
https://github.com/PRBonn/semantic_suma
I am trying to run this application on NVIDIA AGX Xavier, however, I am getting errors with respect to frame buffer object attachments. I observe that whenever any framebuffer object is attached to 2 different types of attachments (for example renderbuffer object and texture), I am getting GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT error. I observe that if a texture is being attached to any framebuffer object which already is attached to renderbuffer object then this error is seen. This can be checked with glGetError().
Could someone please suggest any workaround for this issue. I am a newbie to OpenGL so please excuse me for this question.


texts: How can I work on a game that I don't like?

texts:
I started making a game with a friend, and I want to see it through. But the deeper we get into the project, the more I dislike the game.

How can I stay motivated and keep getting things done, if I don't really feel invested in the end product?


texts: smooth shading vs flat shading, what's the difference in the models?

texts:
I'm loading the exact same model with Assimp, except one is exported from Blender, shaded smoothly, and the other was exported from Blender, shaded flatly. Here is my results from loading both into my game:

The Flat drawn model has 1968 vertices and the Smooth drawn model only has 671, why is this happening, I don't understand why there would be less vertices when it's shaded smoothly...?


texts:
I need to use Emission texture to my model, but I can't find any emission parameters in mobile shaders.

I searched this on google, but there's nothing helpful to me.

How do I add emission for mobile shaders, without writing own shader code?
(I'm keep studying shader but still not good at)


texts: Cannot find GameController script - causing errors with logging and references

texts:
I am learning the Unity engine and have been practicing with various tutorials, but there is a curious error I am experiencing with the space shooter tutorial. Collisions with the player ship do not destroy asteroids or the player, while collisions with bolts fired by the player will destroy the asteroids but not increase the score at all.

The error being logged is "Cannot find GameController script" which makes me think there is a problem with my code below, specifically the void Start() function that checks if GameController != null.

Is there something about Unity 5 that differs from Unity 4 that I would need to change? Or have I made a mistake in this code attempting to reference the GameController script?

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

public class DestroyByContact : MonoBehaviour {

    public GameObject explosion;
    public GameObject playerExplosion;
    public int scoreValue;
    private GameController gameController;

    void Start()
    {
        GameObject gameControllerObject = GameObject.FindWithTag("GameController");
        if (gameController != null)
        {
            gameController = gameControllerObject.GetComponent<GameController>();
        }
        if (gameController == null)
        {
            Debug.Log("Cannot find 'GameController' script");
        }
    }

    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "Boundary")
        {
            return;
        }
        Instantiate(explosion, transform.position, transform.rotation);
        if (other.tag == "Player")
        {
            Instantiate(playerExplosion, other.transform.position, other.transform.rotation);
            gameController.GameOver();
        }

        Debug.Log(other.name);
        Destroy(other.gameObject);
        Destroy(gameObject);
        gameController.AddScore(scoreValue);
    }
}


texts: Problem With Enemy Bullets Attacking The Player Pygame

texts:
I am trying to make my enemy bullets attack the player but it only attack its x and y how could I make it curve instead of zigzagging VIDEO the bullets only attack the y axis and it wont curve or go to the player only attacks 2 positions

this goes on my main loop and appends projectiles

         for shootss in shootsright:

                if shootss.x < 500 and shootss.x > 0:

                    if enemyshoots1.x < playerman.x:

                        shootss.x +=  5
                    else:
                        shootss.x -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))
                if shootss.y < 500 and shootss.y >0:
                    if enemyshoots1.y < playerman.y:
                        shootss.y += 5
                    else:
                        shootss.y -= 5
                else:
                    shootsright.pop(shootsright.index(shootss))

            if len(shootsright) < 2:
                    shootsright.append(Bools(round(enemyshoots1.x+enemyshoots1.width-107),round(enemyshoots1.y + enemyshoots1.height-50),(0,0,0)))
                # projectile class for each of the bullets

my enemy bullets class

    # enemys bullets
    ksud = pygame.image.load("heart.png")
    class Bools(object):
       def __init__(self, x, y,color):
           self.x = x
           self.y = y
           self.ksud = pygame.image.load("heart.png")
           self.hitbox  = self.ksud.get_rect()
           self.rect  = self.ksud.get_rect()
           self.rect.topleft = (self.x,self.y)
           self.speed = 10
           self.color = color
           self.hitbox = (self.x + 57, self.y + 33, 29, 52) # NEW
       def draw(self, window):
            self.rect.topleft = (self.x,self.y)
            player_rect = self.ksud.get_rect(center = self.rect.center)
            player_rect.centerx += 0 # 10 is just an example
            player_rect.centery += 0 # 15 is just an example
            window.blit(self.ksud, player_rect)
            self.hitbox = (self.x + 97, self.y + 33, 10, 10) # NEW
            window.blit(self.ksud,self.rect)

I have something similar for the player where ever I click it appends bullets  how could I change it to append bullets at the player without the click?

                # this is for the bullets
                    if len(bullets) < 2:
                        shootsound.play()

                        start_x, start_y = playerman.x+playerman.width//2, playerman.y + playerman.height-54
                        mouse_x, mouse_y = event.pos

                        dir_x, dir_y = mouse_x - start_x, mouse_y - start_y
                        distance = math.sqrt(dir_x**2 + dir_y**2)
                        if distance > 0:
                            new_bullet = projectile(start_x, start_y, dir_x/distance, dir_y/distance, (0,0,0))
                            bullets.append(new_bullet)
        # this is displaying the bullets for the player
            for bullet in bullets[:]:
                bullet.move()
                if bullet.x < 0 or bullet.x > 900 or bullet.y < 0 or bullet.y > 900:
                    bullets.pop(bullets.index(bullet))


texts:
In an Android game, I have a gradient background that changes color over time. This was achieved by creating a 1x2 pixel texture in code, and stretching it over a large quad with bilinear filtering.

This all works fine in the editor, but as soon as it is viewed on an Android device, the banding is ridiculously noticeable and annoying.

Since this texture is generated in code, I cannot set the compression to "truecolor" like most other post suggest, nor can I tick the "Generate Mipmap" option.

Here is how the gradient look on the phone :

Code to generate gradient (stripped of unimportant stuff):

Texture2D gradient;
MeshRenderer render;
Color HSV1, HSV2;
Color primaryColor, secondaryColor;

render = GetComponent<MeshRenderer>();

Update() {
    HSV1.x += 0.01F * Time.deltaTime;
    HSV2.x = HSV1.x;

    if (HSV1.x > 1)
        HSV1.x = HSV1.x - 1;

    if (HSV2.x > 1)
        HSV2.x = HSV2.x - 1;

    primaryColor = Color.HSVToRGB(HSV1.r, HSV1.g, HSV1.b + HSVdifferece);
    secondaryColor = Color.HSVToRGB(HSV2.r, HSV1.g - HSVdifferece, HSV1.b - HSVdifferece);

    gradient.SetPixel(0, 0, primaryColor);
    gradient.SetPixel(0, 1, secondaryColor);
    gradient.filterMode = FilterMode.Bilinear;
    gradient.Apply();

    render.material.SetTexture("_MainTex", rainbow);

}

The color banding is really obvious and annoying. How can I fix this?


texts:
What I have
I have two rooms: rm_home and rm_options. I have a sound: snd_Bgm. And, I have three objects: obj_bgm, obj_BtnOnClicked, and obj_BtnOffClicked.
What I want is very simple
Player can turn on/off the snd_Bgm.
What I have done
In obj_bgm, I have these events:

Create Event: set var global.sound to 1
Room Start: stop sound snd_Bgm; if global.sound == 1 then play sound snd_Bgm

In obj_BtnOnClicked, I have these events:

Left-Pressed Event: play sound snd_Bgm; set var global.sound to 1

In obj_BtnOffClicked, I have these events:

Left-Pressed Event: stop sound snd_Bgm; set var global.sound to 0

I put obj_BtnOnClicked, and obj_BtnOffClicked in rm_options, which can be accessed from rm_home. Then, I put obj_bgm in rm_home.
This is the problem
When game start, it will show rm_home and plays the snd_bgm. I go to rm_options, then click the obj_BtnOffClicked to turn off the sound, so the sound is off. But, when I go back to rm_home, the sound is on again.
What I think
I shouldn't put Create Event: set var global.sound to 1 in obj_bgm, because when rm_home start, it takes the value of var global.sound from Create Event. But, if I put Create Event in obj_BtnOnClicked or obj_BtnOffClicked, it shows a Get Error.
What should I do? Please explain your answer. Thanks.


texts: Poor performance wth custom particle system in LibGDX

texts:
I'm using a custom particle system for my LibGDX / Java based game project (because I used Slick2D earlier on, need more parameters so I made my own and then ported). The system is fairly standard as far as I'm concerned, uses particle pooling (each emitter has its own fixed size particle pool) and renders each particle in a batch and uses one single (2048x1028) packed texture with all particle textures on it. Here is how I render the particles in semi-pseudo-code (because the entire code isn't relevant):

//ParticleSystem class
//Note: ExtendedBatch is my custom sprite batch implementation, largely just the normal SpriteBatch with two additional vertices for grayscale factor and additive tinting
void renderEmitter(ParticleEmitter emitter, ExtendedBatch batch)
{
    ParticlePool pool = particlePools.get(emitter);

    if (emitter.shouldScissor)
        Renderer.pushScissor(emitter.scissor);

    for (Particle particle : pool.particles)
    {
        if (particle.inUse)
              particle.render(batch);
    }

    if (emitter.shouldScissor)
        Renderer.popScissor();
}

//Particle class
void render(ExtendedBatch batch)
{
      relativeX = getRelativeX();
      relativeY = getRelativeY();

      if (isInScreenBounds(relativeX, relativeY))
      {
            batch.setColor(myColor);
            batch.draw(myTexture, position, origin, size, scale, rotation);
      }
}

Now for some reason with only around 300 particles (split up into 10 emitters with varying sizes) the performance drops to awful ~30FPS on my notebook's integrated GPU (Intel HD 4400) when I need / want 60FPS at all times. I know iGPUs aren't great, but that one is one of the better ones out there and games like Ori or Braid which have thousands of similar particles run without any problems at 60FPS on that very chip. I also doubt (and hope) that it's not just Java vs C++ which is causing this huge performance drop here.

Looking at in-game profiling data:

The in-game profiling data however shows a few things: Particles aren't really taking that long to render and there is a lot of idle time. To me, that doesn't really make much sense. It looks like there would be enough resources to easily render everything at 200FPS or more, but it is stuck at a horrible 30FPS.

There are a lot of things I already tried that didn't help:

Packing all particle textures into one (which is 2048x1024)
Batching all particle draw calls
Profiling to find out the cause (see above)
VisualVM to find potential memory issues, didn't help
Disabling vSync and FPS locks doesn't help

For the record, here's a VisualVM CPU sample over a timespan of 2 minutes:

There must be something I'm doing wrong and I also want / need more particles than just 300 so I definitely have to fix this - but I don't know how.

Update: Using the default SpriteBatch implementation and default shaders doesn't improve performance either.

Update - Solution:

I forgot to turn off MSAA. I had it running at 2x sampling rate for smoother antialising, I completely forgot to check for that. In the meantime I improved performance in a lot of other parts, but that's what finally did it.


texts: Fading in textures at a constant rate over a controlled duration

texts:
I'm trying to fade textures onto the screen using SDL2.

I've tried some different methods I've looked up, but I always encounter the same problem. It seems that the fading takes longer and longer as Alpha gets higher and higher, meaning that the very end of the fade takes the longest amount of time, and thus the fade takes an unreasonably long amount of time. I want the image to fade in at the same rate, and not dramatically slow down when the image gets more and more opaque.

The code that was causing the issue described above has been deleted, and I'm working on an entirely new system to hopefully avoid the problem. However, it doesn't work at all. Any advice would be awesome!

My NEW code:

for (float alpha = 0; alpha <= SDL_ALPHA_OPAQUE; alpha += fadeSpeed * elapsedTime) {
        if (SDL_SetTextureAlphaMod(spriteTex, alpha) == -1) cout << "ERROR" << endl;
        SDL_RenderCopy(renderer, spriteTex, NULL, &destRect);
        math::present();
        cout << "ALPHA: " << alpha << endl;
    }


texts: System.Runtime.Serialization.SerializationException while trying to deserialize List

texts:
I'm trying to serialize / deserialize a class that holds inventory items.

The code is attached below.

First I call AddOne() void a few times, then I call SaveFile(), then I call LoadFile().

In LoadFile() the following error occurs :

  ex = "System.Runtime.Serialization.SerializationException: End of Stream encountered before parsing was completed.\r\n  at System.Runtime.Serialization.Formatters.Binary.__BinaryParser.Run () [0x00288] in <1f0c1ef1ad524c38bbc5536809c46b48>:0 \r\n  at System.Runt...

Does anybody see my mistake?

Thank you for the help!

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEngine;

public enum Type
{
    undefined = 0,
    Pistol = 1,
    Magnum = 2,
    Grenade = 3,
    BlendGrenade = 4,
    FireGrenade = 5,
    PistolAmmo = 6,
    MagnumAmmo = 7,
    Rifle,
    RifleAmmo,
}

[System.Serializable]
public class Inventory : MonoBehaviour
{
    public class InventoryItem
    {
        public int Amount = 0;
        public int Row = 0;
        public int Col = 0;
        public int Rotation = 0;
        public Type ItemType = Type.undefined;
    }
    public List<InventoryItem> Items;

    public void Start()
    {
        Items = new List<InventoryItem>();
    }
    public void AddOne()
    {
        InventoryItem n = new InventoryItem();
        this.Items.Add(n);
    }
    public void SaveFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        if (File.Exists(destination))
        {
            File.Delete(destination);
        }
        using (Stream stream = File.Open(destination, FileMode.Create))
        {
            BinaryFormatter bin = new BinaryFormatter();
            bin.Serialize(stream, this.Items);
        }
    }

    public void LoadFile()
    {
        string destination = Application.persistentDataPath + "/save3.dat";

        using (Stream stream = File.Open(destination, FileMode.Open))
        {
            BinaryFormatter bin = new BinaryFormatter();

            try
            {
                this.Items = (List<InventoryItem>)bin.Deserialize(stream);
            }
            catch (Exception ex)
            {
                Debug.Log(ex.ToString());
            }
        }
    }
}


texts: Creating a planet out of an existing terrain

texts: I am creating a game that I have created a terrain for. I really like the terrain so I am wanting to keep it but I want to have the game take place on a full planet. Avoiding paying $200 for an asset already made, how would I develop something to allow me to "tile" this terrain to make a full planet and to make it round instead of flat? I know this has to be somewhat possible with the expensive assets on the asset store that are for round terrains. I just need to figure out how and I can't find anything online that is much help.


texts: Making animation clip at runtime from available sprites

texts:
i have sprite sheets of different resolution for targeting different mobile/tablet resolutions. the problem is that i have to choose sprite sheets from all the available one depending upon target resolution to make the animation clip and assign them to the Animation Override Controller at run time.
i found this link to make the animation clip.
http://answers.unity3d.com/questions/1080430/create-animation-clip-from-sprites-programmaticall.html

and the code works but only in unity editor i.e. whenever i try to build the project i get the following error:The type or namespace name `UnityEditor' could not be found.so i want to do the same thing but for different environments not only the editor.

look at this forum:https://forum.unity3d.com/threads/creating-animation-clip-at-runtime-from-sprites-2d.439792/

i wasn't able to find any solutions to this problem of making animation clips dynamically at runtime so please help me.


texts: Retrieving model position after applying modeltransforms in XNA

texts:
For this method that the goingBeyond XNA tutorial provides, it would be really convenient if I could retrieve the new position of the model after I apply all the transforms to the mesh. I have edited the method a little for what I need. Does anyone know a way I can do this?

    public void DrawModel( Camera camera )
    {
        Matrix scaleY = Matrix.CreateScale(new Vector3(1, 2, 1));
        Matrix temp = Matrix.CreateScale(100f) * scaleY * rotationMatrix * translationMatrix * Matrix.CreateRotationY(MathHelper.Pi / 6) * translationMatrix2;
        Matrix[] modelTransforms = new Matrix[model.Bones.Count];
        model.CopyAbsoluteBoneTransformsTo(modelTransforms);
        if (camera.getDistanceFromPlayer(position+position1) > 3000) return;
        foreach (ModelMesh mesh in model.Meshes)
        {
            foreach (BasicEffect effect in mesh.Effects)
            {
                effect.EnableDefaultLighting();
                effect.World = modelTransforms[mesh.ParentBone.Index] * temp *  worldMatrix;
                effect.View = camera.viewMatrix;
                effect.Projection = camera.projectionMatrix;
            }
            mesh.Draw();
        }
    }


texts: Simple Bounding Sphere Calculations for 2d game

texts:
I'm writing a 2d game and have a question regarding the use of bounding spheres.

I'm kind of OK with the math, but I'm confused about one thing.

To work out the distance between the 2 centre points I've read that I need to do something like this:

XDistance = Sphere2_center - Sphere1_center.

And then some other calculations etc...

So if me Sphere1_center X is say, 100 pixels and my Sphere2_center is say 200, then the XDistance will equal to 100 which is fine, however, what confuses me is this.  What happens if the positions of the spheres are reversed, then the 'code' would result in -100.  This surely will affect the remainder of the calculations?

Not sure if I've got the whole thing wrong but I would be grateful if someone could advise.  Many thanks


texts: Multiplayer (Database, Users,etc) for game

texts:
I'm am looking to add multiplayer into my game (2D Platformer in XNA C#) My worlds are quite large (Up to 30 Million tiles max, Average 20 million maybe. 2000x10000). You could say the game is quite like Terraria.

I have been using Player.IO, It has everything I could need, Except for the fact that I will easily run out of bandwidth with such large worlds.

So I have been experimenting with the Lidgren Networking Library, Its okay, But not having to port forward for users would be nice, But Minecraft and terraria still get away with it.

So if I have serverside Code figured out (Lidgren). Now I just Need unique usernames, and possibly a Database for them (as player.io has PlayerObjects), a way to make a server list would also be a plus.

Almost something such as The way minecraft does it would be fine, Players have accounts, but they also have to make a server.

So how should I go about adding,

Unique Usernames (Login and registration)
Database for players acheivements and stats
A way to easily intergrate it with a server ran by players (Unless the service
includes this)

By the way, We are Indie, So if we can do users through SQl and a site it would be cheap, or a cheaper multiplayer service would be cool


texts:
I am experimenting with weather conditions in a game of mine, and I was impressed by the way Starbound handled the rain. Basically, when rain hits the ground, it's either dispersed horizontally (and absorbed by the ground), or it creates piles of water (when raindrops land inside a hole in the ground).

This video demonstrates this clearly:
http://imgur.com/gallery/CKCGKbG

I know how to make rain fall and check where it hits the ground, but that's where I get stuck. My question is: how could this have been created? And how could one model the water flow so perfectly, without killing performance?

Thanks in advance!


texts: (XNA) What's a Good Database Program for a Turn-Based RPG?

texts:
I'll begin by saying that I feel my level of expertise matters here, and so I have about a year worth of experience as a programmer in the C# language and most of the .NET framework as a whole, but have scarcely worked with databases at all throughout my career so far. Can't exactly say why. Either way, I'm a bit of a beginner, although SQL/LINQ I am capable of working with once I have this question resolved. Moving on...

At home, I am developing a single-player (so only one person needs to access it) turn-based RPG in XNA. I have a lot of the logic done and the time has come for me to begin building a database for it.

THE REQUIREMENTS: There will be both dynamically written data not included with the program (such as the location in the world at which a player saved his game, that he may load in the same place) and read data that needs to be capable of being distributed easily with the program (such as a table containing stats of every monster).

THE DESIRED BUT OPTIONAL PERKS: Beyond these absolute requirements, ease of use is a second priority I want to focus on. My amatuer nature doesn't want me digging around on ground I am too unfamiliar with.

MY ATTEMPTS AT RESEARCH: I understand Access to be a simple-to-use (though oft frowned upon) choice that could work based on needing only one user to access the database at a time. SQL Server could also work, but I understand it to be more difficult to use based on my needs. And in both cases, I am not sure if there are complications associated with the distrubution of pre-loaded data with the programs. In this case, I think I should use an XML file to hold the data I want the game to come with, but I am not sure. Amidst all of this, I have also considered creating the .dbml right there in Visual Studio because it seems the simplest, but same issue: I don't know the limitations of capability and distribution.

I have tried to outline what I know and what I need to accomplish, as well as some of the options I have attempted to research, but ultimately, my knowledge has holes in it I can't find the answers to and I can't form a conclusive answer. Thus, I ask you kind people, based on the above, what is my best option for how to start building my game's database?