Jump to content

  • Log In with Google      Sign In   
  • Create Account

Interested in a FREE copy of HTML5 game maker Construct 2?

We'll be giving away three Personal Edition licences in next Tuesday's GDNet Direct email newsletter!

Sign up from the right-hand sidebar on our homepage and read Tuesday's newsletter for details!


We're also offering banner ads on our site from just $5! 1. Details HERE. 2. GDNet+ Subscriptions HERE. 3. Ad upload HERE.


Rarosu

Member Since 16 Jun 2010
Offline Last Active Sep 26 2014 03:39 AM

Topics I've Started

WebRTC for peer to peer multiplayer?

22 September 2014 - 11:18 AM

Hello!

I've gotten interested in making multiplayer games using HTML5. I've looked into WebSockets via socket.io, but I was disappointed that all the communication seemed to have to go through the server. What I had been hoping for was to use the web server only as a kind of matchmaker and resource deliverer, and let the clients send the game state updates between each other (with the client that created the game acting as the game server). Without this kind of direct communication between the clients, it seems like the web server would get an unproportionate workload, especially with a couple of games running.

I found that WebRTC could be used for peer to peer communication in browsers, but I haven't found much information on the subject. Has anyone used this for a game yet? Is there any proper documentation available? How realistic is it to implement peer-to-peer communication via the browser at the current date? :)

I would love to hear the experiences of anyone else who has been developing multiplayer games for the web and what the common solutions are, if any.

Effects11: Check for supported shader version?

17 August 2012 - 05:27 AM

Hello,

I'm getting a problem when creating an effect using the Effects11 framework:

D3D11: ERROR: ID3D11Device::CreateVertexShader: Shader must be vs_4_0 or vs_4_1. Shader version provided: vs_5_0 [ STATE_CREATION ERROR #167: CREATEVERTEXSHADER_INVALIDSHADERTYPE ]
First-chance exception at 0x000007fefde9cacd in WarSettlers.exe: Microsoft C++ exception: _com_error at memory location 0x0018e620..
D3D11: ERROR: ID3D11Device::CreatePixelShader: Shader must be ps_4_0 or ps_4_1. Shader version provided: ps_5_0 [ STATE_CREATION ERROR #193: CREATEPIXELSHADER_INVALIDSHADERTYPE ]
First-chance exception at 0x000007fefde9cacd in WarSettlers.exe: Microsoft C++ exception: _com_error at memory location 0x0018e620..

So my card isn't supporting a shader version higher than 4.1. Fair enough. I can switch adapter and then it works fine. My problem is that D3DX11CreateEffectFromMemory from which these errors originate returns S_OK. And then the program breaks because it cannot find a bound vertex and pixel shader. I'd really like to be able to catch this and output a proper error to the user, so my question is if there is any way of detecting this?

The code I use for compiling and creating an effect below:

// Compile the effect
ID3D10Blob* shader;
ID3D10Blob* errors;

HRESULT result = D3DX11CompileFromFile("Resources/Effects/BasicColor.fx",
	NULL,
	NULL,
	NULL,
	"fx_5_0",
	D3D10_SHADER_ENABLE_STRICTNESS | D3D10_SHADER_DEBUG,
	0,
	NULL,
	&shader,
	&errors,
	NULL);

if (FAILED(result))
{
	std::string errorMessage;
	if (errors != NULL)
	{
		errorMessage = static_cast(errors->GetBufferPointer());
	}
	else
	{
		errorMessage = "Could not find effect file";
	}

	throw DirectXErrorM(result, errorMessage);
}

result = D3DX11CreateEffectFromMemory(shader->GetBufferPointer(), shader->GetBufferSize(), 0, GetD3D().GetDevice().Resource(), &m_effect.Resource());
if (FAILED(result))
{
	throw DirectXErrorM(result, "Failed to create effect from compiled blob.");
}

Does anyone have any idea on how to check if the vertex- and pixel shader have been actually created by the effect?

PARTNERS