Jump to content

  • Log In with Google      Sign In   
  • Create Account

ryan mccabe

Member Since 27 Mar 2008
Offline Last Active Oct 25 2013 06:08 PM

Topics I've Started

space game engine advice

23 September 2013 - 03:34 PM

Hi, I'm hoping one of you has some experience to share. Im trying to get a demo going for a space game. I started writing an engine on my own, which was slow and painful but worth the experience. Moving past that I got into unity only to find that to get good performance and visuals you'll need to buy the pro version, which is where I'm leaning. cryEngine 3 peaked my interest but the indie licensing comes with some serious horror stories up to having an admin delete a small studios account. Also CE3 and UDK are both fps focused and thus need some serious hacking to get to work with a space game. My focus is the visuals, its where Ill spend most of my time, making me wonder if the pain of UDK for a space game might be worth it over unity. Also I'm not at all impressed with unity's visual capabilities vs performance and complexity. 

 

I know there are a lot of engines to pick from but given what I've stated does anyone have recommendations, maybe something I've overlooked?

 

 


some questions on getting input

20 December 2011 - 10:33 PM

I had my input system written but it was a strange mix of windows messages and polling with getasync() ect. The real problem though was that when trying to use the mouse and the keyboard the entire engine stuttered. I'm no too sure what I did there but it pushed me to try to wrap raw input and depend only on that. Its resolved the stuttering but now I'm getting mouse lag like Ive never seen. Everything keeps moving fine but a second of mouse movement is turning into a minute of movement and being locked out of further input. So if i move the mouse and hit esc to quit I have to wait for the extremely slowed input lag to finish. The whole thing is rather frustrating I'm almost ready to say die and hook in directinput, but then again that may be more hours of debugging.

What I really want to do is sidestep the message queue and go with nothing but getasync() for movement controls, will that cause problems down the line?
Raw Input is recommended but its the most complicated, for movement controls is it really the best choice?
Anyone have a link / name for some demo code and / or wrappers for raw input (c++)?

Lastly, if anyone has a minute could you take a look at the input code's latest incarnation and let me know if a message queue lagging issue pops? Any comments on the code are more than welcome too.

	switch(umsg)
	{
	case WM_CREATE:
		{
			RAWINPUTDEVICE Rid[2];

			Rid[0].usUsagePage = 0x01; 
			Rid[0].usUsage = 0x02; 
			Rid[0].dwFlags = 0;   // adds HID mouse 
			Rid[0].hwndTarget = 0;

			Rid[1].usUsagePage = 0x01; 
			Rid[1].usUsage = 0x06; 
			Rid[1].dwFlags = 0;   // adds HID keyboard 
			Rid[1].hwndTarget = 0;

			if (RegisterRawInputDevices(Rid, 2, sizeof(Rid[0])) == FALSE) {
				strPrinter("input registration failed");
			}

			
		}

	case WM_INPUT:
		{
			UINT dwSize;
			// Determine how big the buffer should be
			GetRawInputData((HRAWINPUT)lParam, RID_INPUT, NULL, &dwSize, 
				sizeof(RAWINPUTHEADER));
			BYTE* lpb;
			lpb = new BYTE[dwSize];
			
			if (lpb == NULL) 
			{
				strPrinter("lpb not initialized");
				return 0;
			} 

			if (GetRawInputData((HRAWINPUT)lParam, RID_INPUT, lpb, &dwSize, 
				sizeof(RAWINPUTHEADER)) != dwSize )
				strPrinter("GetRawInputData does not return correct size !");

			GetRawInputData((HRAWINPUT)lParam, RID_INPUT,(LPVOID)lpb, &dwSize, 
				sizeof(RAWINPUTHEADER));
			RAWINPUT* raw = (RAWINPUT*)lpb;

			switch (raw->header.dwType)
			{
			case RIM_TYPEMOUSE:	
				{
					// read the mouse data
					long mx = raw->data.mouse.lLastX;
					long my = raw->data.mouse.lLastY;
					m_Input->mouseMove(mx, my);
					delete[] lpb;
					return 0;
				}
			case RIM_TYPEKEYBOARD:
				{
					// read the keyboard data
					m_Input->KeyUp(raw->data.keyboard.VKey);
					delete[] lpb;
					return 0;
				}
			}
			delete[] lpb;
			return 0;
		}

Thanks guys n gals.

simple problem with assigning a value

14 December 2011 - 03:48 PM

I have some really simple code that does not do what it should. The function gets an x and a y value, updates if there is a change, or sets a value to 0 if no change has occurred. The problem is that the value isn't being set to 0.

bool CameraClass::Update(float x, float y)
{

	// right mouse button for camera rotation
	if(GetAsyncKeyState(0x02))
	{
		if(m_rotationX != x)
			m_rotationX =  x;
		else {
//here is the problem. m_rotation is not being changed. The same happens with the y value.
			m_rotationX = 0.0f;
			printFloat(m_rotationX);
			printFloat(x);
		}
		if(m_rotationY != y)
			m_rotationY =  y; 
		else m_rotationY = 0.0f;
	} 
	if(!GetAsyncKeyState(0x02))
	{
		m_rotationX = 0;
		m_rotationY = 0;
	}
	return true;
}

printFloat is only called if m_rotationX is set to 0 first, but in the print out the values always print the matching pair. So if m_rotationX is 100 and x is 100 i get (100, 100) printed. What should happen is I get (0, 100) since the pair matched and m_rotationX was set to 0.

Its boggling my mind a bit. I don't see how setting a value in such a straight forward way could fail. Any advice?

Edit: camera behavior also confirms the print.

object creation from script

20 September 2011 - 07:10 PM

Ive been mulling this over for a while. Im at a point where the number of objects in my demo engine is growing painful manage. Rather than write out object something = new classT for each and every new object, is it possible to write a file parser / script interface that will generate objects and delete them?

for example:
if level1
run (level1script)

run(script)
//get create the objects
build(entities)
initialize(entities)

build(entities)
//get pointers to objects
for all entities
"name from file" = new entity

initialize(entities)
//initialize entities from file
for all entities
setAttributes(entity)

setAttributes(entity)
//read and return the attributes to initialize with
entity(findInFile(entity))

What I cant figure out is how to write code so that it will make objects based on whats written in a file. Can i just copy strings from a file and use some clever sprintf useage to get it to be a name, or do i set a vector to hold all the created objects of a given type and have the script manage whats where?

Sorry if this is all very confusing, Im just confused about it myself, but i cant imagine that every simgle object must be hard coded into c++. If its standard to do so please tell me though :)

ryan

online storage.

17 September 2011 - 01:32 AM

Between using a pc, tablet, and smartphone, Ive realized online storage makes a lot of sense. But the options are really confusing. Game models, source code, books, and research articles are something i use on 2 of 3 devices each, at least. So Im wondering what you guys use?

PARTNERS