texts: Tile-based game with DirectX - issues with transparency and StretchRect

texts:
In my current project I have a class which loads a map file and then it should load all associated tilesets (no transparent tiles - I used to work with magenta as a colorkey) and precreate a surface for each static layer of the map so I only have to display one bigger image per frame rather then iterating over all of my tiles. For each tileset I have a loop which loads them successfully like this

 IDirect3DSurface9 *pTilesetSurface = nullptr;
 // Create surface
 HRESULT hResult = Engine::GetInstance()->GraphicsDevice->CreateOffscreenPlainSurface(
      pTileset->GetImage()->GetWidth(),
      pTileset->GetImage()->GetHeight(),
      D3DFMT_A8R8G8B8,
      D3DPOOL_DEFAULT,
      &pTilesetSurface,
      nullptr);
 if(!SUCCEEDED(hResult))
      return FALSE;

 // Load tileset
 std::wstring strTilesetSource(
      pTileset->GetImage()->GetSource().begin(),
      pTileset->GetImage()->GetSource().end());
 strTilesetSource = strPathToMap + strTilesetSource;
 hResult = ::D3DXLoadSurfaceFromFile(
      pTilesetSurface,
      nullptr,
      nullptr,
      strTilesetSource.c_str(),
      nullptr,
      D3DX_FILTER_LINEAR,
      D3DCOLOR_ARGB(255, 255, 0, 255),
      nullptr);
 if(!SUCCEEDED(hResult))
      return FALSE;

 this->m_vTilesets.push_back(pTilesetSurface);

After this loop I am iterating over every layer of the map and trying to build a surface for each layer with the associated tiles like this.

IDirect3DSurface9 *pLayerSurface = nullptr;
HRESULT hResult = Engine::GetInstance()->GraphicsDevice->CreateOffscreenPlainSurface(
    pLayer->GetWidth() * 16,
    pLayer->GetHeight() * 16,
    D3DFMT_A8R8G8B8,
    D3DPOOL_DEFAULT,
    &pLayerSurface,
    nullptr);
if(!SUCCEEDED(hResult))
    return FALSE;
Engine::GetInstance()->GraphicsDevice->ColorFill(
    pLayerSurface,
    nullptr,
    D3DCOLOR_ARGB(0, 0, 0, 0));
for(int x = 0; x < pLayer->GetWidth(); ++x) {
    for(int y = 0; y < pLayer->GetHeight(); ++y) {
        const Tmx::MapTile tile = pLayer->GetTile(x, y);
        if(tile.tilesetId != -1) {
            int dwTilesetWidth =
            this->m_pTmxFile->GetTileset(tile.tilesetId)->GetImage()->GetWidth() / 16;
            std::div_t tileCoords = std::div(tile.id, dwTilesetWidth);
            RECT srcRect = { tileCoords.rem * 16, tileCoords.quot * 16,
                tileCoords.rem * 16 + 16, tileCoords.quot * 16 + 16 };
            RECT destRect = { x * 16, y * 16, x * 16 + 16, y * 16 + 16 };
            Engine::GetInstance()->GraphicsDevice->StretchRect(
                this->m_vTilesets[tile.tilesetId],
                &srcRect,
                pLayerSurface,
                &destRect,
                D3DTEXF_NONE);
        }
    }
}

A call to D3DXSaveSurfaceToFile for debugging purposes creates transparent png files which can be layered correctly in Photoshop etc. but when I render these surfaces with this loop

for(auto iter = this->m_vLayers.begin(); iter != this->m_vLayers.end(); ++iter) {
    Engine::GetInstance()->GraphicsDevice->StretchRect(
        *iter,
        nullptr,
        Engine::GetInstance()->Backbuffer,
        nullptr,
        D3DTEXF_NONE);
}

then I have some wrong output which you can see here: .

All the blacks areas should be transparent such that one can see the layer below. Has anyone an idea what I might be doing wrong?

PS: I have read about the IDirect3DTexture9 and ID3DXSprite interfaces which could be helpful, but I haven't used them yet as I did not find any information on how to rebuild a map with tiles like I did here with usual surfaces. If anyone has suggestions about this, I would be glad to here them!


texts: Cover Screen with Snowing Effect in Libgdx

texts:
Oddly enough I cant find clear instructions on this theme (I only found rain and the method is very particular) so I ask, how do I implement a whole-screen snow-falling effect?

The methods i can think off the bat are:

-Using LibGDX's Particle System:
But it seems like it will be overkill for some reason, i need the snow all over the screen and i have the idea that particle system is only optimized for ephemeral occasional particles (correct me if im wrong)

-Draw a giant animation that fills the entire screen
Well, it also seems quite overkill... and it sounds hackish and dirty.

Id like a smooth effect, like a snowstorm, I cant think of any optimal method nor I have great experience in particles to be honest. So, any ideas?

P.S: The game is mainly for android, which is why Im so worried about an optimal solution


texts: Python or C server hosting for indie development

texts:
I've written a lot of the game, but it's singleplayer. Now we want to join up and play together.

I want to host it like an MMO, but haven't got any personal ability to host (no static IPs or direct access to a reasonable router that will allow me to port forward) so I wondered if there were any free / very cheap hosting solutions for people developing games that need to develop their MMO side.

In my case it's a world server for a 2D game where the world map can be changed by the players. So, GAE sounds expensive, as there would be quite a few updates per second (I heard they bill for data updates but not for download, but can't find refernce to billing anywhere on the FAQs)

I'd prefer to be able to write the server in python as that's what the game is written in (with pygame), but C is fine, and maybe even better as it might prompt me to write some more performant world generator code ;)


texts:
I've checked intelisence and googled for it but it seems there is no 3x3 matrix in xna. I'm just wondering should I just write a matrix class for xna to work freely with matrix class?

by the way I'm trying to multiply vector3 into 3x3 matrix to have both rotation and translation in one matrix class.


texts: Should Chinese text be grid aligned in game dialogs?

texts: Title says it all, should I have my text using a variable width font, or fixed width.  I didn't know if it is easier to read if its aligned on a grid?


texts:
I'm working on a game in Java, and I'm having some trouble with finding the correct camera position. I've already made a Rectangle that shows exactly where I want the camera to be, and at what scale:

However, whenever I actually try to adjust the camera so it fits with the rectangle, I get weird results. The camera goes in weird places when I get to a point where the scale isn't 1:

(The blue rectangle shouldn't be visible in the above gif, because that's where the camera's edges should be.)
Right now I have a camera class, where I set the position with:

x=-((leftX+Math.abs(leftX-rightX)/2)-Main.WINDOW_WIDTH/2/scale);
y=-((topY+Math.abs(topY-bottomY)/2)-Main.WINDOW_HEIGHT/2/scale);

Where leftX, rightX, topY, and bottomY are the topmost, rightmost, topmost, and bottommost points of the rectangle. Those two lines of code are where the problem lies. I simply need to figure out where to move the camera based on the scale.

For translating and scaling, I have this:

g.translate(cam.getX(), cam.getY());
g.scale(cam.scale, cam.scale);

//Render in-game objects

g.translate(-cam.getX(), -cam.getY());
g.scale(1/cam.scale,1/cam.scale);

What I'm asking is, how can I move the camera so that it's perfectly aligned with the rectangle?


texts:
In my game I want to model kind-of-accurate bullet physics. I have the following drag equation (in C#):

float drag = 0.235f * density * velocity*velocity * Mathf.PI * sizeMM*sizeMM/4000000;

In non-code terms, this is the same as the drag equation:

drag = 0.5 x [density] x [speed]^2 x [area] x [drag coefficient (0.45)]

Where density is the density of the material (air being 1.225kg/m^3), velocity is the velocity in m/s, and sizeMM is the diameter of the spherical projectile in mm. 0.235 was obtained by the 1/2 in the drag equation and 0.45 from the drag coefficient for spherical objects, and 4mil was the result of squaring 2000 (2 for halving diameter, 1000 for converting to metres).

The drag value appears to be appropriate, for a 11.43mm radius bullet travelling at 251m/s through air, I get a drag value of 1.860946 (presumably in m/s). What I need to be able to do is integrate that over a set distance D to obtain the result velocity as it impacts the target, and I already know that distance value.

I'm open to all potential answers to the problem, provided no loops are used. I need the resulting math to be as fast as possible, due to the possibility of it being used upwards of 20 times per second in multi-person combat.

I need the resulting math to always use the provided input variables. Density could change based on the material (i.e. flesh, kevlar, wood), sizeMM will change based on the type of ammo, and velocity will obviously change.

Approximations are preferred if accurate. If you can give an equation that is within 0.1% of the always-exact one and runs twice as fast, I'd prefer that.


texts: Is it legal to reuse a 3D model as long as it has a new texture?

texts:
If I create a 3D model and texture for a client, say a house. Can I reuse that same 3D model, but apply a new texture and then legally use that in my own game? Is that enough of a difference?

Thanks!


texts: How to move a 2d sprite to a target location while avoiding obstacles?

texts:
How can I get a 2d sprite to move to a position clicked on the screen, without bumping into other objects? I'm programming in java using the android API library

I have created a surface view and loaded my sprites as a bitmap object.


texts: Cause a projectile to wait at the position initially fired for a second before flying off

texts: I want to have a projectile that the character fires stay in the same place for a second or two before flying off in the direction of the mouse at the initial time of fire. The character can move away from the projectile after firing it, and the projectile wont move till after the time has passed.


texts:
Possible Duplicate:
  How closely can a game resemble another game without legal problems

So suppose I'm currently developing a variant of a snakes game for the iPhone, and you decided to call it "snakes".

First, in general, how would you find out if a name's been copyrighted or not? It's probably safe with "snakes" because it's such a common word, and that there's been so many games around (please correct me if I'm wrong), but with some people copyrighting the name "edge", it would be best to be a bit careful.

Second, suppose I decided to go with some name that is guaranteed to be different (e.g EL SERPENTES DE LOS REYES), would gameplay be a point of contention on copyright issues? For example, the tetris game is sort of "copyrighted" at the apple app store, and there was a crackdown on anyone using the word "tris" or anything related to it. However, if there was a game with the gameplay of tetris (or loosely very similar), with the name "BLOXODEREX", can it be liable to copyright/DMCA issues?


texts: Most efficient method to render 1,000s of unique space scenes?

texts:
I'm an artist with a concept, not the developer, and I'm trying to wrap my head around the approach I should be taking for the following scenario, namely whether to model in Photoshop or 3DS Max.

Say I have a simple animation loop of a rotating planet with a moon orbiting it that I want to play in the background of a game menu screen. Thanks to your help I have some ideas as to how to represent this illusion in 2D. But what if instead I had thousands of different scenes of this nature I wanted to represent in-game, using different planets, moon configurations, orbiting ships, passing asteroids, various backgrounds, etc. I assume that attempting to render these as video files and apply individually as movie texture is out of the question due to hardware and/or storage limitations on mobile devices, and that the scenes would be too complex for spriting.

Would I be best off using a 3D game engine to individually render constituent objects (a rotating planet, an orbiting moon, a drifting debris field) and then place them in front of a static backdrop (a JPEG of a nebula and star field, for example)? I assume for the same reasons as above that you wouldn't actually pre-render these objects, but instead send instructions to the game engine to draw a sphere, map a couple of textures to it, give it rotational parameters, etc.? Is this basically how it works? What about for the non-simple shapes like asteroids, ships, etc., can you also send a model parameter?

Keeping in mind that these scenes will be backgrounds only and non-interactive, am I on the right track?


texts: Unity - 3D Sound sounds weird if audio listener is moving fast

texts:
If you place 3D Sound which is set to logarithmic falloff and move very fast, then it sounds extremly weird and plays way faster than normal. How can I prevent this?

I made a short video:
https://www.youtube.com/watch?v=-bZJ7YS775E&feature=youtu.be


texts: Why can't this simple SDL app be closed without task manager or rapid clicking of x button?

texts:
I wrote a simple app that generates a window, a raster, and redraws the raster once every 16ms. Right now the calculations are empty, it just draws a solid color. I don't know how, but I have created a very resource hungry app that cannot be easily closed. I generally have to close it via the task manager.

Here is my SDL "wrapper" class. Below this class is what will eventually calculate a ray caster. I initially thought my call to SDL_RenderDrawPoint for every pixel in the 600x600 window was causing the issue, but I still cannot close the window easily with that code commented out.

SDLWrapper.cpp

#include <iostream>
#include <SDL2/SDL.h>
#include <vector>
#include "include/SDLWrapper.h"

using namespace std;

#define TICK_INTERVAL 16

static int next_time;

SDLWrapper::SDLWrapper() {
}

int SDLWrapper::setupSDLRenderer(int WINDOW_WIDTH, vector<vector<RGB>> (*generateRaster)()){
    SDL_Event event;
    SDL_Renderer *renderer;
    SDL_Window *window;

SDL_Init(SDL_INIT_VIDEO);
SDL_CreateWindowAndRenderer(WINDOW_WIDTH, WINDOW_WIDTH, 0, &window, &renderer);
next_time = SDL_GetTicks() + TICK_INTERVAL;
while (1) {
    if (SDL_PollEvent(&event) && event.type == SDL_QUIT)
        break;

    SDL_RenderClear(renderer);

    rasterPixels = (*generateRaster)();
    for (int i = 0; i < rasterPixels.size(); ++i)
    {
        for (int j = 0; j < rasterPixels.at(i).size(); ++j)
        {
            SDL_SetRenderDrawColor(renderer,
            rasterPixels.at(i).at(j).R,
            rasterPixels.at(i).at(j).G,
            rasterPixels.at(i).at(j).B, 255);
            SDL_RenderDrawPoint(renderer, i, j);
        }
    }
    SDL_RenderPresent(renderer);

    SDL_Delay(time_left());
    next_time += TICK_INTERVAL;

}
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
SDL_Quit();
return EXIT_SUCCESS;
}

RGB SDLWrapper::peek(int x, int y){
    return rasterPixels.at(x).at(y);
}

void SDLWrapper::poke(int x, int y, RGB color) {
   rasterPixels[x][y] = ((RGB){color.R, color.G, color.B});
}

int SDLWrapper::time_left(void)
{
Uint32 now;

now = SDL_GetTicks();
if(next_time <= now)
    return 0;
else
    return next_time - now;
}

RayCaster1.cpp

#include "include/SDLWrapper.h"
#include <iostream>
#include <vector>

#define WINDOW_WIDTH 600

#define mapWidth 24
#define mapHeight 24

vector<vector<RGB>> rasterPixels;

vector<vector<RGB>> generateRaster(){
      RGB greenPixel;
      greenPixel.R = 255;
      greenPixel.G = 255;
      greenPixel.B = 255;

      for(int i = 0; i < WINDOW_WIDTH; i++) {
          vector<RGB> column;

          for(int j = 0; j < WINDOW_WIDTH; j++){
              column.push_back(greenPixel);
          }

          rasterPixels.push_back(column);
      }

  return rasterPixels;
}

int main(int /*argc*/, char */*argv*/[])
{
    double posX = 22, posY = 12;  //x and y start position
    double dirX = -1, dirY = 0; //initial direction vector
    double planeX = 0, planeY = 0.66; //the 2d raycaster version of camera plane

    SDLWrapper sdlWrapper;
    sdlWrapper.setupSDLRenderer(WINDOW_WIDTH, generateRaster);
}


texts: How to apply numerical integration on a graph layout

texts:
I've done some basic 1 D integration, but i can't wrap my head around things and apply it to my graph layout.
So, consider the picture below:

if i drag the red node to the right, i'm forcing his position to my mouse position
the other nodes will "follow" him, but how ?

For Verlet, to compute the newPosition, i need the acceleration for every node and the currentPosition.
That is what i don't understand.

How to i compute the acceleration and the currentPosition ?

The currentPosition will be the position of the RedNode ? If yes, doesn't that means that they will all overlap ?

http://i.stack.imgur.com/NCKmO.jpg


texts: Will importing more items from unity packages increase the build size?

texts: I'm developing a GoogleVR (formerly Google Cardboard) application and need to import the GoogleVR SDK. While I only expect to use some of the items available in the Unity package, I'd like to import them all at once and save potential headaches later when I can't find something I might need. However I'm worried that including everything in the project may affect the build size, which would be troublesome on a mobile application.


texts: Graphics capabilities differences between mobile and desktop/console platforms?

texts:
I would like to better understand the difference in capabilities between mobile and desktop/console graphics? What exactly are the limitations of a mobile device? What kind of operations can a high-end GPU do that a modern smartphone cannot do? It's clear that games in a desktop look much better but what is behind those differences? I am aware that the APIs supported are different (D3DMobile, OpenGL ES vs full direct3d and opengl), even XNA has the Reach and Hi-Def graphics profile. I can see some of the differences here:

http://my.safaribooksonline.com/book/programming/game-programming/9780132620185/reach-vsdot-hidef-chart/app01lev1sec1#X2ludGVybmFsX0ZsYXNoUmVhZGVyP3htbGlkPTk3ODAxMzI2MjAxODUvNDU1)

What is the impact in let's say a game, what kind of effects or visuals I cannot get in a mobile due to this limitations, and what's the reasoning behind them. What is the bottleneck or restriction that prevents mobile devices to produce them.

Any thoughts or good resources to read about will be very appreciated.

EDIT: I am aware of the price/power/heat/form factor restrictions imposed on mobile GPUs. What I am trying to get at is the implications of those differences. Let's say that you can't use some type or size or textures, or maybe there is a maximum number of polygons, or certain type of transformations are not allowed. And from that I would like to know the practical consequence (i.e. water looks less real, objects up close look pixelated, the lighting is more flat).
I am just guessing, but I would like to know for sure. In short, I want to know if I were to do a game with all the features of a high-end gpu (for example, a DX11 compatible one), and write the same game for a phone. What will I be missing, and in terms of visual perception what would look different?


texts: Game Maker - Selecting tiles in an isometric grid

texts:
I have implemented an isometric grid with rotation in 2 directions in Game Maker. I did this by first calculating the points of the grid in 3D space and then converting them to 2D points through equations I derived from rotation matrices. I use a single object to draw the grid, and would like to be able to click on a tile to select it.

Here are the equations I use to convert the initial 3D points (x, y, z) to isometric 2D points (iso_x, iso_y), where b and a are the angles I'm rotating the grid by:

iso_x = cos_b * x - sin_b * y
iso_y = cos_a * sin_b * x + cos_a * cos_b * y + sin_a * z

I attempted to rework the equations to calculate the tile from mouse coordinates, but I've run into the problem where I have 2 knowns (mouse_x, mouse_y) and 3 unknowns (x, y, z), which will make implementing height difficult.

So I guess I'm looking for suggestions on how to do tile picking better, especially when it comes to choosing tiles with height. If you need extra information, I will try to provide it.

I want to keep the rotations, so moving to sprite-based tiles probably won't work because the shape of the tiles will change as the grid rotates.


texts: Unity: Vertical Input will not return negative values

texts:
I am trying to make a 'single stick' shooter, where the character faces the direction they are moving, but I'm struggling to get the movement working correctly; no matter what I've tried, the player won't move down.
Through some investigation, the issue seems to be that hitting the s key does not return a negative Vertical axis value, and I don't know enough about the workings of the Input manager to understand why.
Here's the code, to check I haven't made a glaring mistake there:
public void FixedUpdate()
{
   Controls();
}

...

public void Controls() {

 if (gameStateManager.gameState == SingleStickShooter) {

    // Variables
    float xInput = Input.GetAxis($"{controller} Horizontal");
    float yInput = Input.GetAxis($"{controller} Vertical");

    Vector2 controlThrow = new Vector2(xInput, yInput);
    print("Control Throw: " + controlThrow.x + " , " + controlThrow.y);

    currentSpeed = runSpeed;

    // Movement

    Vector2 playerVelocity = controlThrow * currentSpeed;
    rigidbody.velocity = playerVelocity;

    print("Velocity: " + rigidbody.velocity.x + " , " + rigidbody.velocity.y);

      // Rotation

      float angle = Mathf.Atan2(yInput, xInput) * Mathf.Rad2Deg;
      if (xInput != 0f || yInput != 0f)
         transform.rotation = Quaternion.Euler(0f, 0f, angle);

I would love to go tinkering around in the Input Manager and learn through mistakes, but it's a collaborative project where other games using this system are working, so I don't want to risk breaking something by going in blind. Also, those games are successfully using the down key, but mine isn't which makes me think it's something else I'm too green to realise.
This is my first question so I don't know what else I should add, so let me know what other context you need and I'll add what I can.
EDIT: Below I've added the debugging info Ben Johnson requested. Console output returns over 1000 values due to being called in Update(); the section shown is specifically when I go from pressing right and up to right and down.

Gravity value for input manager is the only thing I can see that's different, but changing it doesn't seem to fix my problem. I thought that obviously having the vertical axis set to the Y-axis would be obvious too, but that also didn't help so I reverted to the one above it.


texts: A few questions about integrating AudioKinetic Wwise and Unity

texts:
I'm new to Wwise and to using it with Unity, and though I have gotten the integration to work, I'm still dealing with some loose ends and have a few questions:
(I'm on Unity 4.3 as of now but I think it shouldn't make any difference)

The base path: The Wwise documentation implies you set this in the
AkGlobalSoundEngineInitializer basePath public ivar, which is
exposed to the editor. However, I found that this variable is not
really used. Instead, the path is hardcoded to
/Audio/GeneratedSoundBanks in AkBankPath. I had to modify both
scripts to actually look in the path that I set in the editor
property. What's the deal with this? Just sloppyness or am I missing
something?
Also about paths: since I'm on Mac, I'm using Unity natively under
OS X and in tadem, the Wwise authoring tool via VMWare and I share
the OS X Unity project folder so I can generate the soundbanks into
the assets folder. However, the authoring tool (downloaded the
latest one for Windows) doesn't automatically generate any
"platform-specific" subfolders for my wwise files. That is, again,
the Unity integration scripts assume the path to be
/Audio/GeneratedSoundBanks/<my-platform>/ which in my case would be
Mac (I set the authoring tool to generate for Mac). The
documentation says wwise will automatically generate the
platform-specific folders but it just dumps all the stuff in
GeneratedSoundBanks. Am I missing some setting? cause right now I
just manually create the /Mac folder.
The C# methods AkSoundEngine.PostEvent and AkSoundEngine.LoadBank
for instance, have a few overloads, including ones where I can refer
to the soundbanks or events by their ID. However, if I try to use
these, for instance:

AkSoundEngine.LoadBank(,
    AkSoundEngine.AK_DEFAULT_POOL_ID)

where the int I got from the .h header, I get Ak_Fail. If I use the overloads that
reference the objects by string name then it works. What gives?
Converting the ID header to C#: The integration comes with a C# script that seems to fork a process
to call Python in turn to covert the C++ header into a C# script.
This always fails unless I manually execute the Python script myself
from outside Unity. Might be a permissions thing, but has anyone
experienced this?
The Profiler: I set up the Unity player to run in the background and
am using the "Profile" version of the plugin. However, when I start
the Unity OS X standalone app, the profiler in VMWare does not see
it. This I'm thinking might just be that I'm trying to see a running
instance of the sound engine inside an OS X binary from a Windows
virtual machine. But I'm just wondering if anyone has gotten the
Windows profiler to see an OS X Unity binary.
Different versions of the integration plugin: It's not clear to me from the documentation whether I have
to manually (or write a script to do it) remove the "Profile"
version and install the "Release" version when I'm going to do a
Release build or if I should install both version in Unity and it'll
select the right one.

Thanks!


texts: What is the depth that a pixel shader may output? Is it necessary to write Depth?

texts:
In DirectX11, what does the depth that a Pixel Shader can output mean? Does a pixel shader need to output a depth so that we "write" the depth? If not, why would we output it?

For any doubts, I'm talking about the depth described in the last paragraph of this page of the MSDN documentation:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb205146(v=vs.85).aspx#Pixel_Shader_Stage


texts:
My new app is ready to publish but I have big dilema: will space characters in title hurt my game in search engines (google, google play, itunes)? There are two teams in the game called 'MAD' and 'MED' teams. Until now I used 'MADorMED', because I wanted to create a new and unique title which was never used before. But I found google play search doesnt find the app if a user searches for 'mad or med'. Plus if I search google 'mad or med', it doest find my domain madormed.com either.

Is it better to use spaces? Will the engines find it better?

It is also a thing to consider some users will swap words and look for 'med or mad'.

I personally dont like the version with spaces, as it is not a unique name, and it is made of very common word. I afraid 'mad' and 'med' words are so common words my app will be lost among other popular titles.

But if its a logical move I will rename it and use spaces.

I'm very grateful for any advice.

Thanks, Mate


texts: Looking for tips on how to optimize/debug Java/Eclipse

texts:
I made a raycasting engine with wall textures. Before adding the texture the engine was silky smooth. With textures it has small lags (or stutters) when i move around and i would like to know why. My code is not super clean so im not providing it (yet). I'm looking for general tips on where to start when you want to optimize for performances. It's the first time i have to do this.

I monitored my pc performance while the engine was running. My CPU had very low usage and none of my cores were over 30%. Memory and disk usage were all fine. GPU was at 0% (its in 2d). All wall textures are loaded in memory at game launch so in theory my engine should not have to read from disk while running.

Im using Eclipse and the code is in Java + Swing.


texts:
For a while now, I've been working with XNA for game design and development (although only for personal use ATM.) Overall, I'm a major fan of XNA itself, and it's overall "feel." However, due to the fact that:

XNA seems to have a lack of support (no Metro support, no updates since 2010, etc.)
I plan to try and get a job in the game development industry, and due to C++'s dominance, being more familiar with it would be very useful
XNA only supports Windows (non-Metro) and Xbox 360, while I am interested in Mac and (to a lesser extent) Linux support.

I've been trying to shift over to C++ as my main language. However, I do not want to focus on learning raw DirectX/C++ at this time, so I've been looking for a higher level C++ API (something about the same level as XNA, although something a bit more low-level would be fine) with a feel similar  to XNA. So, for someone switching from C#/XNA to C++, what would my best choice(s) be for API's similar to XNA, although unmanaged and running on C++?


texts: Making a box character in UE4, not a capsule

texts:
I want to make a character for a Breakout game that is a kind of cube.

From the instructions from Unreal it appears I need to create a 'Character' blueprint. But when i do this, it comes with CapsuleComponent (Inherited) and I can't change the shape/mesh.

I could perhaps turn off collision on the capsule, but is that really the way it has to be. The capsule is annoying and not needed in this case. I just want a block that I can move left to right with A and D key.

Am I approaching this wrong completely? Do I need a 'Character' blueprint in order to make such a controllable Paddle for Breakout game?


texts:
I just fixed a bug where rays starting and ending in an octree node were not detected as octree node hits (because the ray doesn't hit the sides).

I'm changing the code to check if a ray starts in the octree node, then it is an automatic node hit.

Any reason to not do this?


texts: XNA Skinned Animated Mesh Rendering Exported from Maya

texts:
I am working on translating an old RTS game engine I wrote from DirectX9 to XNA. My old models didn't have animation & are an old format, so I'm trying with an FBX file. I temporarily "borrowed" a model from League of Legends just to test if my rendering is working correctly.

I imported the mesh/bones/skin/animation into Maya 2012 using an "unnamed" 3rd-party import tool. (obviously I'll have to get legit models later, but I just want to test if my programming is correct). Everything looks correct in maya and it renders the animations flawlessly.

I exported everything into a single FBX file (with only a single animation).
I then tried to load this model using the example at the following site:
http://create.msdn.com/en-US/education/catalog/sample/skinned_model

With my exported FBX, the animation looks correct for most of the frames, however at random times it screws up for a split second. Basically, the body/arms/head will look right, but the leg/foot will shoot out to a random point in space for a second & then go back to the normal position. The original FBX from the sample looks correct in my program.

It seems odd that my model was imported into maya wrong, since it displays fine in Maya. So, I'm thinking either I'm exporting it wrong, or the sample code is bad & the model from the sample caters to the samples bad code.

I'm new to 3D programming & maya, so chances are I'm doing something wrong in the export. I'm using mostly the defaults, but I've tried all 3 interpolation modes (quaternion, euler, resample).


texts: How would I balance a multiplayer competitive game

texts:
I'm looking at my first foray into developing a game, and would love to know whether you guys have any thoughts on game balancing on limited multiplayer games.

The game I have in mind involves a neutral player that has to achieve a goal, with two supporting "deity" players who are one of 'good' and 'evil' - One of the deity players would try to help the player achieve their goal, while the other would try to thwart them.

Any thoughts or pointers on how I can ensure the deities are balanced?

If you want me to expand, I will, just didn't want to give away too much of the game play before I finish it.


texts:
I'm having heavly troubles with setting up a View Matrix and a Projection Matrix. It simply doesnt work. So I think my problem is related to my rotationMatrix function. I'm using this tutorial to learn some basics about Matrix maths.

This method works fine to rotate a object in 3 angles, but I think it have a bug or something like that. So I need your help just to know if this method is doing hes job right, if so, I'll try to rewrite again all my Camera code to see if I made something wrong (I've do this 2 times already).

public static Matrix4 rotationMatrix(float x, float y, float z){
    //Set as Identity Matrix;
    float[] result = {
            1.0f, 0.0f, 0.0f, 0.0f,
            0.0f, 1.0f, 0.0f, 0.0f,
            0.0f, 0.0f, 1.0f, 0.0f,
            0.0f, 0.0f, 0.0f, 1.0f
        };

    /*
                      Row-Major Matrix
                  ----------------------------
                 |  1       0       0       0 |
            Rx = |  0       cos(X)  -sin(X) 0 |
                 |  0       sin(X)  cos(X)  0 |
                 |  0       0       0       1 |
                  ----------------------------
                 |  cos(Y)  0       sin(Y)  0 |
            Ry = |  0       1       0       0 |
                 |  -sin(Y) 0       cos(Y)  0 |
                 |  0       0       0       1 |
                  ----------------------------
                 |  cos(Z)   sin(Z) 0       0 |
            Rz = |  -sin(Z)  cos(Z) 0       0 |
                 |  0        0      1       0 |
                 |  0        0      0       1 |
                  ----------------------------
     */

    float cos, sin;

    if (x != 0.0f){ //If it has a X value, lets compute the Matrix.
        cos = (float) Math.cos(x);
        sin = (float) Math.sin(x);

        result[0] += 1.0f;
        result[5] += cos;
        result[6] -= sin;
        result[9] += sin;
        result[10] += cos;
        result[15] += 1.0f;
    }

    if (y != 0.0f){//If it has a Y value, lets compute the Matrix.
        cos = (float) Math.cos(y);
        sin = (float) Math.sin(y);

        result[0] += cos;
        result[2] += sin;
        result[5] += 1.0f;
        result[8] -= sin;
        result[10] += cos;
        result[15] += 1.0f;
    }

    if (z != 0.0f){//If it has a Z value, lets compute the Matrix.
        cos = (float) Math.cos(z);
        sin = (float) Math.sin(z);

        result[0] += cos;
        result[1] -= sin;
        result[4] += sin;
        result[5] += cos;
        result[10] += 1.0f;
        result[15] += 1.0f;
    }

    return new Matrix4(result);
}

Also I think this rotation Matrix is in row-major (I dont have sure). I send this Matrix to a Vertex Shader and it multiplies by the Vec3 position, so I think if I got any problem, is with this method.

Thanks for reading it!


texts: Convert a quaternion from one coordinate system to another, which are not orthogonal to each other

texts:
I found a similar question like this in the following link: https://stackoverflow.com/questions/18818102/convert-quaternion-representing-rotation-from-one-coordinate-system-to-another/18818267

In that question, coordinate system axes could be mapped to one and another directly because the coordinate systems are orthogonal to each other, but in my case the coordinate systems are not orthogonal to each other which prevents it to map directly. How can I convert the quaternion rotation in such case? Any help would be much appreciated.


texts: Is It Possible To Reset UI To Initial State At Runtime Without Any Direct Assignments?

texts:
Is it possible to reset UI to it's initial state (the state when game started) without directly reseting elements one by one?

Thanks in advance.

Edit: I'm asking for runtime. (ResetToPrefabState doesn't work at runtime.)


texts: How to switch between multiple cameras in a Unity Scene, Silent Hill-style

texts:
I have 3 cameras in a practice scene that I want to switch between. Currently, I have a meshless cube acting as a trigger with the following script

public class CameraSwitch : MonoBehaviour
{
    [SerializeField]
    private GameObject startCamera;
    [SerializeField]
    private GameObject camera2;

    // Start is called before the first frame update

    private void OnTriggerEnter(Collider other)
    {
        if(other.tag == "Player")
        {
            startCamera.SetActive(false);
            camera2.SetActive(true);
        }
    }

}

It's switching from the first camera to the second no problem, but it won't switch back if I move my player through the trigger again.

Is there a way I can store multiple different cameras inside one object and just disable every camera besides the one being used so I don't have to keep making triggers?

Any advice is appreciated.


texts:
I'm trying to determine what format the shapes in my 2D game should be stored in and also what software I should use to aid in making the actual shapes.

Up until now I used PhysicsEditor from code'n'web, which saves shape information in XML format. The problem is that the way the file is layed out, it will require a lot of parsing to extract the actual information I'm interested in.

I've made my own "format" for storing shape information (see below). I used JSON instead of XML since it's a lot less verbose. Layed out like this, I require minimal parsing to get the actual information.

{
    "polygons":
    [
        {
            "density" : 1.2,
            "vertices": [
                [0.0, 8.9], [5.6, 7.8], [3.5, 0.0], [3.6, 9.9]
            ]
        }
    ]
}

My question:
Can I configure PhysicsEditor so that it saves shapes in this format automatically? If not, is there some software that allows that kind of configuration?


texts: How can i Randomize Unique Numbers in Java

texts:
So i'm making a game where i have to randomize 52 numbers from 1 to 52 so the order has to change i use this

    class Deck
{
    Random r = new Random();
    int[] Card = new int[52];
}


texts: HTLM5 canvas game (easeljs) slow peformance on ipad (ios7) with phonegap

texts:
I have developed a game with easeljs for HTML5 Canvas. the game is a single HTML5 page with canvas and a lot of javascript.

All this time I tested the app on iOS Safari (iPad3 iOS7) with 40~50 fps via a local server. when I packed in a xcode app with phonegap, it becomes incredible slow near to 10fps.. I noticed the same behaviour when I added the page to homescreen.

There is any way to make make a good performance with html5 canvas app games for ipad (iOS7)?


texts: Making Buildings Transparent When the Player is Behind Them

texts:
I am making a 3D twin stick shooter in Unity and this is a question I need to have answered while I am still in early development. The map my player is in will have very tall buildings that will easily block the player from the view of the camera. There will be no way to change the camera angle to look behind the building so how do I make the building transparent when my player goes behind it?

Any help is appreciated. Thank you.


texts: What engine could I use for a simulation?

texts:
I have a simple requirement:  I want to put some ships (I have some mesh models) on a body of water, with islands, and play with various collision avoidance and command and control algorithms.  So I need a environment where I can modify object behaviour but where the world and its mechanics are already coded.  I was expecting that this would be trivial to find as this is such an obvious requirement for say, AI experimentation.  But I haven't found anything open source or commercial.  I've looked at Glest, Delta3D, Spring, Unity, ORTS, Strive, and VBS2.  I looked for, but never found, the Homeworld Engine.  I also found Breve, Lagoon (seemed perfect), ECSLent, but these were/are either no longer supported or documentation (if it exists) is confusing enough that it isn't clear what can/can't be done or how to go about it.  Interestingly, it seems like you have to roll your own if you have a need eg. Breve, Lagoon.

So I'm putting the question to you:  is there a virtual environment out there, with physics, that would allow a person to focus just on behaviour creation?  What have I missed?  Thanks for any guidance you can provide.


texts: Simple determining starting experience and to next lvl experience for RPG

texts:
I'm a very simple minded person and don't understand how algebraic functions translate into programming, but I'm trying to create a simple lvling system.

In previous threads I read equasions like "level = etc etc...", but instead what's happening is you're selecting the starting lvl of the character you create in an rpg database manager. What's needed then are startingExp and toNextLvl.

So what I've figured out so far (to do this in the simplest form) is:

int startingExp = 0;
for (int x = 0; x < selectedLvl; x++) {
    startingExp += 100 * x;
}

Then:

int toNextLvl = startingExp + (selectedLvl * 100);

It's just a start, but I'm wondering if this is a valid way of going about it? I didn't want to use Math.Log as it takes and outputs doubles, and when people are posting their equasions I'm very confused as how I would translate y = (x ^ 2) into starting exp and starting toNextLvl exp...


texts: How to find the nearest object from another, in a non tile based game where obstacles are present?

texts:
The nearest object means the path from the initial position to this object is shorter than the path from initial position to any other object. The path is the smallest number of pixels this object must move to reach the target object while making sure that it does not collide with any obstacle.

Like in this example below, consider that object A has to determine which object is closer, object B or object C. The pink rectangle is an obstacle. Now if we consider the euclidean distance, object B will be closer but due to the presence of an obstacle euclidean distance will give false answers.

Another solution would be to find the distance using some pathfinding algorithm (like A*), which will give the correct solution, but will be slower than simply calculating euclidean distance.

The ideal solution should give the answer as an object the path to which is no more than 10% larger than to the nearest object. And it should take no more than 10 millisecond on a modestly powered computer to find the nearest object for 1000 different objects on a map that has upto 1000 obstacles of different sizes and the map is no larger than 1000*1000 pixels (like in the image above the nearest object for A is C, for B it is A and for C it is A). Also it should not take more than 50 MB of RAM (excluding the size of RAM used to store the coordinates of objects and obstacles and their sizes).

And the map is dynamic. The solution need not return the path between the objects, it need to only find the nearest object.

What will be the ideal solution of this problem?


texts: Unable to Set Text of another Text Object

texts:
The Idea: Pressing a button in the canvas will allow the player to select a race. A script is attached to an object which is accessed though the OnClick() function of the button.

The script is supposed to get which race is selected based on which button is pressed and fetch a race description in a Text Object named "DescriptionText".

However a description is not displayed, and I get this error:  "NullReferenceException: Object reference not set to an instance of an object
GOnClick.GetRaceDesc () (at Assets/Scripts/GUI_Scripts/GOnClick.cs:24)".

I can't see what I am doing wrong, so here is my code:

using UnityEngine;
using System.Collections;
using UnityEngine.UI;

public class GOnClick : MonoBehaviour {

public string race, description;
void Start()
{
    race = "";
    description = "";
}

void Update()
{
    GetRaceDesc();
}

public void GetRaceDesc()
{
    //Button butnText = GameObject.FindObjectOfType<Button>();
    //race = butnText.GetComponentInChildren<Text>().text;
    *(line 24)* race = gameObject.GetComponentInChildren<Text>().text;
    GameObject descRect = GameObject.Find("DescriptionText");

    if(race == "Dark Elf")
    {
        BaseRace raceSelection = new DarkElfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "High Elf")
    {
        BaseRace raceSelection = new HighElfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Wood Elf")
    {
        BaseRace raceSelection = new WoodElfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Human")
    {
        BaseRace raceSelection = new HumanRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Dwarf")
    {
        BaseRace raceSelection = new DwarfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Orc")
    {
        BaseRace raceSelection = new OrcRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Goblin")
    {
        BaseRace raceSelection = new GoblinRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Tiefling")
    {
        BaseRace raceSelection = new TieflingRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Half Dragon")
    {
        BaseRace raceSelection = new HalfDragonRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }
    else if (race == "Werewolf")
    {
        BaseRace raceSelection = new WerewolfRace();
        descRect.GetComponent<Text>().text = raceSelection.CharacterRaceDesc;
    }

    }

}

Thanks in advance for any help.


texts:
Background: Trying to make a ball appear in the same location the mouse is positioned. Using Box2D Library. Working on a class file (.as)

Issue: The mouse event does not work (I click but nothing happens) . No output errors whatsoever. :(

Mouse Event:

   private function _clicked(e:MouseEvent)
            {
                sim.addCircle({x:mouseX, y:mouseY, radius:0.25, density:5});
                sim.start();

Full Code:

package  {

    import flash.display.MovieClip;
    import com.actionsnippet.qbox.*;
    import flash.events.MouseEvent;

    [SWF(width = 350, height = 600, frameRate = 60)]

    public class MouseTest extends MovieClip {

        public var sim:QuickBox2D;

        /**
         * Constructor
         */
        public function MouseTest()
        {
            sim = new QuickBox2D(this);
            sim.createStageWalls();

            addEventListener(MouseEvent.CLICK, _clicked);
        }

        /**
         * ..
         * @param e MouseEvent.CLICK
         */
        private function _clicked(e:MouseEvent)
        {
            sim.addCircle({x:mouseX, y:mouseY, radius:0.25, density:5});
            sim.start();

        }
    }

}

Download Project (BOX2D Included)

http://gabrielmeono.com/download/BOX2D-Mouse_Test.zip


texts: How to Programm A Dialog box with a typewriter effect in Java?

texts: Im am very new to java and programming so I might be a bit annoying to work with but please bear with me :D So As the title says I'm trying to figure out how to properly program a working dialog box with typing text animation for a game I'm working on. I've seen some posts about swing timers but Im having trouble properly understanding them. If anybody has an idea please share it!


texts: What is the proper way of handling resolution and size units on a 2D game?

texts:
So I started to learn SDL2 and I want to make a simple 2D game.

Now when I render a texture I have to specify in pixels the size of the element I want to draw and also the position in pixels on the window.

It doesn't feels like a good practice to hardcode pixel values because if I want to change the resolution of the window or the aspect ratio it will look really bad.

There is any recommended approach to follow?


texts:
I'm writting a game in C++ and I'm struggling with getting events and game states work together.

By game states I mean something like this

class GameState
{
public:
    virtual void onPause();
    virtual void draw();
    virtual void update();
};

class PauseScreen : public GameState
{
     //stuff
};

class Game : public GameState
{
     //stuff
};

And I've created dope event observer based system where I have simple EventObserver class which has register function to what Event I want to subscribe and EventManager where I have map of vectors of all possible EventObservers (everything made with templates) and callback functions. No pointers, no inheritance - everything works like charm.

So there is my problem - how to connect these? In my main loop I'm getting current active game state - and then updating and drawing it. But for example when state is not active its still receiving event. This is pretty bad beacuse if I have MainMenu gamestate and for example if escape key is pressed it would just exit the game even if I'm currently in Game.

I could only came with some bool checking - if current state is not more active it would disable all EventListeners but I would need to manually call EventListener::disable in all game states for every EventListeners I have in onPause() methods and I don't like this solution (and since it's my hobby project I would like things that I like). I could store EventListeners in vector in GameState interface class so I wouldn't need to disable it manually and just iterate thought it and disable it 'automatically' but I would have to deal with A LOT of templates and naaah I don't wanna do it (just keep it simple).

On the other hand I could add method to GameState handleEvent(Event* event) (well since this is now dynamic memory I would probably prefer to use smart pointers so I don't need to worry when I have to delete event) but then I would have giant switch statement for every game state that I have and this also doesn't seems like good solution. Now I'm just binding one method per one event so everything is nice divided and simple.

So any tips how to design this? Can event observers (or subscribers) work with game states?


texts: Models keep turning white - Unity 5.3.5p1

texts:
I'm using Unit 5.3.5p1 but for some reason my models randomly turn white after I build an exe to run outside the editor.

The textures work perfectly fine within the editor, but as soon as I build and run outside - they sometimes show with appropriate colour, but many times do not and end up blank white.

Does anyone know what might be causing this in general? I've downloaded the latest unity shaders and replaced all current shaders. Currently I'm using the Standard shader only, and it is 100% unmodified.


texts:
In games where you have to use an account to sign in or otherwise authenticate yourself (e.g MMO games), it is often prohibited to share your account with other people.

For example in the World of Warcraft Official Terms of Use Agreement:

  [...] You may not share the Account with anyone, except that if you are a parent or guardian, you may permit one (1) minor child to use the Account when not in use by you. You are liable for all uses of the Account that has been enabled by you […]

And the League of Legends Terms of Use:

  [...] You can’t share your account or Login Credentials with anyone. You can’t sell, transfer or allow any other person to access your account or Login Credentials, or offer to do so. You’re entirely responsible for maintaining the confidentiality of your Login Credentials. [...]

What is the reason for this? Is it because of legal reasons and / or security reasons? I imagine account sharing would not be a problem if there weren't some real-world consequences for the company, not just the end-user.


texts: What is the best way to bake my own environment maps?

texts:
My engine has support for IBL by using pre-obtained HDRIs. It looks fine, but...

I want the environment map to match the scene that is currently being rendered
I want the environment map to take the shadowing of the scene into consideration

To account for this, I wanted to implement something [that I think it is] similar to Unity's reflection probes. My main idea is that instead of using custom HDRIs, I would set some probes in my scene and bake the environment maps myself. This way I could use the baked environment maps for IBL in the real-time rendering.
I think this is feasible, but I could not find any good resource explaining how to properly implement such scheme, so I currently have some broad doubts in my mind such as:

How to capture the light? I think it should be as simple as placing a cube in the probe, rendering the scene 6x for each face and generating the environment map
How to account for the fact that we are interested in the radiance and not the final pixel color? Maybe using floating point framebuffers and account for that in the shading?
Should I implement a raytracing scheme? Since I will be baking the environment maps, I thought that raytracing would be the correct approach here, but I am not sure...
For open environments, how to properly simulate the sky? For IBL, it is important that the sky as a whole has a big radiance, so the object will be properly lit. However, if I simulate the sun as a point-directional light, for example, there will be no shading in the rest of the sky as it is 'empty'... So how to properly simulate the atmosphere?

I know that the question is broad, but I need a first guidance to start implementing and playing with it. Any help is appreciated, as well as tutorials/resources. Thanks!


texts: Handling polygons in multiple nodes of an Octree

texts:
I'm building a 3d software renderer for grins to learn the math and rendering concepts. I've implemented the basic drawing of polygons with some basic optimizations like back face culling and frustum culling. Its going pretty well for it being java and all (15k polygons at 30fps at 1900x1080) but I want to implement an Octree to reduce the amount of overdraw happening and correctly sort the polygons for drawing without using a z-buffer for the entire screen.

I get the basic ideas of how to partition the world and how to traverse the tree from front to back to order the polygons correctly, but I'm a bit confused on how to handle polygons that are in more than one node of the Octree.

Some example cases I'm concerned about are:
A floor of 2 big polygons that intersect all of the nodes at the bottom of the Octree
A polygon that extends across a node boundary
I figure I should split the polygon at the node boundaries, but then do I need to check on each frame for objects that have moved in the world that need recalculation in the Octree.


texts: How to get smooth parallax in a wrap-around world

texts:
I'm working on a multiplayer space shooter a-la Star Control melee. The background of the game consists of several layers of tiles sprites making up a parallax effect of clouds and stars. The player ship is always centered in the viewport.

The game world has a fixed size and implements wrap-around, so that any object that passes the game world bounds is instantly teleported to the other side.

To make the transition seamless when reaching game bounds ,  all objects but the player ship are also rendered outside the game bounds if they are on the other side of the screen. This makes chasing a ship,  for example feel seamless.

Right now the x and y values of the background tile offsets are determined by the position of the player ship in the game world.

bg1.tilePosition.x = -playerShip.x * 0.01;
bg1.tilePosition.y = -playerShip.y * 0.01;

bg2.tilePosition.x = -playerShip.x * 0.02;
bg2.tilePosition.y = -playerShip.y * 0.02;

My problem is with the parallax background when the player reaches the game world bounds. If the ship jumps from x  position 1000 to position 0, for example,  then all the tile positions jump resulting in a jerky movement.

In the following gif I made a semi white transparent background for the game world so you can see exactly the parallax jump as soon as the purple ship wraps around the game world:

How can I avoid this so that the parallax background is always smooth?

Things I've thought of:

Not changing the position of the player when it wraps around, then use a modulo of the game world size for positioning. I can't do that because it will make the game data dirtier and harder to work with plus it increases network bandwidth which I want to avoid
Tying the tile offset to input. The player ship can move without input from collisions/inertia so that's no help


texts: Difficulty researching dynamically posable characters for game box art template scene

texts:
I want to buy something specific but I don't know what to call it or how to find it.
I recently had an idea for cover art for my 3D game: I want to buy a scene of dynamically posed characters and swap in my characters to quickly and easily create cover art for my game. The problem is that I don't know what to search for to find such a thing.
What are my options for generating this sort of template scene from my game box art?
Here are some of my failed research attempts using the DuckDuckGo search engine:

Scene of dynamically posed characters: This just yields sleazy articles about celebrities
Where can I buy a scene of dynamically posed 3d characters?: This results in 3d model marketplaces
Character poser: This leads to apps that help artists create 3D drawings.
Posed action scenes 3d: This results in more art apps and an interesting GitHub that uses machine learning to translate pictures into Unity scenes.


texts:
I am developing a 2D game for windows phone using C# and XNA. I have a list of screens managed by an engine. each screen has a list of components like 'camera', 'skyBackground', 'landBackground', 'units' and so on. All those components inherit from an interface 'IComponent' which has the following:

public interface IComponent
{
    void Initialize();

    void Update();

    void Draw(Camera camera, Color tint);

    BoundingBox BoundingBox { get; }
}

This has it advantages and disadvantages. It unifies all game objects so i can treat them the same, but creates some harmless but still annoying issues like having plenty of empty initialize functions, or a camera with an empty draw method, or a UI class that doesn't need the camera as a passed in parameter to draw in the 'Draw' function but takes it anyways and so on.

I then thought of creating a number of interfaces like 'IUpdate', 'IInitialize', 'IDraw', 'IBoundingBox' and having my screens store a list of 'object' rather than a list of 'IComponents', and then in the update method i would do as follows:

foreach object obj in objects
    if(obj is IUpdate)
        ((IUpdate)obj).Update();

But I don't know how the 'is' command works behind the scenes, maybe its a costly feature which shouldn't be called each frame for all objects in each loop.

So am not sure what to do here, should I accept a unified interface with the few currently harmless kinks it introduces or use my 2nd idea? or maybe you could suggest another alternative?

Thanks a lot


texts: Switching between Discrete and Integrated GPUs

texts:
I have a machine with two discrete GPUs and one integrated GPU. I can currently switch between them using NVIDIA's software, but I would like the ability to do so within my applications for purposes of benchmarking and general convenience. Apparently this requires the "NDA version" of NVIDIA's Driver API, which I know not how to obtain. Would using this API be the only way to accomplish what I seek, and if so, how would I obtain it? A solution using Windows APIs would also be acceptable, though less preferable to one which would leverage a cross-platform API. I have created a similar thread concerning the matter on NVIDIA's forum, which is down at the time of this writing.

Thanks for reading my question; it is much appreciated!

Edit: Here's a link to the original post I made on the NVIDIA forums - no luck on either site yet, though.


texts: glsl 150 struct in uniform buffer object

texts:
Can I do this in opengl 3.2 / glsl 150?

glsl shader:

struct LightSource {
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec4 position;
    vec4 direction;
};
...
layout(std140) uniform LightSources {
    LightSource lightSources[ 1 ];
};
...

And if so, how do I actually bind the data (using c++)?

I've got data binding working for this uniform:

layout(std140) uniform LightSources {
    vec4 ambient;
    vec4 diffuse;
    vec4 specular;
    vec4 position;
    vec4 direction;
};

I'm just not sure how to extend it to use an array of structs instead of binding 5 vec4s.


texts: How can I make this shader background more efficient?

texts:
I want to use a shader as a background for a mobile game. I'm using libgdx for my project. I've never written glsl before, but here's my attempt so far:

http://glslsandbox.com/e#22332.13

On desktop the code runs fine, but on mobile it can be a bit slow sometimes. I have read that using built in functions reduces branching, so I tried to use mix and smoothstep instead of if statements.

I'm also not sure if I am rendering the shader correctly in the first place.

First I'm creating a TextureRegion:

fbo = new TextureRegion(new FrameBuffer(Pixmap.Format.RGB888, width, height, false).getColorBufferTexture());

Then I create a rectangle mesh, and render the shader as 2 triangles on the mesh. The device/window resolution is also passed to the shader as a uniform.

Then I am calling batch.setShader(background); and finally batch.draw(fbo, 0, 0, width, height);

Is there a better way I can achieve this?

Code from the link above:

#ifdef GL_ES
precision mediump float;
#endif

uniform float time;
uniform vec2 mouse;
uniform vec2 resolution;
//created 1/15/2015 by alex booth

const vec3 sky_top_color = vec3(90.0/255.0, 200.0/255.0, 190.0/255.0);
const vec3 sky_bot_color = vec3(235.0/255.0, 235.0/255.0, 215.0/255.0);

const vec3 hill_1_color = vec3(170.0/255.0, 210.0/255.0, 205.0/255.0);
const vec3 hill_2_color = vec3(150.0/255.0, 190.0/255.0, 185.0/255.0);
const vec3 hill_3_color = vec3(110.0/255.0, 142.0/255.0, 135.0/255.0);

void main(void) {
    vec2 pos = (gl_FragCoord.xy / resolution.xy);

    float hill_1 = 0.060*sin(pos.x*6.0+time*0.100)*sin(time*0.10)+0.55;
    float hill_2 = 0.075*sin(pos.x*6.0-time*0.090)*sin(time*0.12)+0.45;
    float hill_3 = 0.100*sin(pos.x*6.0+time*0.095)*sin(time*0.14)+0.30;

    //sky, far, middle, and closest
    vec3 color = mix(sky_bot_color, sky_top_color, smoothstep(hill_1, 1.0, pos.y));
    color = mix(color, hill_1_color, smoothstep(hill_1 + 0.004, hill_1, pos.y));
    color = mix(color, hill_2_color, smoothstep(hill_2 + 0.004, hill_2, pos.y));
    gl_FragColor = vec4(mix(color, hill_3_color, smoothstep(hill_3 + 0.004, hill_3, pos.y)), 1.0);
}


texts: Android, apply a pixelshader on a canvas

texts:
Can an opengl pixelshader be applied on a Canvas?

I want to render a bitmap on a canvas, then apply a pixelshader to get, for example, a blur effect. Is this possible?

I don't want to simulate the blur effect by creating a new bitmap and then blur this from java code because i'd like to be able to re-use the shaders in openGL apps too.


texts:
I'm creating a Fez-based HTML5 Canvas game and animating my hero image using sprite sheets. The problem is that I can't create the animation of the hero walking, don't matter how much I try, the output is a weird animation that looks like the hero is just shaking its legs. Can someone help me? You don't need to create the sprite sheet for me if you don't want, just show me what's the correct leg position. I'll post the game link in a comment because I can't post more than two links.

Note that the "hero's legs" are compound by 3 pixels each, that are 2x up scaled.

Here is the sprite sheet:

the walking animation is compound by the 6 first frames.

EDIT: If you fall in the demonstration, open the console, type localStorage.x = localStorage.y = 0; and then reload the page immediately to return to the starting point.


texts: OpenGL: Is it possible to use VAO's without specifying a VBO

texts:
On all the tutorials I can find about VAO's (Vertex Array Objects), they show on how to use them by configuring vertex attributes and binding a VBO (Vertex Buffer Object). But I want to create a VAO that will be configured for a set of VBO's in combination with a fixed shader, where each buffer uses the same data pattern (vertex, uv, color, etc). So, I want to create one VAO for multiple VBO's that will be drawn using one shader.

I couldn't find any demo on this, so I decided to just give it a try. But it doesn't work and crashes on the glDrawArray call. It looks like the VBO isn't bound. Here is the code I'm using:

Rendering:

/* Prepare vertex attributes */
glBindVertexArrayOES(vao);

/* Upload the buffer to the GPU */
glBindBuffer(GL_ARRAY_BUFFER, pool->next());
glBufferSubData(GL_ARRAY_BUFFER, 0, parts * buffer.stride() * 6, buffer.getBuffer());

/* Draw the triangles */
glDrawArrays(GL_TRIANGLES, 0, parts * 6);

glBindVertexArrayOES(0);

VAO Creation:

glBindVertexArrayOES(vao);

glEnableVertexAttribArray(ls.position);
glVertexAttribPointer(ls.position, 2, GL_FLOAT, GL_FALSE, buffer.stride(), 0);

glEnableVertexAttribArray(ls.color);
glVertexAttribPointer(ls.color, 3, GL_FLOAT, GL_FALSE, buffer.stride(), GL_BUFFER_OFFSET(buffer.dataTypeSize * 2));

glBindVertexArrayOES(0);

Where ls is a simple struct that holds the attribute locations.

In the Rendering part, swapping the glBindBuffer and the glBindVertexArrayOES around didn't work either.

So, the question is: Is it even possible to do so, or will I have to create for each buffer a VAO? And if I have to create a VAO for each VBO, is it possible to update the VBO's data using glBufferSubData in combination with a VAO?


texts:
I have a camera class in my code which stores two 4x4 matrices. One for the view matrix and one for the projection matrix. Originally, I had two floats in the class for pitch and yaw and these were updated based on keyboard and mouse input. Then on update I would do something like this to set the view matrix:

Matrix33 xRot = Matrix33::CreateRotationX(m_pitch);
Matrix33 yRot = Matrix33::CreateRotationY(m_yaw);

Matrix33 rot = xRot * yRot;

const Vector3& rUp = rot.GetColumn1();
const Vector3& rForward = rot.GetColumn2();

m_viewMatrix = Matrix44::CreateLookAt(m_position, m_position + rForward, rUp);

However, I'm now wanting to add roll to the equation but I know that if I carry on using this method I'm going to run into gimbal lock. I do have a function in my maths library to rotate about an arbitrary axis. The function definition is:

static Matrix33 CreateRotation(const Vector3 &rAxis, const float rad);

But I'm not sure, based on pitch/yaw/roll how to create the arbitrary axis to rotate around. This got me thinking that perhaps pitch/yaw/roll isn't the best way to be doing it so I thought I'd ask on here about what might be the best way? I don't even have to use CreateLookAt(), it just seemed easier at the time :)

I don't have a quaternion class yet but I could add one if that would be the best way. I think ideally I'd rather do it with just matrices for now, though.

Any help would be much appreciated.


texts: Techniques for benchmarking code running on the Sega Genesis' 68000 CPU?

texts:
I'm playing around with writing code for the Sega Genesis, which uses a Motorola 68000. I'm not an assembly code guru by any means so I'm writing in C and using SGDK. As it's slower than assembly, I'd like to be able to benchmark so that I can find slow spots and optimize them as much as I can. But I'm at a loss of how to do that. It doesn't look like the CPU has any timers or ticks that I can use. Any ideas?

One idea I've got is to find the code I want to benchmark and set it to run 1000 or 10,000 times, and have something visible happen when it's done. Because it's looping many, many times, the amount of time it takes is measurable with a stopwatch. Not the most friendly way, but it might be possible to use in some cases.


texts: Why the transform is not moving back to the originPos(Original Position)?

texts:
using UnityEngine;
using System.Collections;

public class Move : MonoBehaviour
{
    public Transform target;
    public float rotationSpeed;
    public float moveSpeed;

    private Vector3 originPos;
    private Quaternion originRot;

    private void Start()
    {
        originPos = transform.position;
        originRot = transform.rotation;
    }

    private void Update()
    {
        var distance = Vector3.Distance(transform.position, target.position);
        if(distance < 0.1f)
        {
            transform.rotation = Quaternion.Lerp(transform.rotation, originRot, Time.deltaTime * rotationSpeed);
            transform.position = Vector3.MoveTowards(transform.position, originPos, Time.deltaTime * moveSpeed);
        }

        transform.rotation = Quaternion.Lerp(transform.rotation, target.rotation, Time.deltaTime * rotationSpeed);
        transform.position = Vector3.MoveTowards(transform.position, target.position, Time.deltaTime * moveSpeed);
    }
}

At this line if the distance is less then 0.1f it should start moving back to the original position but the transform is not moving it's just staying at the same place :
transform.position = Vector3.MoveTowards(transform.position, originPos, Time.deltaTime * moveSpeed);


texts: I'm having very negative thoughts, can you help me?

texts:
I'm 27 years old and I recently started vocational studies for app development. The first year is mostly about introduction to c# programming and also a light introduction to html and javascript. I have never studied anything related to coding before.

I know how to make pixel art , music and sounds, but coding is just so difficult for me. My objective in life right now is to make a very simple game and I feel so frustrated because I can't achieve anything. I have even tried things like stencyl or construct 2 but even that kind of software I can't understand it enough to make a very simple game.

I'm breaking all the rules here, but, can you help me? I read about people that are like 2 months into coding and are already making games. Am I too dumb? Should I just quit altogether?


texts: Sprite batching and dealing with isometric depth sorting

texts:
So I'm using Love2D which uses SDL2* as far as I'm aware and I have a question about texture atlases & spritebatching.

I have an isometric chunk, with 2 layers, terrain and objects (trees, buildings, units). The terrain is not animated and the tiles are 32x16, they fit perfectly even in a 1028x1028 texture atlas.

However the object spritebatch\layer is a different thing. I have trees, that are animated and each frame uses up to 200x200 space in the atlas. You can see the problem. Now, I think I can fit all of it in a 8192x8192 texture and this is OK for my GPU, which is entry level (GT 720). It gets stored in the VRAM.
So I conducted some test and imported a 10k x 10k image, the GPU could not handle it, and it was loaded onto the RAM.
What exactly happens here? How much is the performance loss, I'm about to test, but is this going to cause any incompatibility problems? Other than the 300MB RAM usage instead of VRAM.

Now, you might state the obvious, "Why not use 2 or more texture atlases?".
I don't know if I'm doing things wrong, but I want to use sprite batches for the object layer, and the way I'm drawing it is this:

function update_objects()
  object_batch:clear();
  for i=0,chunk_width-1,1 do
    for o=0,chunk_height-1,1 do
      object_batch:add(
                        tile_quads[objects_chunk[i][o]],
                        (i - o) * tile_width  * 0.5,
                        (i + o) * tile_height * 0.5
                        - tile_offset[objects_chunk[i][o]]);
    end
  end
  object_batch:flush()
end

In order to deal with the depth issue that isometric games have, I simply draw furthest to closest. As far as I'm aware, sprite batches can only use 1 texture atlas, and I confirmed that by tests.
Of course, there's a draw call that draws the sprite batch. I'm ok with several draw calls (units, buildings, environment in 3 separate batches for example), but I don't see how I will deal with the depth issue if I do go that way.

*(not OpenGL as I previously stated)

Any ideas?


texts: Procedurally generating dungeons using predefined rooms

texts:
Most attempts at procedurally generating dungeons I have stumbled upon do space out areas that will be rooms and connect them will corridors and hallways but what about instances where you have a collection of possible rooms in various dimensions and want to generate a dungeon that uses some of these specific rooms without those corridors and connections? To answer this question I found this particular video on the topic of generating levels in Path of Exile (~5:20 - ~7:20 about the dungeon part I am referring to) which left questions open on how to technically implement the algorithm described.

In general I understand the idea but I am struggling to figure out how this would be translated into code (most efficiently) and therefore here are a few questions:

When he shows how the entire level is sliced up I could not come up with a graph that would allow to represent this structure. My naive approach would be to have the entire level consist of 1x1 rooms and arbitrarily merge nodes in the graph to form rooms of valid dimensions (valid = there is a predefined room that can be inserted there later on). What would be a suggested approach to this?
Coloring the rooms should be just assigning random distances (in a given interval) to edges of connected nodes and just applying Dijkstra to find the sequence of rooms from start to finish I presume?
When he adds branching rooms I noticed that they do not allow another alternative path to the exit (which could be random of course) but how would one implement the branching? Just a recursive traversal with diminishing chances of continuing deeper into the graph?

Description of the algorithm in the video

Step 1. Place a start and end room arbitrarily into the level (presumably with a given minimum distance to prevent degenerate layouts):

Step 2. Slice the entire level into areas that have exactly the sizes of your predefined rooms:

Step 3. Assign each room a random weighting/distance which is depicted with colors in this example:

Step 4. Find a shortest path to get a nonlinear path from start to end:

Step 5. You have your basic layout with a single successful path in which you can place random rooms of corresponding sizes that have to be connected with appropriate doors:

Step 6. Finally, add some branching rooms:


texts: What are the differences between all RPG Maker products?

texts:
I can't find a complete chart of differences between the many versions of RPG Maker. There's only a partial list of features here.

On the official site there are:

RPG Maker MV
RPG Maker VX Ace
RPG Maker VX
RPG Maker XP
RPG Maker 2003
GG Maker
IG Maker

I might have missed some versions because there are so many and their names are pretty similar.


texts:
I have a game that I am writing in Java. It is a top down RPG and I am trying to handle movement in the world. The world is largely procedural and I am having a difficult time tackling how to handle character movement around the world and render the changes to the screen. I have the world loaded in blocks which contains all the tiles.

How do I tackle the character movement?

I am stumped and can't figure out where I should go with it.

EDIT:
Well I was abstract with the issue at hand.

Right now I can only think of rigidly sticking everything into a 2D array and saving the block ID and the player offset in the Block or I could just "float" everything and move about between tiles so to speak.


texts: How to make a snake game where each snake tile follows it's connected tile

texts:
I want to make a basic snake game. It has a head and a series of tails that occupy a tile in a grid. The first tail in the series is adjacent to the head. and each tail that comes after is adjacent to the previous tail. Head can move in four directions and the first tail moves to head's previous position, and each other tail moves to the previous position of the previous tail, as they follow each other.
How can I model this as data, and update it for movement.
I've tried this but that's a little doesn't work.
p = {
  x=0,
  y=0,
  tails={}
}

function init_tail(dx,dy)
   return {
      x=0,
      y=0,
      dx=dx,
      dy=dy
   }
end
-- Initialization
add(p.tails, init_tail(0,1))
add(p.tails, init_tail(0,1))
add(p.tails, init_tail(0,1))

local last = p
for tail in all(p.tails) do
   local tx = last.x + tail.dx
   local ty = last.y + tail.dy
   tail.x = tx
   tail.y = ty
   last = tail
end
-- Movement
local last = p
for tail in all(p.tails) do
   tail.dx = -last.dx
   tail.dy = -last.dy
   local tx = last.x + last.dx + tail.dx
   local ty = last.y + last.dy + tail.dy
   tail.x = tx
   tail.y = ty
   last = tail
end

This is what I have so far:


texts:
I am currently developing a GUI app using OpenGL with OpenTK as interface in C#.

The viewport is set to the entire window space (0,0,width,height) and an ortho transformation is applied like this:

GL.MatrixMode(MatrixMode.Projection);
GL.LoadIdentity();
GL.Ortho(0, width, height, 0, 0f, 1f);

With this I can draw objects just like I would do in GDI+ using X,Y coords.

The issue appears when I want to clip elements within their parent's area. I am doing it using glScissor. I am using a stack to keep trace of the scissored areas like so:
static Stack stack = new Stack();

internal static void Scissor(Rectangle rect)
{
    applyScissor(rect);
    if (stack.Count == 0) GL.Enable(EnableCap.ScissorTest);
    stack.Push(rect);
}

internal static void RemoveScissor()
{
    if (stack.Count == 0) throw new Exception("Unblanaced stack.");
    stack.Pop();
    if (stack.Count == 0)
    {
        GL.Disable(EnableCap.ScissorTest);
    }
    else
    {
        var rect = stack.Peek();
        applyScissor(rect);
    }
}

static void applyScissor(Rectangle rect)
{
    GL.Scissor(rect.X, rect.Y, rect.Width, rect.Height);
}

It works fine whenever the height is "big" enough but if the values for the height given to the scissor are "small" it doesn't work.

Example without scissors:

Example with scissor

Example when I scissor with half the needed height:

(In the last case I cannot understand why it shows the bottom half instead of the top half.)

Basically there is an element (the blue box and the text) within the red box with a blue border that should be clipped within and there should be only a small portion of the A visible but at the very least the blue rectangle should be visible. However it is not. :/
The scissor test does work fine however if the height is "big" enough as I mentioned, being able to move the red box with blue borders outside the area of its parent and it wouldn't be visible.

I need to know why that is and how to fix it.

PS. The issue is not only on OS X so it's not the platform.

PS2. I did check the values given to the scissor and they are correct. The area of the red box with blue border is 175,20 with size 36x36.


texts: Why does the shader compiler reorganize my code in loops and branches?

texts:
I noticed something strange while inspecting my compiled shader assemblies, that if I put some buffer loads inside an if statement or a loop, then the resulting assembly will be organized much differently then if outside a branch or loop.

Consider this example:

StructuredBuffer someBuffer<Type>:register(t0);
// ...
float4 pos;
// ...
if (statementIsTrue)
{
  float4x4 world = someBuffer[index].matWorld;
  pos = mul(pos, world);
}

The mul gets compiled to something like this:

0x000000B8:   ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r0.yzw, r0.x, l(4), t0.xxyz
0x000000E4:   ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r1.xyz, r0.x, l(20), t0.xyzx
0x00000110:   ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r2.xyz, r0.x, l(36), t0.xyzx
0x0000013C:   ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r3.xyz, r0.x, l(52), t0.xyzx
0x00000168:   dp3 o0.x, v0.yzwy, r0.yzwy
0x00000184:   dp3 o0.y, v0.yzwy, r1.xyzx
0x000001A0:   dp3 o0.z, v0.yzwy, r2.xyzx
0x000001BC:   dp3 o0.w, v0.yzwy, r3.xyzx

Then when I leave the if branch, the whole thing just gets reorganized:

0x00000090: ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r1.xyzw, r0.x, l(0), t0.xyzw
0x000000BC: dp4 o0.x, v0.xyzw, r1.xyzw
0x000000D8: ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r1.xyzw, r0.x, l(16), t0.xyzw
0x00000104: dp4 o0.y, v0.xyzw, r1.xyzw
0x00000120: ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r1.xyzw, r0.x, l(32), t0.xyzw
0x0000014C: ld_structured_indexable(structured_buffer, stride=128)(mixed,mixed,mixed,mixed) r0.xyzw, r0.x, l(48), t0.xyzw
0x00000178: dp4 o0.w, v0.xyzw, r0.xyzw
0x00000194: dp4 o0.z, v0.xyzw, r1.xyzw

Also notice how the dp3 instructions got changed to dp4s, which is also confusing to me.

This also happens with loops. Unrolled loops however act like the second case without the brach.

What could be the reason behind it all and does it matter?


texts: What are some good resources for building a voxel engine?

texts: What are some good resources (tutorials, code, papers, etc.) for learning about voxel rendering?


texts: Would like some help in understanding rendering geometry vs textures

texts:
So I was just pondering whether it is more taxing on the GPU to render geometry or a texture. What I'm trying to see is whether there is a huge difference in rendering two scenes with the same setup:

Scene 1:
Example Object: A dirt road (nothing else)
Geometry: Detailed road, with all the bumps, cracks and so forth done in the mesh

Scene 2:
Example Object: A dirt road (nothing else)
Geometry: A simple mesh, in a form of a road, but in this case maps and textures are simulating cracks, bumps, etc...

So of these two, which one is likely to tax the hardware more? Or is it not a like for like comparison?

What would be the best way of doing something like this? Go heavy on the textures? Or have a blend of both?


texts:
I am creating a 2D game using OpenGL and orthographic projection. For sprites, I use textured quads (actually two triangles).

I want the pixel art textures for the sprites to be displayed in a multiple of the original size to avoid blurry textures.

How can I set up a pixel-perfect camera using OpenGL and orthographic projection?
After doing so, how do I size the qauds?


texts: How can I access game instance data in a window procedure callback?

texts:
In the window procedure message processing function, I have come across a couple of things where I just have no idea what to do apart from declare a class globally so that my window procedure can see it.

Imagine I have a Game class that is created in the window loop function and has a handle to the window passed through into it:

class Game
{
    game( HWND hWnd );
    void Go();
    void ReCalculateViewportOffsets();
}

...// windows stuff and handle to window created
Game theGame( hWnd );
...// windows loop starts
theGame.Go();

Half-way through my game, someone changes the resolution so I need to fire a redraw with new offsets to center my viewport... I  would like to call that from my WM_RESIZE handler, but theGame has been declared as a local in my main function rather than a global. Probably a good thing? but how on earth can I get hold of theGame in my windows procedure function without declaring it globally:

case "WM_RESIZE":
    //...
    theGame.ReCalculateViewportOffsets( newWidth, newHeight );


texts: how to calculate sky color hue in a specific way?

texts:
I have a day cicle in my game.
I want to add a bluish hue to my terrain in the early morning and evening-night.
I want to start transitioning from 0 hue color to the full hue color at 20 PM and reach the full color at 0 AM, then start fading back and reach 0 hue color at 7 AM.

Given a time of day in hour and minute, or seconds, how can I write a function to calculate the hue color correctly?


texts: How can I make a self-updating game launcher?

texts:
I have been creating a game with java, and before I release it I wanted to make a launcher that is connected to the game's website.

Basically I need to make a launcher that updates itself when I have changed the content.

Unfortunately I have no idea on how to do this. There would be a description in the main launcher which only I can change, and a large play button that will close the launcher and run the game. If I have changed the description, then it will change on the website download, and on the copy that anyone else owns (anywhere).

So, because of my lack of knowledge on this topic, does anyone know how I'm supposed to do this, and how it would work?


texts: Art asset creation workflow question: are there any neat ways to save your work and automatically export it to desired format?

texts: To be specific: I have used GraphicsGale for pixel art sprites. The program saves its files in its own format (.gal, I believe), but the images in my game have to be .png. Saving it to .png loses information for GraphicsGale, like the palette. Manually keeping to seperate files impairs the workflow. Ideal would be that after every save,  the original file is saved in one folder, and a .png export in another, awaiting runtime and packing. Any suggestion/thoughts?


texts: What causes this InvalidOperationException when drawing primitives?

texts:
I'm working on implementing a 2D masking effect in my current game. To do so, I have two textures, one for the source image and one for the mask. The source image is just a regular texture, so that's easy. The mask I'm generating by rendering to a render target through the use of graphicsDevice.DrawUserIndexedPrimitives, but when I try, the following error pops up.

This is the function that attempts to render to the mask's render target. Vertices are of type VertexPositionColor.

private void RenderMaskTarget(SpriteBatch sb)
{
    graphicsDevice.SetRenderTarget(maskTarget);
    graphicsDevice.Clear(Color.Transparent);

    sb.Begin(SpriteSortMode.Deferred, null, null, null, null, basicEffect, camera.Transform);

    graphicsDevice.DrawUserIndexedPrimitives(PrimitiveType.LineStrip, vertices, 0, vertices.Length, indexData, 0, primitiveCount);

    sb.End();
}

And this is the function that creates my basic effect.

private void CreateBasicEffect()
{
    Matrix projection = Matrix.CreateOrthographicOffCenter(0, Constants.ScreenWidth, Constants.ScreenHeight, 0, 0, 1);
    Matrix halfPixelOffset = Matrix.CreateTranslation(-0.5f, -0.5f, 0);

    basicEffect = new BasicEffect(graphicsDevice)
    {
        World = Matrix.CreateOrthographicOffCenter(0, graphicsDevice.Viewport.Width, graphicsDevice.Viewport.Height, 0, 0, 1),
        View = Matrix.Identity,
        Projection = halfPixelOffset * projection,
        VertexColorEnabled = true,
        LightingEnabled = false
    };
}

I've searched everywhere I can on this site and Google in general, but nothing I've tried has worked. I think my problem is a fundamental misunderstanding of what the exception above actually means. Based on its wording, the current vertex declaration doesn't include all required elements, and it then goes on to list the elements I do have, but it doesn't tell me what the required ones are. Further, where is the current vertex declaration defined? Is it VertexPositionColor that defines it or the BasicEffect?

I realize that similar questions to this have been asked before, but like I said, no solutions I've seen have worked. I think part of that is XNA vs. Monogame, where an XNA solution might not work for Monogame. I apologize if this is a true duplicate question.

Thank you :)


texts:
I see that there's a way to get each animation clip like the following, but is there a way to get all of the animations in a given project and play/stop them at the same time?

public class Anim: MonoBehaviour {

protected Animation anim;

// Use this for initialization
void Start () {

    anim = GetComponent<Animation>();

}

void PlayAnimation
{
    if ()//some sort of condition
    {
        anim.Play ("Roll Dice");
    }
    else {
        anim.Stop();
    }
}


texts: Why do my particles appear darker the farther I get from them?

texts:
I've created the following material:

I've set up a particle system that places that material around like a cloud:

Up close, I'm getting the result I expect:

But if I go far enough, it looks like this:

Why do these dark areas appear and why are they more pronounced as I look at them from farther and farther away?

I know I can make this go away by increasing environment lighting or making the material more emissive. Do I have more options beyond these two?


texts: How do I deal with timeout detection and recovery in D3D?

texts:
What is exactly measured when checking TDR in Windows? What do I need to do in my D3D11 app to tell TDR that long rendering is okay? I've already split the workload into smaller batches, but how do I tell TDR when this batch begins and when it ends?

I know that IDXGISwapChain::Present method will do this for me, but is it the only way?
Is ID3D11DeviceContext::Flush method doing the same thing?


texts: State Machine class vs function pointers

texts:
What do you guys recommend to use?
A State Machine with function pointers or classes?

Or, in which case one would be better than the other one?

At work we use the state machine with function pointers only and I've never tried to use one with classes before.


texts: Game Scripting Example in any scripting language

texts:
If i have to create a Battle System for a game which is like Final Fantasy 10 Turn Based battle system or Shadow Hearts Ring Based Battle System and likewise.

How should i start with scripting a particular part of the game? Any reference,blogs,sources,code snippets will be helpful.

Any scripting language will do as i have to overlook some examples directly of different scripting languages.

Please try to provide a small example of scripting for some part of game say cutscene,battle,combat system etc. in UnrealScript.


texts: What would be the level of effort required to implement a screencapture command on a PS3 game?

texts:
Looking to see what the level of effort is for implementing a screen capture command into PS3 game by a mid-level PS3 game developer.

Bonus for a description of what is involved in the process...

EDIT

Not sure how to get back my question since it was the first but let me clarify some things. @Nate Bross, nope I am not the actor although i've fielded calls for him on occasion

@coderanger my intent was to try and speak to other PS3 developers, however coming from a web development no one in my social circle close or extended develops on the PS3. Additionally i'm interested in hearing the effort required in terms of hours so that this information can be passed on to a client. A client who has a game on the PS3 using the unreal engine. Convo with devs sometimes go something like "can you implement feature a" which gets a response "this will take us 8 weeks and an army". Trying to be educated before the ask. I hope that helps

If anyone here is a PS3 game dev and would like to respond off site so as not to break NDA that would be awesome.

@Roger it would be from within the game, something that users can use. Something akin to the iphone screencap utility. No need to get fancier than that.


texts: Random map generation - strategies for scattering/clustering random nodes

texts:
I am doing a simple 4X strategy game in space where each node is a point-of-interest (a planet, an asteroid and etc.).

To randomly generate a map, I would follow the steps below

Decide how many type of each nodes the map will have (perhaps, say, 5 Earth-like planets, 10 barren planets etc.)
Place each type of node on the map.

For step 2 I would like to have an even spread of each node type. So for example, I would start by placing all the earth-like planets. If I simply do a rand(map.width, map.height) to determine the position, I may end up all the earth-like planets clustering together, which will give advantage to the player who starts in that area.

Are there any methods, such as using different graph functions or noise function, which could generate a sequence of (x,y) coordinates which are spread out from each other. Likewise, are there any ways to generates coordinates which are close to each other?


texts: How can I manage the deceleration of units so that they arrive on-target?

texts:
When I first started trying to set up my air units' movement in my RTS game, I thought it was going to be easy with simple Euler method linear acceleration. This was far from the case as the ship would have to slow to a halt on exactly the target destination, as well as properly compensate after a sharp turn.

How would I decelerate my unit exactly onto the target destination and properly compensate for changed destinations while still factoring in the current velocity in a 2D simulation (Positions and velocity stored in 2D vectors)?

StarCraft 2 does this well, and I'd like to arrive at a similar effect. I want something like shown here. Acceleration can be seen at 0:20. Turning and maintaining momentum can be seen at 1:25. Deceleration can be seen at 1:55. (Find these times in recent comments of the video).

Note: I'm using a lockstep model and frame rate can be either 5 or 10 per second depending on players' computer abilities.


texts: Why are games built on cross-platform engines sometimes exclusive to Windows?

texts: If an engine supports Windows, OS X, and Linux, why do we sometimes see games using these engines, like Space Hulk: Deathwing, restricted to Windows only?


texts:
I'm having an issue with sprite movement, and I'm not sure how to deal with it.

When I set a destination for my player sprite (by clicking the screen), it sets the player moving in that direction. Unfortunately, the player sort of oscillates. He sort of shivers along the path.

I've set up a test project using just graphics primitives (graphics.fillRect(x,y,w,h)), and it's really easy to see. Here's an example:

My code looks like this

public void tick() {

    if (InputHandler.leftClick.heldDown) {
        dest.setLocation(InputHandler.leftClick.xPos, InputHandler.leftClick.yPos);
    }

    direction.setLocation(dest.getX() - position.x, dest.getY() - position.y);
    direction.normalize();
    position.add(direction.multiply(velocity));
}

This is a really really basic movement system because I'm having the same issues elsewhere and I wanted to work on them in a more controlled environment.

The weirdest part about this is that when the player arrives, he still just sits on one point, shivering madly.

Can anyone help?


texts:
Does anyone know a better controller for 2D Games than a virtual on screen joystick? The pros of the joystick are:

Easy to implement for developers
Familiar interface for users

But there is a huge con:

The screen is obscured by thumbs.

And also, is there any library for a quick implementation of virtual joysticks for Libgdx?


texts:
I want to implement a "knockback" in my 2D game, but I have no idea how to do it. I've found some tutorials on google but nothing help. (My knowledge about math is a little limited when we're talking about Cartesian plane)

Well let's just figure out, I have the player and the monster on my map (2 vectors) and when I touch the monster, BOOOM, I get "knockbacked" at the OPPOSITE direction (not left, right, top or bottom) that I touch him.

I have the following code on my project:

CollisionManager.cpp

CollisionManager::CollisionManager()
{
}

CollisionManager::~CollisionManager()
{
}

bool CollisionManager::checkCollisionWithWall(SDL_Rect box, std::vector<Tile*> tiles)
{
    return touchesWall(box, tiles);
}

void CollisionManager::checkCollisionEnemy(Player * player, GameObject * enemy)
{
    if (enemy->type() == std::string("Enemy"))
    {
        return;
    }
    if (SDL_HasIntersection(&player->getCollisionBox(), &enemy->getCollisionBox()))
    {
        player->collision(enemy);
    }
}

The player's collision function (almost nothing here):

void Player::collision(GameObject* collisionObject)
{
    isKnockbacking = true;
    hp -= 2;

}

Ahh and my moving function is inherited from my Entity class:

void Entity::checkTileCollision(std::vector<Tile*> tiles)
{
    if (isKnockbacking == false) {
        //Move the dot left or right
        v2DPosition.m_x += v2DVelocity.m_x;
        collisionBox.x = v2DPosition.m_x;

        //If the dot collided or went too far to the left or right
        if ((v2DPosition.m_x < 0) ||
        (v2DPosition.m_x + 18 > Game::Instance()->getScreenWidth()) ||
        collisionManager->checkCollisionWithWall(collisionBox, tiles))
        {
            //Move back
            v2DPosition.m_x -= v2DVelocity.m_x;
            collisionBox.x = v2DPosition.m_x;
        }

        //Move the dot up or down
        v2DPosition.m_y += v2DVelocity.m_y;
        collisionBox.y = v2DPosition.m_y;

        //If the dot collided or went too far up or down
        if ((v2DPosition.m_y < 0) ||
        (v2DPosition.m_y + 18 > Game::Instance()->getScreenHeight()) ||
        collisionManager->checkCollisionWithWall(collisionBox, tiles))
        {
            //Move back
            v2DPosition.m_y -= v2DVelocity.m_y;
            collisionBox.y = v2DPosition.m_y;
        }
    }
}

I've followed LazyFoo, SDL Game Development book and some other tutorials on YouTube to make it.

If I need to be more specific, just tell me.