Jump to content

  • Log In with Google      Sign In   
  • Create Account


GrimmBro

Member Since 28 Jan 2013
Offline Last Active Today, 11:54 AM
-----

Posts I've Made

In Topic: Game Development - Where to start?

16 May 2014 - 07:04 AM

Hi Arsoul, I think I know where you're coming from. Before doing a Computer Game related degree at a well known university I studied Computing & IT. The Computer Game related degree had more complex programming as well as learning other new skills. Going to do a Computer Game related qualification is good because you get to study with like minded individuals in a focused environment but it all depends if you can afford it or not. After university there are Student Loans and such to worry about.

 

Like Avalander says you can teach yourself from the internet; either that or books. Sometimes it may be best to work with what you've got and develop a portfolio in your own time if possible. 

 

All that aside a Computer Game related course can help you get on your way to learning what you need but making some demo programs and putting them on a site is a good way to get noticed. There are also various expos and such you can showcase work if you feel confident enough to show off your work when ready.

 

Most importantly you should get a grasp on the programming/scripting language(s) you wish to develop games in.

 

Hope that helps.


In Topic: Windows 8 Game Development

26 July 2013 - 07:00 PM

Rapid2D is worth checking out; would definitely recommend.


In Topic: Change texture at runtime?

06 February 2013 - 09:54 AM

Sorry for all the code in advance but am I to update the render call somehow after a graphical element in the array is switched?

 

PixelShader.hlsl

Texture2D Texture;
SamplerState samplerState;

struct PixelShaderInput
{
	float4 pos : SV_POSITION;
	float4 color : COLOR;
	float2 texcoord : TEXCOORD;
};

float4 main(PixelShaderInput input) : SV_TARGET
{
	return input.color * Texture.Sample(samplerState, input.texcoord);
}

 

VertexShader.hlsl

cbuffer PerFrameCB : register(b0)
{
	matrix view;
	matrix projection;

	float4 lightVector;
    float4 lightColor;
    float4 ambientColor;
};

cbuffer PerObjectCB : register(b1)
{
	matrix modeltransform;
}

struct VertexShaderInput
{
	float4 pos : POSITION;
	float4 normal : NORMAL;
	float2 texcoord : TEXCOORD;
};

struct VertexShaderOutput
{
	float4 pos : SV_POSITION;
	float4 color : COLOR;
	float2 texcoord : TEXCOORD;
};

VertexShaderOutput main(VertexShaderInput input)
{
	VertexShaderOutput output;
	float4 pos = input.pos;

	// Transform the vertex position into projected space.
	pos = mul(pos, modeltransform);
	pos = mul(pos, view);
	pos = mul(pos, projection);
	output.pos = pos;

	output.color = ambientColor;

	float diffusebrightness = saturate(dot(input.normal, lightVector));
    output.color += lightColor * diffusebrightness;

	output.texcoord = input.texcoord;

	return output;
}

in Dungeon.cpp

void Dungeon::CreateGraphicsElements(Microsoft::WRL::ComPtr<ID3D11Device1>& dev, Microsoft::WRL::ComPtr<ID3D11DeviceContext1>& devCon)
{
	//create graphics elements
	m_DungeonElements.resize(m_DungeonArray.size());
	for (unsigned int i = 0; i < m_DungeonArray.size(); ++i)
	{
		m_DungeonElements[i].resize(m_DungeonArray[i].size());
	}

	float dungeonWidth = KElementSize*m_DungeonElements.size();
	float dungeonHeight = KElementSize *m_DungeonElements[0].size();

	for (unsigned int i = 0; i < m_DungeonElements.size(); i++)
		for (unsigned int j = 0; j < m_DungeonElements[i].size(); j++)
		{
			Microsoft::WRL::ComPtr<ID3D11ShaderResourceView> selectedTexture = nullptr;
			int scaleHeight = 1;
			float elementY = -ElementSize;
			switch (m_DungeonArray[i][j])
			{
			case 1://wall
				scaleHeight = 2;
				elementY = 0;
				selectedTexture = m_TextureWall;
				break;
			case 2://cave
				selectedTexture = m_TextureCave;
				break;
			case 3://vegetation
				scaleHeight = 2;
				elementY = 0;
				selectedTexture = m_TextureVegetation;
				break;
			case 4://liquid
				selectedTexture = m_TextureLiquid;
				scaleHeight = 2;
				elementY = 0;
				break;
			case 5://gold
				selectedTexture = m_TextureGold;
				scaleHeight = 2;			
				elementY = 0;
				break;
			}

			m_DungeonElements[i][j] = new CDungeonElement(Vector3D( 0+j*KElementSize-dungeonWidth/2.0f, elementY, 0-i*KElementSize+dungeonHeight/2.0f), Vector3D(KElementSize, KElementSize*scaleHeight, KElementSize),
				selectedTexture, aDev, aDevCon);
			
	                //states to try and change certain blocks on array which are triggered by key presses.
              		if (m_blockState == BlockState::Path)
			{
				m_DungeonArray[3][3]=5;
			}
			if (m_blockState == BlockState::Wall)
			{
				m_DungeonArray[2][3]=5;
			}
			
			
		}
		}

this is called in

void Dungeon::createDungeon(Microsoft::WRL::ComPtr<ID3D11Device1>& dev, Microsoft::WRL::ComPtr<ID3D11DeviceContext1>& devCon)

in Game.cpp

 

void Game::Render()
{
	// bind the render targets
	m_d3dContext->OMSetRenderTargets(
		1,
		m_d3dRenderTargetView.GetAddressOf(),
		m_d3dDepthStencilView.Get()
		);
	
	// clear both the render target and depth stencil to default values
	const float black[] = { 0.0f, 0.0f, 0.0f, 1.000f };		//Clears screen to black.
	m_d3dContext->ClearRenderTargetView(
		m_d3dRenderTargetView.Get(),
		black
		);

	if (!m_deferredResourcesReady)
	{
		// Only render the loading screen for now.
		m_loadScreen->Render();
		return;
	}

	m_d3dContext->ClearDepthStencilView(
		m_d3dDepthStencilView.Get(),
		D3D11_CLEAR_DEPTH,
		1.0f,
		0
		);

	if (!m_loadingComplete)
	{
		return;
	}	

	m_d3dContext->IASetInputLayout(m_inputLayout.Get());

	// set the vertex shader stage state
	m_d3dContext->VSSetShader(
		m_vertexShader.Get(),
		nullptr,
		0
		);

	m_d3dContext->VSSetConstantBuffers(
		0,
		2,
		m_constantBuffer[0].GetAddressOf()
		);

	m_d3dContext->PSSetShader(
		m_pixelShader.Get(),
		nullptr,
		0
		);
	
	mp_Dungeon->Render(m_d3dContext, m_constantBuffer[1]);
	

}

 

void Game::Update(float timeTotal, float timeDelta)
{
	UNREFERENCED_PARAMETER( timeDelta );

#pragma region loading checks

	if (!m_loadingComplete) 
		return;

	if (!m_deferredResourcesReady)
	{		return;
	}
#pragma endregion loading checks

	ProcessInput();
		
	int res = mp_Dungeon->Update(timeDelta);		//update dungeon (only deals with player position for now)
	
		m_d3dContext->UpdateSubresource(
		m_constantBuffer[0].Get(),
		0,
		NULL,
		&m_constantBufferDataPerFrame,
		0,
		0
		);

	        m_d3dContext->UpdateSubresource(
		m_constantBuffer[1].Get(),
		0,
		NULL,
		&m_constantBufferDataPerObject,
		0,
		0
		);

}

Pretty sure I'm going to kick myself when I find out how to do this but I will be so happy when I do. Can anyone let me know how I can switch the graphical element value in the array and have it update in game?


PARTNERS