Sunday, July 31, 2016

Vs2015 Update 3:template Does Not Work Anymore.

Vs2015 Update 3:template Does Not Work Anymore.

hi

 

I just updated my vs to vs2015 update 3.  After I created a project, i exported it to a template to be use by my other project.  after i created a new project with the template, I see my file and resource name in the solution explorer.  But when i clicked to open it, it popup a windows and said :

 

The document can not be opened.  It has been removed, renamed or deleted.

 

anyone has any idea?

 

thanks in advance


Rendering Gui Or Hud In A Separate Framebuffer

Rendering Gui Or Hud In A Separate Framebuffer

Hello, I have been trying to render the HUD for my game to a separate FrameBuffer so that I can apply my own shader effects to it that are separated from the 3D scene.

 

The problem is that I am having transparency issues. I use glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); with glClearColor(0.0f, 0.0f, 0.0f, 0.0f);, which creates a transparent black background for the HUD FrameBuffer before rendering the HUD.

 

Whenever I render a transparent HUD element to the FrameBuffer, the black gets mixed in with the original colors of the element, which is not what I want. It ends up making the HUD elements look darker than they are supposed to be when I mix the HUD FrameBuffer with the 3D Scene FrameBuffer.

 

I can change the color for glClearColor() and get different colored results, so I know that that is the root of the problem. I decided to use the blend function:

 

glBlendFuncSeparate(/*For color*/ GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA,
                                    /*For alpha*/ GL_ONE, GL_ONE_MINUS_SRC_ALPHA);

 

which was requested by someone who had a similar issue. Unfortunately it isn't working for me. I am afraid that I might need to do something involving stencil buffers to get it to work, but I want to try to avoid that and find a simpler solution. Can anyone give me any pointers?

 

Also this is made with OpenGL 4.2 with c++ and compiled with MinGW.


Tweeny, A Modern C++ Tweening Library

Tweeny, A Modern C++ Tweening Library

Hello! This post is to announce Tweeny, an inbetweening library for C++. It provides a fluid API for defining tweens, like:

auto tween = tweeny::from(0).to(50).during(100);
while (tween.progress() < 1) tween.step(1);

It supports tweens with multiple points (e.g, from 0 to 100 then to 200), multiple values (from 0, 0 to 100, 200) and multiple types (from 0, 0.0f to 10, 2.5f). It also has 30+ easing functions (based on those by Robert Penner http://ift.tt/1mCMeMf).

 

Here is a demo, compiled with emscripten, of a sprite using tweens: http://ift.tt/2aJELOV

 

- Source: http://ift.tt/2aHCbMg

- Site: http://ift.tt/2aJDZ4r

- API Doc and Manual: http://ift.tt/2aHBl2o

 

For those wondering what a tween is or why is it useful, every Game UI nowadays has some sort of tween in them: panels fade in/out, buttons wobble when hovered, things slide in/out with acceleration/deacceleration, etc. All of those pretty animations are possible through a tween with a specific easing.

 

The purpose of Tweeny is to facilitate that. For instance, to animate a button size, this is a possible solution:

auto tween = tweeny::from(button.w, button.h).to(button.w + 10, button.h + 10).during(200).via(easing::backOut);
tween.onStep([](int w, int h) { button.w = w; button.h = h; return false; });

/* later, in game loop */
tween.step(dt);

Tweeny is MIT licensed.

 

I hope this can be useful to you. Feedback is much appreciated!


Only 12 Enemies, And My Fps Drops To 30, Why Is That?

Only 12 Enemies, And My Fps Drops To 30, Why Is That?

Guys. What I did so far:

 

1.  I wanted to cap the frame rate of my game, but SDL_GetTicks() returns time since app start in Uint32 milliseconds, so I'm getting slightly wrong fps due to small rounding errors and the second reason why frame cap is bad in my case is that SDL_Delay() is not precise, as is said below.

 

fastcall22 says:

 


I would guess that relying on SDL_Delay to regulate framerate is not a good idea, since suspending a thread is not guaranteed to return exactly at the requested duration. From SDL documentation: This function [SDL_Delay] waits a specified number of milliseconds before returning. It waits at least the specified time, but possible longer due to OS scheduling. The delay granularity is at least 10 ms. Some platforms have shorter clock ticks but this is the most common. 

 

 

 

2. That's why I decided to make a frame-independent movement, so I used a variable called deltaTime which is calculated based on the current fps. Sounds cool. But the problem is that I have 7 enemies and in my 'Enemy' class I have various different functions that include movement in some direction, so I somehow need to put the deltaTime variable in all the Enemy objects every frame.

 

The braindead solution, which is what I did, is:

for( int i = 0; i < enemies.size(); i ++ )
{
    enemies[ i ].setDeltaTime( myrpg.deltaTime );
}

But I have to create 'for' loops for every single thing. For example:

        for( int i = 0; i < enemies.size() ; i ++ )
        {
            //If left mouse button is clicked and the bullet ray collides with an enemy AABB, kill the enemy.
            myrpg.kill( playerCam, enemies[ i ] );
        }

        // Clear the screen
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        for( int i = 0; i < enemies.size(); i ++ )
        {
            //If the enemy is not dead, make him run and rotate towards me.
            if( enemies[ i ].getCurrentAnim() == ANIM_RUN )
            {
                enemies[ i ].moveTowardsPlayer( playerCam.getPosition() );
            }
        }

        //Render all enemies
        for( int i = 0; i < enemies.size(); i ++ )
        {
            myrpg.renderAnimatedModel( enemies[ i ], Timer, shaderAnim, shaderStatic );
        }

It seems like I'm using C, not C++. Is there some other way I can make stuff more compact?

 

For example, can I add some virtual base class and just set deltaTime value in that class and make all the enemies inherit the variable somehow, is it possible? (it's a really stupid question, but I decided to ask in case there is something I have missed. ) I haven't used inheritance by now and I kind of don't know what are the pros it offers.

 

And the next question is:

I have 7 animated enemies. And my fps is 62 for now( not capped). But when I add 5 more enemies and make them 12, my fps drops to 31. I traced the problem and I finally found it, it's my BoneTransform() function, which fills my vector of TransformMatrices that I use in the vertex shader in order to animate the skeleton. But it rapes my CPU. ( when I comment the BoneTransform() function, framerate goes from 30 to 166!( sometimes jumps between 166 and 200 ). And I kind of stole most of the function from a tutorial on skeletal animation, and I'm sure it's pretty optimized, so there must be some other reason.

 

I used some models from World of Warcraft. And the interesting thing is that I have the game, and when I play it( when I play WoW ), I can have 20 players around me, and my fps is great, but when I add the same models in my own game, my fps drops like crazy and it's 10 times slower than the original game, why? ( bear in mind that I haven't even loaded any map, I just spawn 12 enemies walking on air, and my cpu runs like a fat truckdriver, wtf is that?? ).


Do I Need A Virtual Class Here?

Do I Need A Virtual Class Here?

Guys. What I did so far:

 

1.  I wanted to cap the frame rate of my game, but SDL_GetTicks() returns milliseconds in Uint32, so I'm getting slightly wrong fps due to small rounding errors and the second reason why frame cap is bad in my case is that SDL_Delay() is not precise, as is said below.

 

fastcall22 says:

 


I would guess that relying on SDL_Delay to regulate framerate is not a good idea, since suspending a thread is not guaranteed to return exactly at the requested duration. From SDL documentation: This function [SDL_Delay] waits a specified number of milliseconds before returning. It waits at least the specified time, but possible longer due to OS scheduling. The delay granularity is at least 10 ms. Some platforms have shorter clock ticks but this is the most common. 

 

 

 

2. That's why I decided to make a frame-independent movement, so I used a variable called deltaTime which is calculated based on the current fps. Sounds cool. But the problem is that I have 7-8 enemies and in my 'Enemy' class I have various different functions that include movement in some direction, so I somehow need to put the deltaTime variable in all the Enemy objects every frame.

 

The braindead solution, which is what I did, is:

for( int i = 0; i < enemies.size(); i ++ )
{
    enemies[ i ].setDeltaTime( myrpg.deltaTime );
}

But I have to create 'for' loops for every single thing. For example:

        for( int i = 0; i < enemies.size() ; i ++ )
        {
            //If left mouse button is clicked and the bullet ray collides with an enemy AABB, kill the enemy.
            myrpg.kill( playerCam, enemies[ i ] );
        }

        // Clear the screen
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

        for( int i = 0; i < enemies.size(); i ++ )
        {
            //If the enemy is not dead, make him run and rotate towards me.
            if( enemies[ i ].getCurrentAnim() == ANIM_RUN )
            {
                enemies[ i ].moveTowardsPlayer( playerCam.getPosition() );
            }
        }

        //Render all enemies
        for( int i = 0; i < enemies.size(); i ++ )
        {
            myrpg.renderAnimatedModel( enemies[ i ], Timer, shaderAnim, shaderStatic );
        }

It seems like I'm using C, not C++. Is there some other way I can make stuff more compact?

 

For example, can I add some virtual base class and just set deltaTime value in that class and make all the enemies inherit the variable somehow, is it possible? (it's a really stupid question, but I decided to ask if there is something I have missed. ) I haven't used inheritance by now and I kind of don't know what are the pros it offers.

 

And the next question is:

I have 7 animated enemies. And my fps is 62 for now( not capped). But when I add 5 more enemies and make them 12, my fps drops below 30. I traced the problem and I finally found it, it's my BoneTransform() function, which fills my vector of TransformMatrices that I use in the vertex shader in order to animate the skeleton.

 

I used some models from World of Warcraft. And the interesting thing is that I have the game, and when I play it( when I play WoW ), I can have 20 players around me, and my fps is great, but when I add the same models in my own game, my fps drops like crazy and it's 10 times slower than the original game, why?


Console.writeline Not Printing Out Expression. C#

Console.writeline Not Printing Out Expression. C#

Why does this code not work?

Console.WriteLine(7/2)

It doesn't print anything on the console.


Vs2015:sdl2 Errors While Building Project

Vs2015:sdl2 Errors While Building Project

hi

 

I am just trying to test whether i can setup the SDL2 in vs2015 update 3.

 

I installed sdl2 by nuget package manager.  

 

after i compiled the project, I got the following error output:

 

1>------ Build started: Project: SDL_test, Configuration: Release x64 ------
1>SDL2main.lib(SDL_windows_main.obj) : error LNK2001: unresolved external symbol __imp_fprintf
1>C:\Users\robert\Documents\Visual Studio 2015\Projects\SDL_test\x64\Release\SDL_test.exe : fatal error LNK1120: 1 unresolved externals
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
 
and my source file sdl2 wiki:
 
// Example program:
// Using SDL2 to create an application window
//
 
#include "SDL.h"
#include <stdio.h>
extern "C" { FILE __iob_func[3] = { *stdin,*stdout,*stderr }; }  // this is one of the suggestions. it does not work with or w/o the fix
 
int main(int argc, char* argv[]) {
 
SDL_Window *window;                    // Declare a pointer
 
SDL_Init(SDL_INIT_VIDEO);              // Initialize SDL2
 
  // Create an application window with the following settings:
window = SDL_CreateWindow(
"An SDL2 window",                  // window title
SDL_WINDOWPOS_UNDEFINED,           // initial x position
SDL_WINDOWPOS_UNDEFINED,           // initial y position
640,                               // width, in pixels
480,                               // height, in pixels
SDL_WINDOW_OPENGL                  // flags - see below
);
 
// Check that the window was successfully created
if (window == NULL) {
// In the case that the window could not be made...
printf("Could not create window: %s\n", SDL_GetError());
return 1;
}
 
// The window is open: could enter program loop here (see SDL_PollEvent())
 
SDL_Delay(3000);  // Pause execution for 3000 milliseconds, for example
 
 // Close and destroy the window
SDL_DestroyWindow(window);
 
// Clean up
SDL_Quit();
return 0;
}
 
I googled lnk2001 but do not understand what it meant, it was as if they are not english.  I also tried some of the suggestions on the web but still can not build the project.
 
any help is welcome.
 
thanks in advance

Approximate Average Brightness Of Rendered Image

Approximate Average Brightness Of Rendered Image

So in GLSL shader I have an FBO RGB image. What I need to find out is how bright it is. I need to do it real-time inside shader. How to do it?


How Can I Create A Successful Game In Unreal Engine

How Can I Create A Successful Game In Unreal Engine

can you help for a sucessful game devlopment on unreal engine 4?

i really want to make realistic and sucessful.


Height Map Through Compute Shader, Need Some Pointers

Height Map Through Compute Shader, Need Some Pointers

Hi all,

For about 2 weeks now I've been struggling with an exercise I can't figure out so far.

Here's the goal, in short:

 

- render waves through a vertex and pixel shader

-- where the height of the waves vertices are read from a texture, containing floats (each float contains the height of a wave vertex)

- use a compute shader to update the wave heights

- update them, and render again etc.

 

My first goal is to achieve a situation where at least I get no errors/ warnings and the Compute shader works, stores the new texture, which then is read by the rendering effect, fetching these height map values for the wave vertices.

 

In my book it says to do this, I would need 4 textures in the compute shader:

// textures containing single floats
Texture2D       gPrevSolInput;
Texture2D       gCurrSolInput;

RWTexture2D<float> gCurrSolOutput;
RWTexture2D<float> gNextSolOutput;

Here are some relevant code snippers of my current (non-working) approach.
Let me know if you need other parts to be able to identify the issue.

 

The extra line in the existing rendering function, right before drawint the waves:

        Effects::mBasicFX->SetWavesHeightMap(mWavesCS.mOutputNextSolUAV);

The basic rendering effects (VS and PS), which should fetch the height map:

Texture2D gWavesHeightMap;

SamplerState samHeightMap
{
        Filter = MIN_MAG_MIP_POINT;

        AddressU = WRAP;
        AddressV = WRAP;
};

VertexOut VS(VertexIn vin)
{
        VertexOut vout;

        // Retrieve wave height map data
        if(gIsWaves)
        {
                float heightMapVal = gWavesHeightMap.SampleLevel(samHeightMap, vin.Tex, 0.0f).r;
                vin.PosL.y = heightMapVal;
        }

Calling the compute shader and the compute shader itself:

void CSWrapper::ExecuteCS(ID3D11DeviceContext *dc)
{
        ID3D11ShaderResourceView *nullSRV[2] = { 0, 0 };
        ID3D11UnorderedAccessView *nullUAV[2] = { 0, 0 };

        D3DX11_TECHNIQUE_DESC techDesc;
        Effects::mWavesCSFX->mWavesTech->GetDesc(&techDesc);

        for(UINT p=0;p<techDesc.Passes;++p)
        {
                Effects::mWavesCSFX->SetInputPrevSolSRV(mInputPrevSolSRV);
                Effects::mWavesCSFX->SetInputCurrSolSRV(mInputCurrSolSRV);

                Effects::mWavesCSFX->SetOutputCurrSolUAV(mOutputCurrSolUAV);
                Effects::mWavesCSFX->SetOutputNextSolUAV(mOutputNextSolUAV);

                Effects::mWavesCSFX->mWavesTech->GetPassByIndex(p)->Apply(0, dc);

                // grid 160x160 = 25.600 threads needed, /64 (group size 64,1,1) = 400
                dc->Dispatch(400, 1, 1);
        }

        // clean up
        dc->CSSetShaderResources(0, 2, nullSRV);
        dc->CSSetUnorderedAccessViews(0, 2, nullUAV, 0);

        // disable compute shader
        dc->CSSetShader(0, 0, 0);
}

[numthreads(64, 1, 1)]
void CS(int3 dispatchThreadID : SV_DispatchThreadID)
{
        gNextSolOutput[dispatchThreadID.xy] = gCurrSolInput[dispatchThreadID.xy] + 0.01f;

        gCurrSolOutput[dispatchThreadID.xy] = gNextSolOutput[dispatchThreadID.xy];
}

Creating the 4 textures and SRV/UAV's for (compute) shader:

void CSWrapper::Init(ID3D11Device *pDevice, ID3D11DeviceContext *dc, DirectX::XMFLOAT3* pPrevSolution, DirectX::XMFLOAT3* pCurrSolution, const int pM, const int pN)
{
        // There are 4 views

        // 2 input SRV's        -> prev and curr solution
        // 2 output UAV's       -> curr and next solution

        // The SRV's has to initially be filled and created: textures
        
        /***************************************/
        /**** 1: input SRV (prev solution)      ****/
        /***************************************/

        // create texture
        D3D11_TEXTURE2D_DESC inputPrevSolTexDesc;
        inputPrevSolTexDesc.Width                               = pM;           // grid size of the waves, rows
        inputPrevSolTexDesc.Height                              = pN;           // grid size of the waves, colums
        inputPrevSolTexDesc.MipLevels                   = 1;
        inputPrevSolTexDesc.ArraySize                   = 1;
        inputPrevSolTexDesc.Format                              = DXGI_FORMAT_R32_FLOAT;
        inputPrevSolTexDesc.SampleDesc.Count    = 1;
        inputPrevSolTexDesc.SampleDesc.Quality  = 0;
        inputPrevSolTexDesc.Usage                               = D3D11_USAGE_DEFAULT;
        inputPrevSolTexDesc.BindFlags                   = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
        inputPrevSolTexDesc.CPUAccessFlags              = 0;
        inputPrevSolTexDesc.MiscFlags                   = 0;

        // initial texture data
        float *tempArrayA = new float[pM*pN];
        for(int i=0;i<pM*pN;++i) tempArrayA[i] = pPrevSolution[i].y;
        
        D3D11_SUBRESOURCE_DATA vinitDataA;
        vinitDataA.SysMemPitch = sizeof(float) * pM;
        vinitDataA.pSysMem = &tempArrayA[0];

        // create the texture
        ID3D11Texture2D *inputPrevSolTex = 0;
        HR(pDevice->CreateTexture2D(&inputPrevSolTexDesc, &vinitDataA, &inputPrevSolTex));
        
        delete[] tempArrayA;

        // create SRV
        D3D11_SHADER_RESOURCE_VIEW_DESC prevSolSrvDesc;
        prevSolSrvDesc.Format                                   = DXGI_FORMAT_R32_FLOAT;
        prevSolSrvDesc.ViewDimension                    = D3D11_SRV_DIMENSION_TEXTURE2D;
        prevSolSrvDesc.BufferEx.FirstElement    = 0;
        prevSolSrvDesc.BufferEx.Flags                   = 0;
        prevSolSrvDesc.BufferEx.NumElements             = pM * pN;

        prevSolSrvDesc.Texture2D.MipLevels                      = 1;
        prevSolSrvDesc.Texture2D.MostDetailedMip        = 0;

        pDevice->CreateShaderResourceView(inputPrevSolTex, &prevSolSrvDesc, &mInputPrevSolSRV);
        ReleaseCOM(inputPrevSolTex);

        /***************************************/
        /**** 2: input SRV (curr solution)      ****/
        /***************************************/

        // create texture
        D3D11_TEXTURE2D_DESC inputCurrSolTexDesc;
        inputCurrSolTexDesc.Width                               = pM;           // grid size of the waves, rows
        inputCurrSolTexDesc.Height                              = pN;           // grid size of the waves, colums
        inputCurrSolTexDesc.MipLevels                   = 1;
        inputCurrSolTexDesc.ArraySize                   = 1;
        inputCurrSolTexDesc.Format                              = DXGI_FORMAT_R32_FLOAT;
        inputCurrSolTexDesc.SampleDesc.Count    = 1;
        inputCurrSolTexDesc.SampleDesc.Quality  = 0;
        inputCurrSolTexDesc.Usage                               = D3D11_USAGE_DEFAULT;
        inputCurrSolTexDesc.BindFlags                   = D3D11_BIND_SHADER_RESOURCE | D3D11_BIND_UNORDERED_ACCESS;
        inputCurrSolTexDesc.CPUAccessFlags              = 0;
        inputCurrSolTexDesc.MiscFlags                   = 0;

        // initial texture data
        float *tempArrayB = new float[pM*pN];
        for(int i=0;i<pM*pN;++i) tempArrayB[i] = pCurrSolution[i].y;
        
        D3D11_SUBRESOURCE_DATA vinitDataB;
        vinitDataB.SysMemPitch = sizeof(float) * pM;
        vinitDataB.pSysMem = &tempArrayB[0];

        // create the texture
        ID3D11Texture2D *inputCurrSolTex = 0;
        HR(pDevice->CreateTexture2D(&inputCurrSolTexDesc, &vinitDataB, &inputCurrSolTex));
        
        delete[] tempArrayB;

        // create SRV
        D3D11_SHADER_RESOURCE_VIEW_DESC currSolSrvDesc;
        currSolSrvDesc.Format                                   = DXGI_FORMAT_R32_FLOAT;
        currSolSrvDesc.ViewDimension                    = D3D11_SRV_DIMENSION_TEXTURE2D;
        currSolSrvDesc.BufferEx.FirstElement    = 0;
        currSolSrvDesc.BufferEx.Flags                   = 0;
        currSolSrvDesc.BufferEx.NumElements             = pM * pN;

        currSolSrvDesc.Texture2D.MipLevels                      = 1;
        currSolSrvDesc.Texture2D.MostDetailedMip        = 0;

        pDevice->CreateShaderResourceView(inputCurrSolTex, &currSolSrvDesc, &mInputCurrSolSRV);

        /***************************************/
        /**** 3: output UAV (curr solution)     ****/
        /***************************************/

        D3D11_UNORDERED_ACCESS_VIEW_DESC uavCurrDesc;
        uavCurrDesc.Format                                      = DXGI_FORMAT_R32_FLOAT;
        uavCurrDesc.ViewDimension                       = D3D11_UAV_DIMENSION_TEXTURE2D;
        uavCurrDesc.Buffer.FirstElement         = 0;
        uavCurrDesc.Buffer.Flags                        = 0;
        uavCurrDesc.Buffer.NumElements          = pM * pN;

        pDevice->CreateUnorderedAccessView(inputCurrSolTex, &uavCurrDesc, &mOutputCurrSolUAV);

//      ReleaseCOM(inputCurrSolTex);            // release texture, both SRV and UAV created

        /***************************************/
        /**** 4: output UAV (next solution)     ****/
        /***************************************/

        D3D11_UNORDERED_ACCESS_VIEW_DESC uavNextDesc;
        uavNextDesc.Format                                      = DXGI_FORMAT_R32_FLOAT;
        uavNextDesc.ViewDimension                       = D3D11_UAV_DIMENSION_TEXTURE2D;
        uavNextDesc.Buffer.FirstElement         = 0;
        uavNextDesc.Buffer.Flags                        = 0;
        uavNextDesc.Buffer.NumElements          = pM * pN;

        pDevice->CreateUnorderedAccessView(inputCurrSolTex, &uavNextDesc, &mOutputNextSolUAV);

        ReleaseCOM(inputCurrSolTex);            // release texture, both SRV and UAV created

}

I would really appreciate if someone could help me in the right direction, to finally get this case solved..

Thanks in advance.


Chess Game Pieces Not Moving

Chess Game Pieces Not Moving
#include "Tile.h"

Tile::Tile() : sf::RectangleShape(sf::Vector2f(105, 105)), m_isHighlighted(false) 
{
if (!m_cBuffer.loadFromFile("penclick.wav")) {
std::cout << "Failed to load penclick.wav" << std::endl;
}
}

bool Tile::isTileHighlighted() const {
return m_isHighlighted;
}

void Tile::turnOffHighlight(){
m_clickSound.setBuffer(m_cBuffer);
m_clickSound.setVolume(15);
m_clickSound.play();
setPosition(sf::Vector2f(getPosition().x - 5, getPosition().y - 5));
setSize(sf::Vector2f(getSize().x + 10, getSize().y + 10));
setOutlineThickness(0);
m_isHighlighted = false; 
}

void Tile::highlightTile() {

m_clickSound.setBuffer(m_cBuffer);
m_clickSound.setVolume(15);
m_clickSound.play();
setPosition(sf::Vector2f(getPosition().x + 5, getPosition().y + 5));
setSize(sf::Vector2f(95, 95)); //decrease size to be able to render border without clashes
setOutlineThickness(5);
setOutlineColor(sf::Color::Yellow);

m_isHighlighted = true;
}

Tile::~Tile(){
}


#include "GamePieces.h"

float GamePieces::m_speed = 52.5;

GamePieces::GamePieces()
{
}

GamePieces::GamePieces(const std::string& type, const Color& c, const sf::Vector2f& position) : m_type(type), m_col(c), m_position(position)
{
std::string filePath = ((c == Color::White) ? "w_" : "b_") + type + ".png";
std::cout << filePath << std::endl;

if (!m_gamePiece.loadFromFile(filePath)) {
std::cout << "Failed" << std::endl; 
}
else {
m_gamePieceSprite.setTexture(m_gamePiece);
m_gamePieceSprite.setOrigin(sf::Vector2f(m_gamePiece.getSize().x / 2, m_gamePiece.getSize().y / 2));
m_gamePieceSprite.setPosition(position);
}
}

sf::Sprite GamePieces::getPieceSprite() const
{
return m_gamePieceSprite;
}

bool GamePieces::isWhite() const
{
return (m_col==Color::White);
}

sf::Vector2f GamePieces::getPosition() const
{
return m_position;
}

std::string GamePieces::getPieceType() const
{
return m_type;
}

void GamePieces::movePiece(const Tile& tile, float dt)
{
sf::Vector2f tileCoords = sf::Vector2f(tile.getPosition().x + 52.5, tile.getPosition().y + 52.5);
std::cout << tileCoords.y << std::endl;
while (m_gamePieceSprite.getPosition().y >= tileCoords.y) {
m_gamePieceSprite.setPosition(sf::Vector2f(m_gamePieceSprite.getPosition().x, m_gamePieceSprite.getPosition().y - (m_speed*dt)));
std::cout << m_gamePieceSprite.getPosition().y << std::endl;
}
m_position = sf::Vector2f(tileCoords.x, tileCoords.y);
}

void GamePieces::setPos(const sf::Vector2f& pos) 
{
m_position = pos;
}


GamePieces::~GamePieces()
{
}


void Grid::update(Windows& wind, const sf::Event& event, const Team& w, const Team& b, float dt)
{
if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) {

try {
sf::Vector2f mousePosFloat = static_cast<sf::Vector2f>(sf::Mouse::getPosition(*wind.getWindows()));

if ((mousePosFloat.x > (wind.getWindows()->getSize().x) || mousePosFloat.x < 0)) {
throw 99;
}
if ((mousePosFloat.y > wind.getWindows()->getSize().y || mousePosFloat.y < 0)) {
throw 99;
}

sf::Vector2f rowCol = windowCoordsToRowCol(mousePosFloat);
Tile& tile = m_tileSet[(int)rowCol.x][(int)rowCol.y];
//std::cout << tile.getPosition().x << ", " << tile.getPosition().y << std::endl;
GamePieces* gamePiece = getGamePieceOnTile(rowCol.x, rowCol.y, w, b);

if (tile.isTileHighlighted()) {
tile.turnOffHighlight(); //moves square back in place and turns off outline

} 
else if (gamePiece != nullptr && gamePiece->isWhite() && !(isOneTileHighlighted(w))) { //only highlight tile if its white and no one in the team is
//highlited
tile.highlightTile();
}
else if (isOneTileHighlighted(w)&& (gamePiece == nullptr || !gamePiece->isWhite())) {

if (gamePiece == nullptr) {//space clicked on is empty
getHighlightedGamePiece(w).movePiece(tile, dt); 
}
else if (!gamePiece->isWhite()) {
//TODO move to space and eat opposing gamePiece
}
}
else {
if (!ebuffer.loadFromFile("error.wav")) {
std::cout << "Failed to load error.wav" << std::endl;
}
errorSound.setBuffer(ebuffer);
errorSound.setVolume(8);
errorSound.play();
}

//TODO find way of deleting the gamePiece pointer
}
catch (int x) {
std::cout << "hello" << std::endl;
}
}

void Field::update(sf::Event& event)
{ 
float elapsedTime = m_elapsed.getElapsedTime().asSeconds();
if (elapsedTime >= frameTime) {
if (m_secondClock.getElapsedTime().asSeconds() >= 1.0f) {
elapsedFrames = 0;
m_secondClock.restart();
}
elapsedFrames++;
m_elapsed.restart();
while (m_windows.getWindows()->pollEvent(event)) { // max 60 fps - cant go faster
m_windows.Update(event);
m_chessBoard.update(m_windows, event, m_wTeam, m_bTeam, elapsedTime);
}
}
}

So for now I'm just trying to select a game piece and then move it to an empty tile, and according to the debugger all of this executes fine as per the flow of the program. I event print out the location of the sprite as it makes its way to the new tile and it seems right. The "dt" time variable in this case is just the time between updates that exceeds 16 ms (so this is a fixed time step). I'm also wondering how I can make it so that it goes exactly to a specific point, while the printed location of the gamepiece sprite's y coord is close, i want it to be exact. My idea is for this gamepiece to move at a rate of 52.5 units per second, so a distance of around 2 tiles away or (105 units) in abt 2 seconds or ideally 120 frames. The counter in my while loop says it runs abt 230 times which is a bit odd as ive printed the frame rate in past...consistently at 59 fps.

Thanks for the help.

 

Confusion Of Assimp Sdk, Animation System Design Need Advice

Confusion Of Assimp Sdk, Animation System Design Need Advice

Hellow !

I 'm going to make an animation system for game......

I will export models to custom format model using the assimp sdk.  I will only export joint nodes and mesh nodes, and animation data.  

The  output scene file format will look like these:

<ModelNode>

  <JointNode>  lcltransform  .....

     <meshNode>  lcltransform....  <\meshNode>

  <\JointNode>

  ......many joints to omit.

<\ModelNode>

 

The JointNode holds inverse bind pose matrix .

As for the MeshNode, I know , I know, the static mesh is not completely static, the "static" means it can not be deformed,

it can also have motions, so mesh will be implemented as MeshNode. It will inherit transform from  ancestors, so it will move!!  

As for the ModelNode, why it inherit from SceneNode is that  it act as the root node of all joint nodes and model nodes,   somewhat look like  assimp root node.

All these node will hold local transform.

 

 

The question is, assimp scene nodes are not just joint nodes and mesh nodes, and "pure node", which is used to pass transform, the root is the most apparent one.

I 'm confusing that  whether it will go wrong, if I don't export these nodes, because I'm afraid that some "pure nodes" would have a non-identity transform !!

 

In the animation export part , I will use these code:

std::map<std::string, int> name2Joint;

struct animation 

{
  void export() 
   {
     export(duration, tickPersecond);
     for(node in influenced nodes) 
     {
        jointID = name2Joint[node.name];
        export(jointID, frame.pos, frame.rot, frame.scale);
     }
    }  
};
 
 
My animation system is the one of the most naivest animation system in the world , it can only import, and display .
I have not begin to code, and I don't know if it will work, so
I will show my code,  and if someone find any mistake or have a better implementation, please tell. 
 
 
 
Here's are my data structure regarding animation in the engine side:
struct Frame 
{
   _pos, _rot, _scale; // all are  reference to parent
};
 
struct JointFrame 
{
  _jointID;                                        // will be used to find joint node at update time
  vector<Frame> _frames;
};
 
struct Animation 
{
  vector<JointFrame> _jointFrames;
  void update();
};
 
 
And here's the data structure of Model in engine side:
 
struct SceneNode 
  SceneNode  *_parent;
    pos, rot, scale;             // all are  reference to parent
  _globalTransform;
  virtual  void update();
  virtual   void postUpdate()=0;
};
 
struct Joint : public SceneNode 
{
  Matrix4f _invBindMat;  // inverse bind matrix
};
 
 
struct Model  : public SceneNode  
//why it inherit from SceneNode is that 
// it act as the root node of all joint nodes and model nodes,   somewhat look like  assimp root node
{
   vector<Mesh> _meshes;  
   vector<Joint*> _joints;
   vector<Matrix4f> _JointFinalMats
   void PostUpdate();       // use to update _JointFinalMats after all Joints' GlobalTransform have updated, will be called by Scene
};
 
struct Scene
{
  vector<SceneNode*> _nodes;
  void update();
};
 

 

The flowchart of big big updates :

scene::update()

{

   animation.update();  //  update joint's local transform by keyframes

    foreach(node in _nodes) node.update();    // update joint's global transform

    foreach(node in _nodes) node.postUpdate();  // update jointFinalMat array

     

}

 

void Animation ::update() 
{
   for(jointFrame in   _jointFrames) 

   {

      frame = jointFrame.findFrame(gametime);

      joint =   this->parentModel.findJoint(jointFrame._jointID);

 

      // all are reference to parent

      joint->setPos(frame._pos);

      joint->setRot(frame._rot); 

      joint->setScale(frame._scale);  

   }

}

 

void SceneNode::update() 
{
   _globalTransform = localTransform(_pos, _rot, _scale)  *    _parent->_globalTransform ;

}

 

void Model::postUpdate() 
{

   
    foreach(joint in _joints) 

    {

       _JointFinalMats[joint.ID] =  joint._invBindMat * joint._globalTransform;

   }
}

 

 

After I have attached joints to scene graph,  and Scene::update will call joint::update, where  jointFinalMat = inverseBindposeMat *  jointGlobalTransform

will take place. Since the jointGlobalTransform has contain  ToRootMat,  I will pass a identity matrix to shader as a world matrix.

The code will look like :

if(mesh.hasBone) 
{

    worldMat = Identity;

else 
{
  worldMat =  mesh.globalTransfom

 

the shader code:

cbuffer cbPerObject : register(b0)
{
row_major float4x4 worldMat;
row_major float4x4 worldInvTransposeMat;
row_major float4x4 worldviewprojMat;
};
 
cbuffer cbSkinned : register(b1)
{
row_major float4x4 boneMat[96];
};

 

 
struct SkinnedVertexIn
{
float3 PosL       : POSITION;
float3 NormalL    : NORMAL;
float3 TangentL   : TANGENT;
float2 Tex        : TEXCOORD;
uint4 BoneIndices : BONEINDICES;
float4 Weights    : WEIGHTS;
};

 

 
VertexOut vsmain(SkinnedVertexIn vin)
{
VertexOut vout;
float weights[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
weights[0] = vin.Weights.x;
weights[1] = vin.Weights.y;
weights[2] = vin.Weights.z;
weights[3] = 1.0f - weights[0] - weights[1] - weights[2];
 
float3 posL = float3(0.0f, 0.0f, 0.0f);
float3 normalL = float3(0.0f, 0.0f, 0.0f);
float3 tangentL = float3(0.0f, 0.0f, 0.0f);
for (int i = 0; i < 4; ++i)
{
posL += weights[i] * mul(float4(vin.PosL, 1.0f), boneMat[vin.BoneIndices[i]]).xyz;
normalL += weights[i] * mul(vin.NormalL, (float3x3)boneMat[vin.BoneIndices[i]]);
tangentL += weights[i] * mul(vin.TangentL.xyz, (float3x3)boneMat[vin.BoneIndices[i]]);
}
 
vout.PosW = mul(float4(posL, 1.0f), worldMat).xyz;
vout.NormalW = mul(normalL, (float3x3) worldInvTransposeMat);
vout.TangentW = mul(tangentL, (float3x3)worldMat);
vout.PosH = mul(float4(posL, 1.0f), worldviewprojMat);
vout.Tex = vin.Tex;
return vout;
}

Confusion Of Exporting Model, Animation

Confusion Of Exporting Model, Animation

Hellow !

I 'm going to export models using the assimp sdk.  I will only export joint nodes and mesh nodes, and animation data.

The output format will look like this:

<JointNode>  lcltransform  .....

    <meshNode>  lcltransform....  <\meshNode>

<\JointNode>

 

But, assimp scene nodes are not just joint nodes and mesh nodes, and "pure node", which is used to pass transform, the root is the most apparent one.

I 'm confusing that  whether it will go wrong, if I don't export these nodes, because I'm afraid that some "pure nodes" would have a non-identity transform !!

 

In the animation part , I will use these code:

std::map<std::string, Joint*> name2Joint;

struct animation 

{
  void export() 
   {
     export(duration, tickPersecond);
     for(node in influenced nodes) 
     {
        jointID = name2Joint[node.name];
        export(jointID, frame.pos, frame.rot, frame.scale);
     }
    }  
};
 
 
My animation system is the one of the most naivest animation system in the world , it can only import, and display .
I have not begin to code, and I don't know if it will work, so
I will show my code,  and if someone find any mistake or have a better implementation, please tell. 
 
 
 
Here's are my data structure regarding animation in the engine side:
struct Frame 
{
   _pos, _rot, _scale; // all are  reference to parent
};
 
struct JointFrame 
{
  _jointID;                                        // will be used to find joint node at update time
  vector<Frame> _frames;
};
 
struct Animation 
{
  vector<JointFrame> _jointFrames;
  void update();
};
 
 
And here's the data structure of Model in engine side:
 
struct SceneNode 
  SceneNode  *_parent;
    pos, rot, scale;             // all are  reference to parent
  _globalTransform;
  virtual  void update();
  virtual   void postUpdate()=0;
};
 
struct Joint : public SceneNode 
{
  Matrix4f _invBindMat;  // inverse bind matrix
};
 
 
struct Model  : public SceneNode  
//why it inherit from SceneNode is that 
// it act as the root node of all joint nodes and model nodes,   somewhat look like  assimp root node
{
   vector<Mesh> _meshes;  
   vector<Joint*> _joints;
   vector<Matrix4f> _JointFinalMats
   void PostUpdate();       // use to update _JointFinalMats after all Joints' GlobalTransform have updated, will be called by Scene
};
 
struct Scene
{
  vector<SceneNode*> _nodes;
};
 

 

The flowchart of updates :

scene::update()

{

   animation.update();  // joint.lcltransform = ...

    foreach(node in _nodes) node.update();

    foreach(node in _nodes) node.postUpdate();

     

}

 

void Animation ::update() 
{
   for(jointFrame in   _jointFrames) 

   {

      frame = jointFrame.findFrame(gametime);

      joint =   this->parentModel.findJoint(jointFrame._jointID);

 

      // all are reference to parent

      joint->setPos(frame._pos);

      joint->setRot(frame._rot); 

      joint->setScale(frame._scale);  

   }

}

 

void SceneNode::update() 
{
   _globalTransform = localTransform(_pos, _rot, _scale)  *    _parent->_globalTransform ;

}

 

void Model::postUpdate() 
{

   
    foreach(joint in _joints) 

    {

       _JointFinalMats[joint.ID] =  joint._invBindMat * joint._globalTransform;

   }
}

 

 

After I have attached joints to scene graph,  and Scene::update will call joint::update, where  jointFinalMat = inverseBindposeMat *  jointGlobalTransform

will take place. Since the jointGlobalTransform has contain  ToRootMat,  I will pass a identity matrix to shader as a world matrix.

The code will look like :

if(mesh.hasBone) 
{

    worldMat = Identity;

else 
{
  worldMat =  mesh.globalTransfom

 

the shader code:

cbuffer cbPerObject : register(b0)
{
row_major float4x4 worldMat;
row_major float4x4 worldInvTransposeMat;
row_major float4x4 worldviewprojMat;
};
 
cbuffer cbSkinned : register(b1)
{
row_major float4x4 boneMat[96];
};

 

 
struct SkinnedVertexIn
{
float3 PosL       : POSITION;
float3 NormalL    : NORMAL;
float3 TangentL   : TANGENT;
float2 Tex        : TEXCOORD;
uint4 BoneIndices : BONEINDICES;
float4 Weights    : WEIGHTS;
};

 

 
VertexOut vsmain(SkinnedVertexIn vin)
{
VertexOut vout;
float weights[4] = { 0.0f, 0.0f, 0.0f, 0.0f };
weights[0] = vin.Weights.x;
weights[1] = vin.Weights.y;
weights[2] = vin.Weights.z;
weights[3] = 1.0f - weights[0] - weights[1] - weights[2];
 
float3 posL = float3(0.0f, 0.0f, 0.0f);
float3 normalL = float3(0.0f, 0.0f, 0.0f);
float3 tangentL = float3(0.0f, 0.0f, 0.0f);
for (int i = 0; i < 4; ++i)
{
posL += weights[i] * mul(float4(vin.PosL, 1.0f), boneMat[vin.BoneIndices[i]]).xyz;
normalL += weights[i] * mul(vin.NormalL, (float3x3)boneMat[vin.BoneIndices[i]]);
tangentL += weights[i] * mul(vin.TangentL.xyz, (float3x3)boneMat[vin.BoneIndices[i]]);
}
 
vout.PosW = mul(float4(posL, 1.0f), worldMat).xyz;
vout.NormalW = mul(normalL, (float3x3) worldInvTransposeMat);
vout.TangentW = mul(tangentL, (float3x3)worldMat);
vout.PosH = mul(float4(posL, 1.0f), worldviewprojMat);
vout.Tex = vin.Tex;
return vout;
}

Windows.h Issues Since Visual Studio 2015 Update 3

Windows.h Issues Since Visual Studio 2015 Update 3

Hi !

Since I updated to Visual Studio 2015 Update 3 I have compilation issue for Windows.h stuff like TIMECAPS and InitializeConditionVariable.

To solve the TIMECAPS issue I have to include "timeapi.h", it was not needed before.

To solve the InitializeConditionVariable and other of the same kind I have to set "_WIN32_WINNT=0x0600" as compilation macro.

Is it normal ?

Thanks


Ecs Inheritance Problem (C++)

Ecs Inheritance Problem (C++)

Hey guys,

 

Im working on creating an entity component system but I am stuck on one particular problem that I need some help with.

 

 

Currently i have a base class entity that have a vector of component pointers like the following 

class entity
{
  int id;
  std::vector<component*> mycomponents;
  int entity_type;
  bool deleteme;

}

 I have public functions that will allow me to both add and delete components from the entity. after this i will have a bunch of systems that will do the updating for me (the components will just have information other then maybe the ai component which would contain a behaviour tree/FSM)

 

The problem that I am trying to figure out is how would i get the correct component i need for a system  (say i need the position and velocity components for the movement system). After having a google a round I can see that i could do a dynamic cast (as my base component class will have variable to say what type of component it is) but i have heard that this is not really a very efficient method and not really good practice (feel free to correct me). I could also do some kind of messaging system for changing the data in a component but getting data out of it would be harder (would need a virtual return function of each data type). 

 

Any advice on a way I could get around this problem. is their a method that i have over looked? 


Ai Advance Wars Unity C#

Ai Advance Wars Unity C#
Hello, I'm making an advance wars game, my AI can attack/defend/capture building and so on... like the original game.
I follow the AI behavior guide on the wiki, it works very well.
Actually, I am stuck when the AI wants to buy unit, I can't find any information about how the AI can buy a unit, anyone can tell me how is it working.
thank you.

Game Development

Game Development

I am currently in development of an upcoming 2d Multiplayer game called "Zed" . It will be unique as it will open world game & will be survival game , gaining elemental powers as they level up and select their skills . The game will dive from completing mini quests to huge with evolutions and game world will be having random mystery's cave generated through algorithms as they move around in game. They have to dig into these caves alone or with a team with earn some beautiful rewards .

The Game will start with a crash of meteor which breaks the earth into pieces causing a wormhole where the player gets pulled & get abilities to control elements .

 

We are currently a team of 5 . One programmer (me) & 3 artists & a writer .

We need two C# programmers who will be able to work in unity 3d engine .

Requirements : 

  • They should know how to use git
  • They should have atleast 2+ years of experience with c#

We all will be starting working with on the Game within a week .

 

Facebook Page : http://ift.tt/2a8NaO2

 

I have already a basic setup of server and game ready . 

Contact Info : therealzoel@gmail.com


Saturday, July 30, 2016

How To Perform Matrix Dot Product On D3Dx9?

How To Perform Matrix Dot Product On D3Dx9?

http://ift.tt/2aFHBra

 

Is it possible to do dot product on a vector with matrices in D3DX9?

 

I am trying to convert this project into C++ equivalence...

 

http://ift.tt/2aHIsod

 

In the python code

np.dot(rotz(pi/2), np.array([cos(anglstart), sin(anglstart), 0]).T)

It is trying to compute the dot product of a rotation matrix around z axis and dot with

a column vector...

 

http://ift.tt/2aFHFHu

 

The D3DXVec3Dot only works with dotting two vectors together?

 

Thanks

Jack


Vs2015:error After Canceled Vs2015 Update 3 Update

Vs2015:error After Canceled Vs2015 Update 3 Update

hi

 

I had vs2015 update 2 installed.  then i found out that they just release update 3, do i tried to update to update 3.  in the process of installing update 3, i loaded photoshop cc to do something.  photoshop then said that my scratch disk was full and could not load.  I realized that my c: ssd was almost full and photoshop could not load.  so i canceled updating vs 3, bad idea.  Then my vs2015 did not load anymore.  so i uninstalled it and installed the old verson of vs2015.  after installed and loaded vs2015, vs gave me error whenever i clicked on file command or the x on the top right to get out of the vs i got a windows popped up as i will show below.  any suggestion?

 

thanks for your help.

Attached Thumbnails

  • Screenshot (17).png

Problem With Hlsl Of Blur

Problem With Hlsl Of Blur

Im trying run some shader of blur in my game, but nothing happen and the render be normal, without blur..

 

HLSL Code:

sampler ColorSampler1 : register(s0);

#define SAMPLE_SIZE 15

float2 texelSize = {1/1024,1/768};
float offsets[SAMPLE_SIZE] = {-0.006836,-0.005859,-0.004883,-0.003906,-0.002930,-0.001953,-0.000977,0.000000,0.000977,0.001953,0.002930,0.003906,0.004883,0.005859,0.006836};
float weights[SAMPLE_SIZE] = {0.008847,0.018216,0.033562,0.055335,0.081638,0.107778,0.127325,0.134598,0.127325,0.107778,0.081638,0.055335,0.033562,0.018216,0.008847};

float4 PS_BlurH(float2 texCoord : TEXCOORD0) : COLOR0
{
        float4 sum = float4(0.0, 0.0, 0.0, 1.0);
        
        for (int i = 0; i < SAMPLE_SIZE; i++)
                sum += tex2D(ColorSampler1, float2(texCoord.x + (offsets[i] * texelSize.x), texCoord.y)) * weights[i];
        
        clip(sum.a < 0.01f ? -1 : 1);
        
        return sum;
}

float4 PS_BlurV(float2 texCoord : TEXCOORD0) : COLOR0
{
        float4 sum = float4(0.0, 0.0, 0.0, 1.0);
        
        for (int i = 0; i < SAMPLE_SIZE; i++)
                sum += tex2D(ColorSampler1, float2(texCoord.x, texCoord.y + (offsets[i] * texelSize.y))) * weights[i];
        
        clip(sum.a < 0.01f ? -1 : 1);
        
        return sum;
}

technique Glow
{
        pass BlurHorizontal
        {
                PixelShader = compile ps_2_0 PS_BlurH();
        }
        
        pass BlurVertical
        {
                PixelShader = compile ps_2_0 PS_BlurV();
        }
}

Screenshot:

b7189a0e52.png

 

As can see in pic, nothing happens with meshe, dno why.. If i change values of offsets and weights same thing... Blur dont work.

Someone know what can be? Thanks


[Slimdx] Question About Setting Constant Buffers

[Slimdx] Question About Setting Constant Buffers

Too long didn't read:  I'm trying to find the SlimDX version of this line:

deviceContext->VSSetConstantBuffers(0, 1, &m_vertexPerObjectBuffer);

Trying to learn SlimDX and converting a C++ project I built into SlimDX.   I'm running into trouble on how to actually set a Constant Buffer.   I have managed to Create the Buffers, and update them like so: 

            vertexPerObject = new Buffer(device, new BufferDescription
            {
                Usage = ResourceUsage.Default,
                SizeInBytes = Utility.SizeOf<VertexPerObject>(),
                BindFlags = BindFlags.ConstantBuffer
            });
            var data = new DataStream(Utility.SizeOf<VertexPerObject>(), true, true);
           
            Matrix worldViewProj = Matrix.Multiply(worldMatrix, viewMatrix);
            worldViewProj = Matrix.Multiply(worldViewProj, projectionMatrix);

            data.Write(worldViewProj);
            data.Position = 0;
            device.ImmediateContext.UpdateSubresource(new DataBox(0, 0, data), vertexPerObject, 0);


However, the only source of setting a Constant Buffer I can find in the SlimDX library occurs in the VertexShaderWrapper class.   Here is the definition intellisense gives me on a peek:

public class VertexShaderWrapper
    {
        public VertexShader Get();
        public VertexShader Get(ClassInstance[] classInstances);
        public Buffer[] GetConstantBuffers(int startSlot, int count);
        public SamplerState[] GetSamplers(int startSlot, int count);
        public ShaderResourceView[] GetShaderResources(int startSlot, int count);
        public void Set(VertexShader shader);
        public void Set(VertexShader shader, ClassInstance[] classInstances);
        public void SetConstantBuffer(Buffer constantBuffer, int slot);
        public void SetConstantBuffers(Buffer[] constantBuffers, int startSlot, int count);
        public void SetSampler(SamplerState sampler, int slot);
        public void SetSamplers(SamplerState[] samplers, int startSlot, int count);
        public void SetShaderResource(ShaderResourceView resourceView, int slot);
        public void SetShaderResources(ShaderResourceView[] resourceViews, int startSlot, int count);
    }

I assume this means it has an Abstract Contructor that takes 0 arguments since its not static.  but trying this:

VertexShaderWrapper vsw = new VertexShaderWrapper();

Just gives me the error:   VertexShaderWrapper does not contain a Constructor that takes 0 arguments. 


Virtual Machines

Virtual Machines

Hi,

 

Is there a way to use a Virtual Machine as a work around for a hardware limitation? 

 

My computer only has hardware support for OpenGL 2.1 (DirectX 11 is just fine - oddly enough, but can't go above OpenGL 2.1)

 

I want to develop with SDL 2.X and OpenGL 4.X

 

This is only for simple 2D and 3D game development when performance is not critical.


Management Game Suggestion

Management Game Suggestion

Hello,

 

So I've got experience developing websites: HTML, CSS and PHP, I've also covered scripting in the game Garry's Mod which uses a version of lua.

I would like to create management game, so the majourity of it is menu based, it's essential (even though i'm sure most languages can) i can create directories to store saves, write files, edit and remove files in this directory.

 

What I'm asking is, what should I use to produce this game? I want something which isn't really hard to pick up and will be ideal for a menu based game. Any suggestions would be awesome, thanks!


Ecs Architecture Efficiency

Ecs Architecture Efficiency

I was wondering for all those C++ programmers out there, what kind of efficiency your getting from an ECS (Entity Component System) game architecture.  I'm wondering about max cycles, how many entities and corresponding components you can create in your system before UPS and FPS drops below the standard 60.


What's Your Ios Game Loop?

What's Your Ios Game Loop?

Just looking at what other people have done, what's been successful, and what pitfalls to avoid (specifically, CPU/GPU synchronization).

 

Current Prototype:

  • Game update is variable update time
  • Game update and rendering done in CADisplayLink callback running on main thread.
  • Audio update occurs on separate thread controlled by AudioUnit.
  • (Game-specific context): Game update takes ~5ms to complete

 

Thoughts:

  • I feel like variable-time game update might be OK on mobile given we don't have to worry about being preempted as much.
  • Don't know if this is how CADisplayLink is designed to work - perhaps should run game logic on background thread and only render in CADisplayLink callback? Not sure what synchronization issues arise here. Game logic could be allowed to update as fast as possible - or could cap to screen refresh rate.
  • Similarly, could push rendering into same background thread as game update. Again, not sure what synchronization issues arise here.

Goals (The same as everyone else?):

  1. Minimize input -> display latency
  2. Every screen refresh, the device should have an new/updated frame buffer to display.

Ad Networks For Web And Facebook Games?

Ad Networks For Web And Facebook Games?
I find plenty of ad networks that I can integrate with my mobile games to put in game ads, but I have a couple of free games that I would like to make available in browser and likely as "facebook apps" as well. I would like to be able to put ads on these games so I can make a little passive income off of them. What ad networks support this?

Good Programming Books Without Computer Access

Good Programming Books Without Computer Access
I'm in an awkward transitory period where I've neither access to stable internet not access to my regular PC; all I've got is this trusty kindle fire. In that light, I'm looking for something light on exercises and code follow-alongs. On the other hand, I also want something mildly practical (I.e. not like "From Mathematics to Generic Programming", which is a dense blob of set theory). For reference, I'm a CS graduate with a few years professional experience, and I've also read most of the famous software engineering books like the pragmatic programmer and code complete. I'm okay with just about any domain, as long as I don't need to write code. Any thoughts?

(Beginner) Pcss Shadows Questions

(Beginner) Pcss Shadows Questions

Hi, 

 

I am playing around with PCSS shadows in my small 3D engine (for learning purpose) but there is two things I don't understand. Probably beginner problems...

 

 

- Reading from my shadow map requiere an UV coordinate, and I add poisson disk offset to them to read surrounding pixel and try to find blockers (nVidia PCSS method). But what I don't get is how it work when the UV + Offset are greater than 1 ? It go out of the texture then ?

 

Exemple : UV = 0.54,0.74 + Offset = 0.84,0.44. I would expect poisson disk to be really small value like 0.00xx.. to read nearly surrounding pixel and not random pixel on the whole map. I probably don't get how reading texture work...

 

 

- My other problem is that the depth map I generate from the point of view of my light has a too small range so I don't find a lot of blockers (so shadow are still hard). When visualizing my shadow map in the VS debugger, all my value are between 0.998 - 1.0 (sometime event between 1 - 1 :s). Even with my clip space as tight as possible. In a particular case my near plane is 0.1f and my far plane is 20.0f, I would expect depth values a bit more expended like 0.97 - 1.0. What could influence the depth repartition when rendering my shadow map (a 32bit floating point texture). Due to that tight depth range, my PCSS offset value after having calculated blockers is really small, so I don't really get soft shadows. When debugging the sample code from nVidia, I notice that the main difference is that their depth value are more expended and so the offset value is something like 8-9 while mine is something like 0.025..

 

Thank a lot if someone can light me up ;)


Multithreading Library Preference

Multithreading Library Preference

Hey Guys,

 

This thing come to my mind for a long time, when I interned in an AAA studio a year ago, I found they are using their inhouse multi-thread library for multithreading. Recently talking to another engine dev in another AAA studio, he also mentioned they use their inhouse library for multithreading. So I am wondering what make those AAA studio stay away from using existing multi-thread library like TBB, microsoft PPL and OpenMP(for simpler cases)? What's the pros and cons of using them? In my opinion, using a exist mature multithreading library can save them lots of develop and debug time, and especially if they want some advanced features like dependency graph. etc

 

Thanks

 


Physically Based Rendering In Directx

Physically Based Rendering In Directx

So I want to implement a Physically Based Rendering system in my Render Engine but after looking at all of the siggraph presentations online,

I've got to admit I don't understand much due to the fact I'm not that good with math and cannot understand any of the equations in the presentations. I was wondering if someone here could explain how to implement this. 

 

I was reading this article: http://ift.tt/2aEBPWk

Which kinda helped but I still don't understand a lot of it, so I'm downloading the code sample to see how it works.

 

So all I understand is that you just need to blur a cubemap based on a variable. 

 

Basically if someone could explain PBR to a 3 year old that would be great.

 

Physically Based Rendering In Directx

Physically Based Rendering In Directx

So I want to implement a Physically Based Rendering system in my Render Engine but after looking at all of the siggraph presentations online,

I've got to admit I don't understand much due to the fact I'm not that good with math and cannot understand any of the equations in the presentations. I was wondering if someone here could explain how to implement this. 

 

I was reading this article: http://ift.tt/2aEBPWk

Which kinda helped but I still don't understand a lot of it, so I'm downloading the code sample to see how it works.

 

Pretty much all I understand so far is that I use a BRDF to calculate the amount of Specular and Diffuse light there is and perform a blur on a Cube Map. 

 

Help. Please.


2D Rpg Cutscenes

2D Rpg Cutscenes

What might be some guidelines for creating a system that can handle cutscenes in a 2D RPG? The scope of the requirements currently would be limited to movement, animation, dialogue, music, sound effects, fade in/out and camera panning. Control would be limited to progressing the dialogue.

 

To see the exact kind of cutscenes I'd like to implement, have a look at this video.

 


Not Sure Where To Start

Not Sure Where To Start
I'm an average joe who's spent many years on Role playing games. I am always coming up with ideas for stories, powers/abilities and so forth for video games. I'm not sure where I could begin on getting my foot in the door for this type of video game design.Can anyone help me out?

Projects For Learning Android Game Development With Android Studio

Projects For Learning Android Game Development With Android Studio

Hello!

 

So, recently I just shifted my attention towards the android platform and have started learning it.

I decided to use Android Studio and so went through some part of the official training at http://ift.tt/vVlGuv

 

I now have a basic idea of how android development works, but when I got a bit further in the training, I found that I am not getting any examples to work upon, as I continue. So, I thought that the better way would be to work on projects, increasing the level of difficulty ( level of Android APIs involved? ) as I move ahead. In this way, I can refer to the relevant topics in the documentation myself, and even get the experience of developing on android.

 

Hence, can any of you give me a short ordered project list or some abstract path to follow? So that I can first learn the fundamental parts of android app development in general and then focus upon android game development mainly.

 

I took a look at http://ift.tt/2akhmko but found out that it doesn't provide any order to follow. I think, I'll use this once I'm off the beginner stage and just want to practice.

 

My Background: I know how to program in Java, C, C++, etc. and have made some games in C++/SDL, HTML5.


Tuesday, July 26, 2016

Using Convolution Network To Upscale Texture?

Using Convolution Network To Upscale Texture?
There was some outstanding demo of deep neural network being developed for artistic purpose. Google wrote deep dream which mix a content image and a style image and output an image combining both. Neural doodle extend the idea by taking a single 4 color map and output a "Monnet like" picture.

I wonder if it is possible to create and train a dnn that could upscale a texture. I know it has been done for manga/anime picture, and neural doodle can be used to "transfer" high resolution picture on minecraft blocky texture.
Unfortunately I have no experience with dnn. I know the theory behind neural network and I know the math Def of a convolution however I think I'm missing some knowledge to correctly understand dnn articles and latest evolution.

Is there some "dnn theory for game dev" resources available and can the technic be used to upscale texture?

How To Go About Releasing A Game?

How To Go About Releasing A Game?

I was programming my game today (about 20% complete) and thought to myself, "What am I actually going to do once this is finished?" Should I do an alpha release? Should I start a business? Greenlight it on steam? Advertise? I'm 15, with an above-average knowledge on business (for my age), and I can handle a lot of things - I can make websites myself and stuff, but how would I actually go about the business part of it all? This is mostly hypothetical, because my game isn't so close to done - probably months, maybe a year away from alpha.


Ecs Gui Systems

Ecs Gui Systems

Does anyone have any tips, or articles about creating GUIs in an ECS system?

 

Would an interactive console fit well into a GUI system or would it be it's own thing?

 

I feel like, a sufficiently flexible GUI system should be able to handle a console... after all, it is only a text output and input control that triggers events based on input rather than button presses or some such...

 

I suppose I am looking for a starting point...

 

Currently I have a bunch of systems, plus the render system and the minimap system...

Each system has a priority... events are processed by systems in priority order as are updates... So I thought I might have to make two systems for the GUI, one to run after the renderer to draw the gui ontop of everything and another that updates before the playerinput control to catch input events.... which shouldn't be to bad... but I don't know what kind of components I'll need...