Jump to content

  • Log In with Google      Sign In   
  • Create Account

Solid_Spy

Member Since 26 Nov 2012
Offline Last Active Aug 21 2016 10:07 PM

#5299823 What Language Is Best For Game Programming?

Posted by on 08 July 2016 - 05:18 PM

"I know it will be more than one language for the different OS's."

 

In some cases, this is unfortunately true. If you decide to take the c++ route, you may have trouble getting a game made for the Mac, as it does not have very good c++ support (it recommends objective C with Cocoa). If you choose Java, you will have the best multi-platform support, but the language is always changing constantly, and it is very slow compared to c++.

 

You may not have to use different languages sometimes, but you will have to make separate builds of libraries and your program to work on different operating/game systems.

 

From the sound of it, it looks like your best option would be Java with LWJGL.

 

It's up to you. Pick your poison.




#5298202 OpenGL like a PRO

Posted by on 27 June 2016 - 03:10 AM

To learn OpenGL like a PRO, you have to practice.. a lot. There is no simple answer. Go online and look for tutorials on how to draw a triangle on the screen, and then move on from there. There are a near infinite number of different ways to render things with OpenGL, and different programmers use different techniques. It's best to just experiment and learn as much as you can.




#5298196 Why didn't somebody tell me?

Posted by on 27 June 2016 - 02:43 AM

A lot of std library stuff isn't as slow as people say it is, and neither are smart pointers. I use those things in my game engines all the time and they never slow things down enough, so long as you are smart with them ;). I once believed that I should avoid them at all costs.




#5298172 Cannot generate libraries for libvorbis.

Posted by on 26 June 2016 - 08:20 PM

I have done it. I have officially done it!

 

For both static and dynamic libraries:

All I had to do was replace '/usr/local/lib' with 'C:\Users\NULL\Downloads\libogg\src\.libs', and '/usr/local/includes/ogg' with 'C:\Users\NULL\Downloads\libogg\include'.

 

I honestly didn't think it would work, but I was lucky :P.

 

For anyone who was struggling with this, I will sum it up in this small tutorial :):

 

Step 1: Make sure you have mingw and msys installed correctly. Bash should have been installed along with msys. It should be in the bin folder. Make sure bash is in your PATH variable as well.

 

Step 2: Open cmd.exe, and type 'mingw-get install msys-automake'. This will install the mingw safe version of automake, which you will need to use the './configure' command to generate make files from .in files.

 

Step 3: Download libogg and libvorbis online. It should be easy to find. Start with libogg, and go to their main directory (using cd of course). Type bash to enable the bash UNIX shell, and then type ./configure to create the makefiles for libogg. Then, type make to create the lib files, which should be under ../src/.libs.

 

Step 4: Do the same for libvorbis, except type './configure --with-ogg-libraries=C:\Users\YourNameHere\Downloads\libogg\src\.libs --with-ogg-includes='C:\Users\YourNameHere\Downloads\libogg\include --disable-oggtest'.

 

It's a lot to type, but it should get the job done.

 

Step 5: Lastly, type make, and you should also have the libraries for libvorbis under ../lib/.libs.

 

For Static libraries only:

 

Step 1: Make sure you have mingw and msys installed correctly. Bash should have been installed along with msys. It should be in the bin folder. Make sure bash is in your PATH variable as well.

 

Step 2: Open cmd.exe, and type 'mingw-get install msys-automake'. This will install the mingw safe version of automake, which you will need to use the './configure' command to generate make files from .in files.

 

Step 3: Download libogg and libvorbis online. It should be easy to find. Start with libogg, and go to their main directory (using cd of course). Type bash to enable the bash UNIX shell, and then type ./configure --prefix=c:/mingw --disable-shared to create the makefiles for libogg. Then, type make, press enter, and then type make install and press enter to create the lib files, which should be under ../src/.libs.

 

Step 4: Do the same for libvorbis. you should also have the libraries for libvorbis under ../lib/.libs.

 

----------------------------

 

Also, make sure the libraries are in the correct order!

 

vorbisenc

vorbisfile

vorbis

ogg

 

Credit: https://www.allegro.cc/forums/thread/555804

 

Now you can use ogg files in your game for music/sound effects without paying thousands of dollars for visual studio :D!




#5298141 Cannot generate libraries for libvorbis.

Posted by on 26 June 2016 - 01:55 PM

(SOLVED.) My brain has been melting trying to figure out how to get these two libraries to compile. It is ironic considering these are so incredibly popular in the game industry T_T.

 

I am trying to compile for windows with MinGW32, so that I can use the static libraries (.a files) for Eclipse (Oh boy, you know where this is going.).

 

I already have makeconf installed for msys, so that I can get the makefiles for libvorbis, however things aren't going as planned. I tried using bash and managed to successfully create the makefile for libogg, and I generated the .a file. However, when trying to do the same for libvorbis, I get the following error after typing './configure':

"Configure: Error: must have ogg installed!"

 

I'm not sure how I am supposed to get around this. I heard that you are supposed to use ldconfig to fix the issue, but that is a linux program. I am lost here. Does anyone have a build of libvorbis.a? It might be easier to just get the library directly, but I cannot find a download.

 

I know that there should be hundreds of indie game developers who have used ogg's in their games. Surely someone should know what to do. Please help!

 

EDIT: This site helped me generate the make file: https://www.daniweb.com/programming/software-development/threads/269305/anyone-have-ever-successful-compiled-libvorbis

using ./configure --with-ogg-libraries=/usr/local/lib --with-ogg-includes=/usr/local/includes/ogg --disable-oggtest

 

However, the makefile gives an error when using make.

Fatal error: ogg/ogg.h: No such file or directory.

 

I even tried adding it to my PATH variables, but that didn't fix it.




#5265106 How to send a CubeMap texture to a compute shader?

Posted by on 06 December 2015 - 01:59 AM

Success!

 

I found the issue. At first I thought that GL_RGBA8 and GL_RGBA32F were equivalent, for some reason :P. I changed my textures to GL_RGBA32F and now it is officially working.




#5251989 Struggling with casting cloud shadow on earth sphere in OpenGL

Posted by on 13 September 2015 - 01:31 AM

Try generating a new rotation matrix just for the cloud shadow. Do not use the same one, because it will add its rotation to the earths rotation matrix.

 

Generate the new rotation matrix by subtracting the clouds rotation by the earths rotation, and then create a rotation matrix out of those newly calculated rotations. Plug it into your shader, and that should fix the problem.




#5211797 OpenCL for both AMD and NVidia graphics cards with MinGW?

Posted by on 19 February 2015 - 07:05 PM

I know it's not quite the same, but can't you use the GL_ARB_compute_shader? Assuming you have access to version 4.3.

 

You know what, Screw OpenCL.

 

I'm goin for OpenGL 4.3 compute shaders :P.
 




#5211760 What's a good general max fps for a 3d graphics engine?

Posted by on 19 February 2015 - 03:39 PM

So when you say that you lost 200fps, you could mean that the function takes a fraction of a millisecond, or several seconds.


Add timers around blocks of CPU code, and timer events around large sections of draw calls, in order to measure how long different operations actually take.

 

Ah, Ok. I shall measure time in milliseconds for those functions from now on.




#5204863 Boost 1.5 with XML Why u no have ptree!?

Posted by on 16 January 2015 - 10:08 PM

ptree is just a typedef of basic_ptree. It is defined in boost/property_tree/ptree_fwd.hpp (which is included by ptree.hpp)

I seriously don't know how I missed that :/.




#5204852 Looking for a good way to make games in C/C++ on linux for cross-platform

Posted by on 16 January 2015 - 08:58 PM

Darn lol, I meant glfw. Idk how I made that typo. Too many effing GL acronyms :P.




#5203503 Looking for a good way to make games in C/C++ on linux for cross-platform

Posted by on 11 January 2015 - 11:21 AM

If you want something more low level, I highly recommend glfw GLSL. Although you will need additional libraries for other features such as file searching, etc.




#5203324 Speeding up cpu side of rendering engine

Posted by on 10 January 2015 - 02:26 PM

I didn't read i all, but if I understand correctly, you only need to set a vertexbuffer, texture and material once. And then just render all objects by just passing their world matrix and committing.

Do you really need the 12.000 objects to be individual objects?
If not, why not bundle them into a few objects and see how that goes, for example setting 1 world matrix to the shader instead of a couple of thousand might help you.

That is exactly what I am doing. I have a renderqueue system set up so that the vertexBuffer and materials get set only once. I only have around 20 matrices being set, not a couple thousand, because I am only rendering 4 objects, and if I am allowing rendering of a thousand objects, I use frustum culling.

 

I am not grouping objects, because I might want them to have individual collisionComponents, positionComponents, renderComponents... etc. I could try and cheat in some places by combining objects into one I guess, but it won't be very dynamic. Maybe I will do it for static objects with no collision.

 

Unfortunately, If I were making a tiled 3d dungeon crawler or a platform game, or even a bullet hell or zombie horde, I am going to need a couple thousand objects per level.




#5203310 Speeding up cpu side of rendering engine

Posted by on 10 January 2015 - 12:48 PM

Nice, one step closer smile.png
This might mean that your challenge lies more on the GPU side

Well the thing is, I have over 15000 game objects in my scene, and I am only rendering 2 of them. They are all the same object.

 

My objects only have 1 mesh and 1 material tongue.png.

 

I have a feeling it is my use of shared_ptrs and weak_ptrs that are slowing this down, because I cannot think of anything else to speed this up.

 

Here is my updated code:

void RenderingEngine::frustumCulling()
{
	std::shared_ptr<PositionComponent> curPosComp = mainCamera->GetPositionComponent();
	glm::vec3 axisPoint = glm::vec3(
			curPosComp->GetPositionX(),
			curPosComp->GetPositionY(),
			curPosComp->GetPositionZ());

	glm::vec3 planeNearDirec = glm::normalize(curPosComp->GetDirection());
	glm::vec3 planeFarDirec = -glm::normalize(curPosComp->GetDirection());
	glm::vec3 planeLeftDirec = glm::vec3(cos(curPosComp->GetRotationY()+0.77f),
										 0.0f,
										 -sin(curPosComp->GetRotationY()+0.77f));
	glm::vec3 planeRightDirec = glm::vec3(cos(curPosComp->GetRotationY()-0.77f),
										  0.0f,
										  -sin(curPosComp->GetRotationY()-0.77f));

	glm::mat4 rotationMatY = glm::rotate(glm::mat4(1.0f),
			(curPosComp->GetRotationY() * (180 / 3.14159f)),
			glm::vec3(0.0f, 1.0f, 0.0f));

	glm::mat4 rotationMatZ = glm::rotate(glm::mat4(1.0f),
			-60.0f,
			glm::vec3(0.0f, 0.0f, 1.0f));

	glm::mat4 rotationMatFinal;

	glm::vec4 tempPlaneTopDirec = glm::vec4(1.0f, 0.0f, 0.0f, 0.0f);


	rotationMatFinal = rotationMatY * rotationMatZ;

	tempPlaneTopDirec = rotationMatFinal * tempPlaneTopDirec;

	glm::vec3 planeTopDirec = glm::vec3(tempPlaneTopDirec.x,
			tempPlaneTopDirec.y,
			tempPlaneTopDirec.z);

	glm::vec3 planeDownDirec;

	glm::vec3 toNearPlaneDirec = axisPoint + (planeNearDirec * mainCamera->GetNear());
	glm::vec3 toFarPlaneDirec = axisPoint + (planeNearDirec * mainCamera->GetFar());

	glm::vec3 posCompAxisPoint = glm::vec3(1.0f);

	float dotProduct[6];

	std::weak_ptr<RenderingComponent> currentWeakRenComp;
	std::shared_ptr<RenderingComponent> currentRenComp;
	for(unsigned int i = 0; i < renderingComponents->size(); i++)
	{
		currentWeakRenComp = renderingComponents->at(i);
		if(!currentWeakRenComp.expired())
		{
			currentRenComp = currentWeakRenComp.lock();
			std::shared_ptr<PositionComponent> curRenPosComp = currentRenComp->GetPositionComponent();
			posCompAxisPoint = glm::vec3(curRenPosComp->GetPositionX(),
					curRenPosComp->GetPositionY(),
					curRenPosComp->GetPositionZ());
			glm::vec3 finalVec1 = posCompAxisPoint - toNearPlaneDirec;
			glm::vec3 finalVec2 = posCompAxisPoint - toFarPlaneDirec;
			glm::vec3 finalVec3 = posCompAxisPoint - axisPoint;
			dotProduct[0] = glm::dot(finalVec1, planeNearDirec);
			dotProduct[1] = glm::dot(finalVec2, planeFarDirec);
			dotProduct[2] = glm::dot(finalVec3, planeLeftDirec);
			dotProduct[3] = glm::dot(finalVec3, planeRightDirec);
			dotProduct[4] = glm::dot(finalVec3, planeTopDirec);
			if(dotProduct[0] >= 0 &&
			   dotProduct[1] >= 0 &&
			   dotProduct[2] >= 0 &&
			   dotProduct[3] >= 0 &&
			   dotProduct[4] >= 0)
			{
				currentRenComp->SetActive(true);
			}
		}
		else
		{
			renderingComponents->erase(renderingComponents->begin() + i);
		}
	}
}

void RenderingEngine::StartRender()
{
	glClearColor(0.2f, 0.4f, 0.6f, 1.0f);
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

	RenderObjects();
	EndRender();

}

void RenderingEngine::RenderObjects()
{
	GLuint location;

	//Get the main camera:
	for(unsigned int i = 0; i < cameras->size(); i++)
	{
		std::shared_ptr<CameraComponent> cameraComponent =
				std::static_pointer_cast<CameraComponent>(
						cameras->at(i)->GetComponentMap().find(5)->second);
		if(cameraComponent->GetCameraName() == "mainCamera")
		{
			mainCamera = cameraComponent;
		}
	}

	//Frustum culling:

	frustumCulling();

	//Update the render queues.

	std::shared_ptr<RenderingComponent> currentRenderComponent;
	for(unsigned int i = 0; i < renderingComponents->size(); i++)
	{
		currentRenderComponent = renderingComponents->at(i).lock();
		if(currentRenderComponent->GetActive() == true)
		{
			std::shared_ptr<Mesh> currentMesh = currentRenderComponent->GetMesh();
			attribVector * currentAttribBuffers = currentMesh->GetAttributeBuffers();
			materialVector * currentMaterials = currentMesh->GetMaterialVector();

			for(unsigned int j = 0; j < currentAttribBuffers->size(); j++)
			{
				std::shared_ptr<AttributeBuffer> currentAttrib = currentAttribBuffers->at(j);
				std::shared_ptr<Material> currentMaterial;
				for(unsigned int k = 0; k < currentMaterials->size(); k++)
				{
					if(currentMaterials->at(k)->GetMaterialName() == currentAttrib->materialName)
					{
						currentMaterial = currentMaterials->at(k);
					}
				}
				RenderQueueNode renderQueueNode;
				renderQueueNode.attribute = currentAttrib;
				renderQueueNode.renderingComponent = currentRenderComponent;
				renderQueueNode.material = currentMaterial;
				renderQueueNode.blendType = currentMaterial->GetBlending();
				renderQueueNode.shaderIndex = currentMaterial->GetShaderIndex();
				renderQueueNode.distanceFromCamera = 0;
				renderQueueNode.frameBuffer = 0;

				if(renderQueueNode.blendType == SOLID_BLEND_NORMAL)
				{
					renderQueueOpaque.push_back(renderQueueNode);
				}
				else
				{
					renderQueueAltBlend.push_back(renderQueueNode);
				}
			}
		}
	}

	mainCamera->GenerateViewAndProjMatrix();

	//Render main objects:
	//Render the sub meshes in the render queues:

	LoopThroughRenderQueue();
}

What would you recommend that I do to speed things up?




#5202895 Speeding up cpu side of rendering engine

Posted by on 08 January 2015 - 01:24 PM

UPDATE:

Ok, so I tried a release build instead this time.

 

Doing a release build made everything run much faster, but lags a little still.






PARTNERS