Jump to content

  • Log In with Google      Sign In   
  • Create Account


beefsteak

Member Since 09 Oct 2004
Offline Last Active Aug 04 2013 07:12 AM

Posts I've Made

In Topic: snap-back synchronization?

01 August 2013 - 03:58 PM

What you describe sounds like the client is only interpolating between packets of data received from the server.

With such an approach smooth movement is hard to achieve:

1. Due to network latency, data displayed on the client side is never up-to-date. The client "lags".

2. Due to network latency, the packets don't arrive at perfectly regular intervals. Latency will cause "jumps" in your movement animations.

 

The better solution is to implement client-side movement prediction, as hplus0603 pointed out. With a good movement prediction algorithm, corrections will happen rarely.

 

Here's an article that explains the whole issue very clear and from a high level perspective:

http://gafferongames.com/networking-for-game-programmers/what-every-programmer-needs-to-know-about-game-networking/

 


In Topic: Taskbar aero preview not working with DX9 fullscreen mode

01 August 2013 - 07:38 AM

The flag WS_EX_LAYERED didn't change much. For some reason, with WS_EX_LAYERED the preview is not entirely blank anymore, but rather showing an empty (white) window including borders and title bar.

The function DwmSetIconicLivePreviewBitmap is part of the WDM api, which I'd rather not use due to Windows XP support. Using it would allow for some workarounds probably.


In Topic: Getting notified when fullscreen mode is interrupted

01 August 2013 - 04:59 AM

In your windows message loop, you can listen for events of type "WM_ACTIVATE" and "wParam == WA_INACTIVE".

See the msn documentation for details.

 

This will solve only part of your problem though, because it won't work for all the possible cases:

  • For alt-tab and windows-key, you will receive a WM_ACTIVATE event.
  • For ctrl+alt+del and lock screen (windows-key + L) you will not receive an event.

 

So, if you really want to catch all possible cases where your fullscreen mode is interrupted, you have to do what Medo3337 pointed out:

In regular time intervals, actively check the state of your window and/or your display device. This might seem inconvenient, but I have found no better way.


In Topic: Taskbar aero preview not working with DX9 fullscreen mode

01 August 2013 - 04:15 AM

A also pondered about the device- and window-class configurations I am using: Maybe some special setting
I am using in fullscreen mode causes incompatibility issues with the windows desktop manager?

 

In case it matters I have posted my configurations below:
 

// window style for window-mode: title bar, close box, minimize box
const DWORD Window::WIN_STYLE_WINDOWED = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX;

// window style for fullscreen: no titlebar, popup style
const DWORD Window::WIN_STYLE_FULLSCREEN = WS_POPUP | WS_VISIBLE;

Window::Window(HINSTANCE hInstance, WNDPROC messageHandler, LPCTSTR title, int width, int height, bool pFullscreen):
window(NULL),
activeCursor(NULL),
fullscreen(pFullscreen)
{
	// start with default cursor
	activeCursor = DfCursor::C_DEFAULT;

	// define window class properties
	windowClass.style = NULL;
	windowClass.lpfnWndProc = messageHandler;
	windowClass.cbClsExtra = 0;
	windowClass.cbWndExtra = 0;
	windowClass.hInstance = hInstance;
	windowClass.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_APP_ICON));
	windowClass.hCursor = activeCursor == NULL ? NULL : activeCursor->getWinCursor();
	windowClass.hbrBackground = NULL;
	windowClass.lpszMenuName = NULL;
	windowClass.lpszClassName = title;
	RegisterClass(&windowClass);

	// calculate correct window size and position
	RECT clientRect;
	calculatePosition(width, height, fullscreen, &clientRect);

	window = CreateWindow(windowClass.lpszClassName,
			title,
			fullscreen ? WIN_STYLE_FULLSCREEN : WIN_STYLE_WINDOWED,
			clientRect.left, clientRect.top,
			clientRect.right - clientRect.left, clientRect.bottom - clientRect.top,
			GetDesktopWindow(), NULL, windowClass.hInstance, NULL);

	if (window == NULL) {
		throw (TEXT("Window Constructor: Failed to create a new window!"));
	}
}
DfGraphicsManager::DfGraphicsManager(ResourceManager *resourceManager, HWND window, int width, int height, bool fullscreen):
resourceManager(resourceManager),
context(NULL),
device(NULL),
desiredScreenResolutionX(width),
desiredScreenResolutionY(height) {
	context = Direct3DCreate9(D3D_SDK_VERSION);

	if (context == NULL) throw(TEXT("D3DManager Constructor: Failed to create a Direct3D Context!"));

	parameters.BackBufferWidth = width; parameters.BackBufferHeight = height;
	parameters.BackBufferFormat = D3DFMT_X8R8G8B8;
	parameters.BackBufferCount = 1;
	parameters.MultiSampleType = D3DMULTISAMPLE_NONE;
	parameters.MultiSampleQuality = 0;
	parameters.SwapEffect = D3DSWAPEFFECT_FLIP; // flip between front and back buffer
	parameters.hDeviceWindow = window;
	parameters.Windowed = !fullscreen;
	parameters.EnableAutoDepthStencil = true;
	parameters.AutoDepthStencilFormat = D3DFMT_D16;
	parameters.Flags = NULL;
	parameters.FullScreen_RefreshRateInHz = 0;
	parameters.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;

	// create the device.
	HRESULT result = context->CreateDevice(D3DADAPTER_DEFAULT, D3DDEVTYPE_HAL, window,
		D3DCREATE_MIXED_VERTEXPROCESSING, &parameters, &device);
	errorCheck(result, TEXT("D3DManager Constructor: Failed to create device!\r\n"));

	// for a 2D application: turn off z-buffer, culling and lightning
	device->SetRenderState(D3DRS_ZENABLE, false);
	device->SetRenderState(D3DRS_LIGHTING, FALSE);
	device->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);
}

In Topic: MORPG "Darkfire Legends" is now online

29 November 2012 - 05:44 PM

I'd love some feedback Posted Image

PARTNERS