Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
dizzywhip
Dec 23, 2005

Rupert Buttermilk posted:

I'm just starting in game development, and have decided, at least for now, to try my hand at Stencyl. Now, I know that this can come across as 'Baby's First Game Engine', but whatever, I don't have much programming know-how, but I'm willing to work on it, learn more as time goes on, and just get better, all-around. I'm not kidding myself into thinking that I'm going to be some overnight millionaire, or even close, but goddammit, do I want to make my own game.

That being said, I question how far one can go with something like Stencyl. I see that you're not limited JUST to using pre-made stuff, that if you know progamming (Actionscript?) you can get a lot of custom poo poo done. I'm sort of thinking of making a game that is, I won't like, heavily inspired by Mario 3. For clarification, I mean multiple overworlds with a beginning, end, as well as levels along the way, usable items, bonuses... stuff like that. Does anyone know if an engine like Stencyl can do this?

Also, I plan on dedicating a lot of my time to getting the physics of movement just right, so that they don't feel stiff, or too floaty. Can this be done with Stencyl, or are there a lot of limitations with it?

I honestly don't know enough about Stencyl to tell you about it's particular limitations, but with any tool like that, if you don't want to write any code whatsoever, you're probably not going to be able to get the exact behavior you want all the time. Especially with something like tweaking the physics and movement, you'll probably hit some major roadblocks pretty quickly.

With that said, I think those kinds of tools are great stepping stones to becoming familiar with programming. For example, check out this screenshot on their website. A little graphical behavior editor like that is really not significantly different from writing code, it's just in a more restricted environment that is easier for newcomers to pick up. I'm not sure if Stencyl lets you see the code that it spits out from the GUI, but if it does I think it would be a great learning experience to use Stencyl for a while, then start looking at what it's creating and figuring out how it works.

I also just read that Stencyl lets you write code directly in the behavior GUI, which would also be a great way to transition into writing code.

So basically I think you'll probably be able to accomplish 90% of what you want your game to do with Stencyl, but to get that last 10% you'll need to start writing some code, and Stencyl seems like it will be very helpful with that transition.

Adbot
ADBOT LOVES YOU

Top Bunk Wanker
Jan 31, 2005

Top Trump Anger
Do any guides/tutorials for OpenAL that are newer than 2003-2005 exist? I'm making feeble beginner attempts at using it and I can't find anything that's really helpful for me.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
OpenAL's API has not changed since 2005 anyway, even the "dated" stuff is pretty much current.

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

Physical posted:

I already have RenderState.DepthBufferWriteEnable = true set, what more is there to do to get a z-buffer working?

Here are a couple pictures describing what I am trying to do. The order in which they get ordered is Skybox (that is both the skybox and the clouds) and then the World (the voxel boxes) So this looks fine until the view is above the layer cloud. Then the ground layer eclipses the clouds, which it shouldn't because the ground is technically 20 pixels below the cloud layer.




So maybe should the way I render this be the skybox, ground and create a z-buffer/depth stencil at this point, and then the clouds applying the buffer/stencil?

I'm guessing you're doing this:

  1. turn depth buffer off
  2. draw skybox
  3. draw clouds
  4. turn depth buffer back on
  5. draw ground + whatever else

If that's the case, as a quick test, you could move turning the depth buffer back on up a step (to between drawing skybox and drawing clouds) and the clouds should show up on top of the ground when they're supposed to, although they won't blend correctly. Like Vino said, you really want to move all your transparent/translucent drawing (like drawing the clouds) down after you draw all your solid objects (like the ground) so it will blend correctly.

If that's not it, you're probably missing something in turning the depth buffer on. I haven't used XNA much (I assume that's what your using...), so I'm not sure if it involves more than that. In OpenGL, if I remember correctly, you also have to request a depth buffer when making the window before you enable it, so there might be something like that in XNA.

Edit: Could also have something to do with what your RenderState.DepthBufferFunction is set to, as well. Should be set to Less or LessEqual I think. Never used that when I mucked with XNA.

tl;dr: Could be 1) your draw order is wrong, 2) don't really have depth buffer on or 3) your depth buffer function is set wrong.

ZombieApostate fucked around with this message at 05:54 on Jul 31, 2011

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:
I need a retard check to figure out what it is I'm doing wrong. I'm working on loading models with Assimp in C++ and displaying them with OpenGL. I previously had models and textures generally loading and displaying properly using ColladaDOM, but I wanted to kill myself every time I thought about working on that code, thus the switch to Assimp.

I've got the basic model loading bit written out and when I look at the data after I transfer it to my internal format, it looks like it's all there and intact, but when I try to draw it, I get the old flickery triangle vomit you get when OpenGL doesn't like what you're giving it. These are models that worked when I was using ColladaDOM and my drawing code only changed slightly to accommodate a small change I made to my internal format in response to Assimp, so I don't think there's anything wrong there. The way I'm drawing stuff does rely on the data to be triangulated and in triangles rather than triangle strip or fan. That wouldn't be that hard to change, but I haven't been able to find anywhere that says what format the data will come out of post processing in.

Things I've tried:
  1. Temporarily switching my drawing code to triangle fan and triangle strip.
  2. Slapping glGetError() all over the place in my drawing code, all return GL_NO_ERROR.
  3. Reducing the post processing options down to the bare minimum that look like it would triangulate and remove poo poo I don't want/don't deal with.
  4. Temporarily modify my drawing code to just draw the first triangle.
  5. Run through glslDevil, no complaints.
  6. Rummage through the data in the visual studio debugger for blatantly obvious problems.

Any observations would be useful at this point.

Also, I know there's some :barf: overuse of classes and dumb data copying that I'm planning on changing, but I want to get it working first so I don't have to start doubting those changes too.

code:
m_defaultReadFileFlags = aiProcess_CalcTangentSpace | aiProcess_JoinIdenticalVertices | aiProcess_Triangulate |
aiProcess_RemoveComponent | aiProcess_GenSmoothNormals | aiProcess_SplitLargeMeshes | aiProcess_LimitBoneWeights |
aiProcess_ValidateDataStructure | aiProcess_ImproveCacheLocality | aiProcess_RemoveRedundantMaterials |
aiProcess_FixInfacingNormals | aiProcess_SortByPType | aiProcess_FindDegenerates | aiProcess_FindInvalidData |
aiProcess_GenUVCoords | aiProcess_TransformUVCoords | aiProcess_FindInstances | aiProcess_OptimizeMeshes |
aiProcess_OptimizeGraph
code:
#include "AssimpLoader.h"

#include <assert.h>

#include "RenderGlobals.h"
extern RenderGlobals renderGlobals;

AssimpLoader::AssimpLoader(void)
{
}


AssimpLoader::~AssimpLoader(void)
{
	close();
}

void AssimpLoader::init(void)
{
	close();
}

void AssimpLoader::close(void)
{
	m_importer.FreeScene();
	m_scene = NULL;
	m_mesh = renderGlobals.meshMgr.getInvalidIndex();
}

bool AssimpLoader::import(const string &_filename)
{
	//set the info we don't care about and want stripped out
	m_importer.SetPropertyInteger(AI_CONFIG_PP_RVC_FLAGS, aiComponent_COLORS | aiComponent_LIGHTS | aiComponent_CAMERAS);
	m_importer.SetPropertyInteger(AI_CONFIG_PP_SBP_REMOVE, aiPrimitiveType_POINT | aiPrimitiveType_LINE);

	//read the given file with default postprocessing
	m_scene = m_importer.ReadFile(_filename, m_defaultReadFileFlags);
  
	if( !m_scene)
	{
		//ERROR: AssImp failed to read a file : importer.GetErrorString()
		assert(0);
		return false;
	}

	//now we can access the file's contents. 
	m_mesh = renderGlobals.meshMgr.add();
	m_mesh->init();
	m_mesh->setFilename(_filename);
	matrix4 transform;
	transform.identity();
	processNode(m_scene->mRootNode, *(m_mesh->getRootMeshNode()), transform);

	return true;
}

void AssimpLoader::processNode(aiNode *_node, Index<MeshNode> &_parentMeshNode, const matrix4 &_cumulativeTransform)
{
	Index<MeshNode> newNode;
	matrix4 newTransform;
	if (_node->mNumMeshes > 0)
	{
		//add a new child and copy the mesh info into it
		Index<MeshNode> childMeshNode = renderGlobals.meshNodeMgr.add();
		childMeshNode->init();
		_parentMeshNode->addChild(childMeshNode);
		childMeshNode->setNameID(_node->mName.data);

		//copy mesh info here
		copyNodeData(_node, childMeshNode);

		newNode = childMeshNode;
		newTransform.identity();
	} else {
		//no mesh info, so accumulate this node's transform and move on
		newNode = _parentMeshNode;
		translateMatrix(_node->mTransformation, newTransform);
		newTransform = newTransform * _cumulativeTransform;
	}

	//process any child nodes
	for (unsigned int scan = 0; scan < _node->mNumChildren; ++scan)
	{
		processNode(_node->mChildren[scan], newNode, newTransform);
	}
}

void AssimpLoader::copyNodeData(aiNode *_node, Index<MeshNode> &_meshNode)
{
	for (unsigned int scan = 0; scan < _node->mNumMeshes; ++scan)
	{
		Index<MeshGeometry> meshGeometry = renderGlobals.meshGeometryMgr.add();
		meshGeometry->init();
		unsigned int index = _node->mMeshes[scan];
		aiMesh *mesh = m_scene->mMeshes[index];

		vector<Index<MeshTriangles>> *trianglesList = meshGeometry->getTriangles();
		Index<MeshTriangles> triangles = renderGlobals.meshTrianglesMgr.add();
		triangles->init();
		trianglesList->push_back(triangles);

		vector3 v;

		//copy vertex data
		if (mesh->HasPositions())
		{
			Index<MeshVertices> *meshVerts = triangles->getVertices();
			*meshVerts = renderGlobals.meshVerticesMgr.add();
			(*meshVerts)->init();
			vector<vector3> *vertices = (*meshVerts)->get();
			for (unsigned int vertScan = 0; vertScan < mesh->mNumVertices; ++vertScan)
			{
				v.x = mesh->mVertices[vertScan].x;
				v.y = mesh->mVertices[vertScan].y;
				v.z = mesh->mVertices[vertScan].z;
				vertices->push_back(v);
			}
		}

		//copy normal data
		if (mesh->HasNormals())
		{
			Index<MeshNormals> *meshNormals = triangles->getNormals();
			*meshNormals = renderGlobals.meshNormalsMgr.add();
			(*meshNormals)->init();
			vector<vector3> *normals = (*meshNormals)->get();
			for (unsigned int normScan = 0; normScan < mesh->mNumVertices; ++normScan)
			{
				v.x = mesh->mNormals[normScan].x;
				v.y = mesh->mNormals[normScan].y;
				v.z = mesh->mNormals[normScan].z;
				normals->push_back(v);
			}
		}

		//copy texture coordinate data
		if (mesh->HasTextureCoords(0))
		{
			Index<MeshTexCoords> *meshTexCoords = triangles->getTexCoords();
			*meshTexCoords = renderGlobals.meshTexCoordsMgr.add();
			(*meshTexCoords)->init();
			vector<vector<vector3> > *texCoords = (*meshTexCoords)->get();
			texCoords->clear();
			for (unsigned int uvChannelScan = 0; uvChannelScan < mesh->GetNumUVChannels(); ++uvChannelScan)
			{
				texCoords->push_back(vector<vector3>());
				for (unsigned int texCoordScan = 0; texCoordScan < mesh->mNumVertices; ++texCoordScan)
				{
					v.x = mesh->mTextureCoords[uvChannelScan][texCoordScan].x;
					v.y = mesh->mTextureCoords[uvChannelScan][texCoordScan].y;
					v.z = mesh->mTextureCoords[uvChannelScan][texCoordScan].z;
					(*texCoords)[uvChannelScan].push_back(v);
				}
			}
		}

		//copy index data
		if (mesh->HasFaces())
		{
			vector<unsigned int> *indices = triangles->getIndices();
			for (unsigned int faceScan = 0; faceScan < mesh->mNumFaces; ++faceScan)
			{
				for (unsigned int indexScan = 0; indexScan < mesh->mFaces[faceScan].mNumIndices; ++indexScan)
				{
					indices->push_back(mesh->mFaces[faceScan].mIndices[indexScan]);
				}
			}
		}

		//copy the mesh name
		meshGeometry->setNameID(mesh->mName.data);

		_meshNode->addMeshGeometry(meshGeometry);
	}
}

void AssimpLoader::translateMatrix(const aiMatrix4x4 &_input, matrix4 &_output)
{
	for (unsigned int x = 0; x < 4; ++x)
	{
		for (unsigned int y = 0; y < 4; ++y)
		{
			_output.m4[x][y] = _input[x][y];
		}
	}
}

ZombieApostate fucked around with this message at 11:08 on Jul 31, 2011

Hughlander
May 11, 2005

I went to post this in the Unity thread, only to realize that I couldn't find it and maybe I just imagined it. So if there is a dedicated Unity thread can someone point me to it and I'll move this there?

Anyway, I just came across this... Hack n Slash RPG in Unity Tutorial It's a two hundred forty-three episode long video tutorial on how to make an rpg in unity from the ground up. Pretty drat amazing.

Physical
Sep 26, 2007

by T. Finninho

ZombieApostate posted:

I'm guessing you're doing this:

  1. turn depth buffer off
  2. draw skybox
  3. draw clouds
  4. turn depth buffer back on
  5. draw ground + whatever else

If that's the case, as a quick test, you could move turning the depth buffer back on up a step (to between drawing skybox and drawing clouds) and the clouds should show up on top of the ground when they're supposed to, although they won't blend correctly. Like Vino said, you really want to move all your transparent/translucent drawing (like drawing the clouds) down after you draw all your solid objects (like the ground) so it will blend correctly.

If that's not it, you're probably missing something in turning the depth buffer on. I haven't used XNA much (I assume that's what your using...), so I'm not sure if it involves more than that. In OpenGL, if I remember correctly, you also have to request a depth buffer when making the window before you enable it, so there might be something like that in XNA.

Edit: Could also have something to do with what your RenderState.DepthBufferFunction is set to, as well. Should be set to Less or LessEqual I think. Never used that when I mucked with XNA.

tl;dr: Could be 1) your draw order is wrong, 2) don't really have depth buffer on or 3) your depth buffer function is set wrong.

I did some reading about the DepthBuffer. See, I know what it is from all the OpenGL and DirectX stuff that I have read but haven't used it so there were some loose ends that I would discover. the whole concept of the compare function confused me for a moment because its a comparison, but I was wondering "compared to what?" I thought that there would be a variable to set, but it actually comes from the depth buffer texture I pass in, which gets generated in the same way from a previous step. So I actually have no depth buffer going on at all in this program, I thought that I did (I am using a library someone else made so I don't know everything about it.) I read up on this last night and slept on it. It's amazing how helpful it is to understanding an idea to sleep on it. It's like magic. I have no idea of what is going to come out the next day except that I will probably have a much better understanding.

But actually, shouldn't I draw the clouds last since they are transparent?

roomforthetuna
Mar 22, 2005

I don't need to know anything about virii! My CUSTOM PROGRAM keeps me protected! It's not like they'll try to come in through the Internet or something!

Physical posted:

But actually, shouldn't I draw the clouds last since they are transparent?
Yes, unless you have something else that's transparent too in which case you need to draw all those things last, ordered from 'far' to 'near'.

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

roomforthetuna posted:

Yes, unless you have something else that's transparent too in which case you need to draw all those things last, ordered from 'far' to 'near'.

Basically what this guy is saying. I only mentioned moving the depth buffer toggle because that's probably easier than changing the order you're drawing stuff in in the short term, just to make sure it works before you make the real fix.

Also, you sound like you figured it out, but the compare function is testing the depth of the new pixel vs what's in the depth buffer already and only drawing if it passes the test.

Physical
Sep 26, 2007

by T. Finninho

ZombieApostate posted:

Also, you sound like you figured it out, but the compare function is testing the depth of the new pixel vs what's in the depth buffer already and only drawing if it passes the test.

Yea. I now "get" how to do it and understand the comparison functions. Basically, I understand the whole system for the depth stencil in XNA short of actually making one of my own. It is comparing the current render against the previous which a user can save and pull up later. It can almost be used as a mask.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?
I don't suppose anyone in here has worked with (C/C++) raytracing libraries in the past?

I find myself in the market for a library that I can integrate with an existing game, to generate per-vertex baked lighting within an arbitrary polygonal scene containing an arbitrary collection of lights. I could write a few algorithms that effectively just bake the results of real-time lighting out to the vertices, but... I mean this really feels like a problem better solved by an actual raytracer. And writing yet another raytracer seems a bit silly.

Specifically, I'm hoping for such a library that's also designed for real-time raytracing, with quality controls that might make it usable for instant previews during level editing.


Does such a beast exist? Whether (permissive) open-source or license-able?

Bob Morales
Aug 18, 2006


Just wear the fucking mask, Bob

I don't care how many people I probably infected with COVID-19 while refusing to wear a mask, my comfort is far more important than the health and safety of everyone around me!

Shalinor posted:

I don't suppose anyone in here has worked with (C/C++) raytracing libraries in the past?

I find myself in the market for a library that I can integrate with an existing game, to generate per-vertex baked lighting within an arbitrary polygonal scene containing an arbitrary collection of lights. I could write a few algorithms that effectively just bake the results of real-time lighting out to the vertices, but... I mean this really feels like a problem better solved by an actual raytracer. And writing yet another raytracer seems a bit silly.

Specifically, I'm hoping for such a library that's also designed for real-time raytracing, with quality controls that might make it usable for instant previews during level editing.


Does such a beast exist? Whether (permissive) open-source or license-able?

Raytracing had a revival when multi-core chips started coming out, that might help your searches.

Hubis
May 18, 2003

Boy, I wish we had one of those doomsday machines...

Shalinor posted:

I don't suppose anyone in here has worked with (C/C++) raytracing libraries in the past?

I find myself in the market for a library that I can integrate with an existing game, to generate per-vertex baked lighting within an arbitrary polygonal scene containing an arbitrary collection of lights. I could write a few algorithms that effectively just bake the results of real-time lighting out to the vertices, but... I mean this really feels like a problem better solved by an actual raytracer. And writing yet another raytracer seems a bit silly.

Specifically, I'm hoping for such a library that's also designed for real-time raytracing, with quality controls that might make it usable for instant previews during level editing.


Does such a beast exist? Whether (permissive) open-source or license-able?

The hardware requirement is probably a deal-breaker for you, but there's always Optix...

e: Or at the least, you can maybe search for OptiX comparisons to CPU libraries and check out those

The Fool
Oct 16, 2003


I'm working on a small c#/xna project, which is also the first major programming project i've worked on in 8 years.

That said, I haven't had any major problems, but do have a question. Right now I have 4 "management" classes that handle different things in the game.(game states, art assets, etc) These classes need to be accessable by nearly everything else in the game. Is there a better way to accomplish this other than passing around references to the manager classes in drat near every constructor i'm writing.

PDP-1
Oct 12, 2004

It's a beautiful day in the neighborhood.
Look into XNA's Game.Services system. It lets you register objects and then retrieve references to them later on. You do still need to pass around a reference to the main Game object but there's not much getting around that. With that system you can register all your managers as services, and then grab them on an as-needed basis later.

To add a Service:
Game.Services.AddService(typeof(SomeObject), SomeObject);

To get a Service back later on:
someObject = (SomeObject)Game.Services.GetService(typeof(SomeObject));

e: Why are you managing your own art assets? XNA's Game.Content<Type> system can do that for you.


:siren: Side note, the SA GameDev Challenge has ended and there are about 40 goon-made games up for review. Some are great, some are terrible, some are so terrible that they are kind of great. Check it out.

PDP-1 fucked around with this message at 04:06 on Aug 4, 2011

Vino
Aug 11, 2010

Shalinor posted:

I don't suppose anyone in here has worked with (C/C++) raytracing libraries in the past?

I wrote one I can send you, but it relies on a particular mesh format. It's realtime-fast (if you don't do too many per frame) and you can control the quality by controlling the depth of the kd tree that it builds. You could convert it or use it as a basis for your own code if you want. Email me if interested -> bs.vino@gmail.com

edit: No matter what raytracer you use it'll be too slow to do more than a few per frame if you have more than a trivial number of tris. If you want to do realtime lighting you should probably be looking at opengl methods or pre-baking your lighting.

Vino fucked around with this message at 08:43 on Aug 4, 2011

The1ManMoshPit
Apr 17, 2005

Shalinor posted:

I don't suppose anyone in here has worked with (C/C++) raytracing libraries in the past?

I find myself in the market for a library that I can integrate with an existing game, to generate per-vertex baked lighting within an arbitrary polygonal scene containing an arbitrary collection of lights. I could write a few algorithms that effectively just bake the results of real-time lighting out to the vertices, but... I mean this really feels like a problem better solved by an actual raytracer. And writing yet another raytracer seems a bit silly.

Specifically, I'm hoping for such a library that's also designed for real-time raytracing, with quality controls that might make it usable for instant previews during level editing.

Does such a beast exist? Whether (permissive) open-source or license-able?

Well, there is Beast :v:

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

The1ManMoshPit posted:

Well, there is Beast :v:
This is indeed very pretty, thanks - and appears to expose an API.

I kept trying to find a way to get Turtle in library form, but no joy... this, at least might be an option.

Vino posted:

edit: No matter what raytracer you use it'll be too slow to do more than a few per frame if you have more than a trivial number of tris. If you want to do realtime lighting you should probably be looking at opengl methods or pre-baking your lighting.
I'll be running it on a background thread and double-buffering the results. If I can get even 1fps out of it, that'll be fast enough for near-instant feedback within the editor. (EDIT: especially if I pull tricks like only updating the verts of specific objects / only enabling specific lights / etc)

We will eventually add proper real-time lighting for true instant feedback, but the goal in the interim is to get as usable a lighting framework as possible.

Shalinor fucked around with this message at 14:55 on Aug 4, 2011

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Shalinor posted:

I'll be running it on a background thread and double-buffering the results. If I can get even 1fps out of it, that'll be fast enough for near-instant feedback within the editor. (EDIT: especially if I pull tricks like only updating the verts of specific objects / only enabling specific lights / etc)
Is this something you only need to run in the editor, or does it need to run in real time in-game?

And do you need GI, or just direct?

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

OneEightHundred posted:

Is this something you only need to run in the editor, or does it need to run in real time in-game?

And do you need GI, or just direct?
It only runs in the editor, and the results are baked out as part of the level save process.

Yep, it needs GI. Rather, it needs direct + AO bare minimum, which I could fake, but GI would look better than that, which is kind of why I'm thinking of just going raytracer period.

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

Shalinor posted:

It only runs in the editor, and the results are baked out as part of the level save process.

Yep, it needs GI. Rather, it needs direct + AO bare minimum, which I could fake, but GI would look better than that, which is kind of why I'm thinking of just going raytracer period.
Well, lighting middleware kind of sucks in that one of the main advantages is integration with existing engines, getting it to work with yours would probably involve a huge pile of effort dealing with porting the geometry formats. Also you need to be REALLY careful about what formats they support, like if it doesn't support HDR or directional sampling then it's pretty much a waste of money these days.

Personally, I would say to look in to light propagation volumes for preview. It's a pretty straight-forward technique and has very low setup and generation times. It has some quality caveats, but if you're leaving "perfect" for the bake stage then I doubt you care.


Baking is another story, photon mapping is kind of the hot poo poo right now, but going pure dome capture is really fast for the effort investment: The GI compiler for the project I'm working on processes a couple hundred samples per second and the source for the GI app itself (since it plugs in to the existing renderer and depends on the sampling information is determined by the geometry compiler) is only a few hundred lines. The results have been pretty consistently good.

Direct casts are actually harder than GI, I think. You pretty much have four options there: Shadowmaps sampling (has precision issues), beamtrees (memory hog, scales horribly with geometric complexity), tracing (slow as gently caress), or scanline casting (fast, but would be a lot faster with GPU offloading and I haven't figured the math for that out yet).


edit: There's some irony here in that I was almost the tools programmer for your company, but I botched the interview mostly due to bad luck on how the questions were asked. :downs:

OneEightHundred fucked around with this message at 00:52 on Aug 5, 2011

EagleEye
Jun 4, 2011
Edit: This was an accidental post. My apologies.

EagleEye fucked around with this message at 23:44 on Aug 5, 2011

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!
Any 3 points of any polygon define a plane as long as they're in the original order and it isn't a degenerate.

That said, I don't know if you can convert them properly because Quake-based games (including HL2) want sealed additive maps and Unreal uses unsealed additive or sealed subtractive.

EagleEye
Jun 4, 2011
Thanks. I'm pretty sure it's possible, though I won't know until I finish up this parser.

Shalinor
Jun 10, 2002

Can I buy you a rootbeer?

OneEightHundred posted:

:words:
All good info. The big bitch is time to do it ourselves (to a high enough quality level) vs time to integrate middleware. I figure I'll at least wait for Beast to get back to us with a trial, and then we'll see what we're up against.

Shalinor fucked around with this message at 01:08 on Aug 5, 2011

Vinterstum
Jul 30, 2003

Shalinor posted:

All good info. The big bitch is time to do it ourselves (to a high enough quality level) vs time to integrate middleware. I figure I'll at least wait for Beast to get back to us with a trial, and then we'll see what we're up against.

There's also http://www.rusteddreams.net/faogen.html as well.

EagleEye
Jun 4, 2011
It's 4:22 AM and I have no clue how to fix this.

I've found that while there is a lot of additive geometry, there is also subtractive geometry. With clever use of Hammer's built in subtractive mode (Carve), this can still work, though sadly not automatically. The main problem I'm facing right now, though, is figuring out exactly how I'm supposed to be converting these Polygons to Brushes.

I can't get this:

code:
Begin Brush Name=Model2
   Begin PolyList
      Begin Polygon Item=OUTSIDE Texture=Heli_LiftMetl_A Flags=8388608 Link=0
         Origin   +00032.000000,+00004.000000,-00064.000000
         Normal   +00001.000000,+00000.000000,+00000.000000
         TextureU +00000.000000,-00001.000000,+00000.000000
         TextureV +00000.000000,+00000.000000,-00001.000000
         Vertex   +00032.000000,-00004.000000,-00064.000000
         Vertex   +00032.000000,+00004.000000,-00064.000000
         Vertex   +00032.000000,+00004.000000,+00040.000000
         Vertex   +00032.000000,-00004.000000,+00040.000000
      End Polygon
      Begin Polygon Item=OUTSIDE Texture=Heli_LiftMetl_A Flags=8388608 Link=1
         Origin   -00048.000000,-00004.000000,-00064.000000
         Normal   -00001.000000,+00000.000000,+00000.000000
         TextureU +00000.000000,+00001.000000,+00000.000000
         TextureV +00000.000000,+00000.000000,-00001.000000
         Vertex   -00048.000000,+00004.000000,-00064.000000
         Vertex   -00048.000000,-00004.000000,-00064.000000
         Vertex   -00048.000000,-00004.000000,+00040.000000
         Vertex   -00048.000000,+00004.000000,+00040.000000
      End Polygon
      Begin Polygon Item=OUTSIDE Texture=Heli_LiftMetl_A Flags=8388608 Link=2
         Origin   -00048.000000,-00004.000000,+00040.000000
         Normal   +00000.000000,+00000.000000,+00001.000000
         TextureU +00000.000000,+00001.000000,+00000.000000
         TextureV -00001.000000,+00000.000000,+00000.000000
         Vertex   +00032.000000,-00004.000000,+00040.000000
         Vertex   +00032.000000,+00004.000000,+00040.000000
         Vertex   -00048.000000,+00004.000000,+00040.000000
         Vertex   -00048.000000,-00004.000000,+00040.000000
      End Polygon
      Begin Polygon Item=OUTSIDE Texture=un_bad_doorX Flags=8388608 Link=3
         Origin   -00048.000000,+00004.000000,-00656.000000
         Normal   +00000.000000,+00001.000000,+00000.000000
         Pan      U=4 V=-54
         TextureU -00003.333333,+00000.000000,+00000.000000
         TextureV +00000.000000,+00000.000000,-00002.500000
         Vertex   +00032.000000,+00004.000000,+00040.000000
         Vertex   +00032.000000,+00004.000000,-00064.000000
         Vertex   -00048.000000,+00004.000000,-00064.000000
         Vertex   -00048.000000,+00004.000000,+00040.000000
      End Polygon
      Begin Polygon Item=OUTSIDE Texture=Heli_LiftMetl_A Flags=8388608 Link=4
         Origin   -00048.000000,+00004.000000,-00064.000000
         Normal   +00000.000000,+00000.000000,-00001.000000
         TextureU +00000.000000,-00001.000000,+00000.000000
         TextureV -00001.000000,+00000.000000,+00000.000000
         Vertex   +00032.000000,+00004.000000,-00064.000000
         Vertex   +00032.000000,-00004.000000,-00064.000000
         Vertex   -00048.000000,-00004.000000,-00064.000000
         Vertex   -00048.000000,+00004.000000,-00064.000000
      End Polygon
      Begin Polygon Item=OUTSIDE Texture=un_bad_doorX Flags=8388608 Link=5
         Origin   +00032.000000,-00004.000000,-00656.000000
         Normal   +00000.000000,-00001.000000,+00000.000000
         Pan      U=4 V=-54
         TextureU +00003.333333,+00000.000000,+00000.000000
         TextureV +00000.000000,+00000.000000,-00002.500000
         Vertex   +00032.000000,-00004.000000,-00064.000000
         Vertex   +00032.000000,-00004.000000,+00040.000000
         Vertex   -00048.000000,-00004.000000,+00040.000000
         Vertex   -00048.000000,-00004.000000,-00064.000000
      End Polygon
   End PolyList
End Brush
...to something in this format:

code:
{
( -16 -111 1 ) ( 16 -111 1 ) ( 16 111 1 ) 1_24INCHFLOFIX [ 0 0 0 -16 ] [ 0 0 0 -111 ] 0 1 1
( -16 111 -1 ) ( 16 111 -1 ) ( 16 -111 -1 ) 1_24INCHFLOFIX [ 1 0 0 -16 ] [ 0 -1 0 111 ] 0 1 1
( -16 111 -1 ) ( -16 111 1 ) ( 16 111 1 ) 1_24INCHFLOFIX [ 0 0 1 -16 ] [ 1 0 0 111 ] 0 1 1
( 16 -111 -1 ) ( 16 -111 1 ) ( -16 -111 1 ) 1_24INCHFLOFIX [ 0 0 1 16 ] [ -1 0 0 -111 ] 0 1 1
( 16 111 -1 ) ( 16 111 1 ) ( 16 -111 1 ) 1_24INCHFLOFIX [ 0 0 1 16 ] [ 0 -1 0 111 ] 0 1 1
( -16 -111 -1 ) ( -16 -111 1 ) ( -16 111 1 ) 1_24INCHFLOFIX [ 0 0 1 -16 ] [ 0 1 0 -111 ] 0 1 1
}
Here's the apparently faulty code (WriteBrushes simply checks to see if we're exporting brushes, and, if so, calls Console.WriteLine()):
code:
WriteBrushes("( " + p.polygons[0][0] + " " + p.polygons[0][1] + " " + p.polygons[0][2] + " ) ( " + p.polygons[1][0] + " " + p.polygons[1][1] + " " + p.polygons[1][2] + " ) ( " + p.polygons[2][0] + " " + p.polygons[2][1] + " " + p.polygons[2][2] + " ) "+p.texture+" [ " + p.polygons[0][3] + " " + p.polygons[0][4] + " " + p.polygons[0][5] + " " + p.polygons[0][6] + " ] [ " + p.polygons[0][7] + " " + p.polygons[0][8] + " " + p.polygons[0][9] + " " + p.polygons[0][10] + " ] 0 1 1");
It relies on data set with this line:
code:
temp_polylist.polygons.Add(new int[] { a, b, c, texu1, texu2, texu3, texpx, texv1, texv2, texv3, texpy });
//a is vertex 1
//b is vertex 2
//c is vertex 3
//texu1,2,3 is TextureU's vertex 1,2,3
//texpx is Pan's vertex 1
//texv1,2,3 is TextureV's vertex 1,2,3
//texpy is Pan's vertex 2
I've seriously got to get to sleep. Here's a zip with all the code. I've actually gotten the entity exporting to work. I haven't bothered to add unrecognized keys to a C# dictionary yet, but there's no .fgd right now, so I'm not going to get to ahead of myself.

I'd like to personally thank everyone here for helping me so far. Sorry if this doesn't make much sense; I'm a bit tired at the moment.

xopods
Oct 26, 2010

The Fool posted:

I'm working on a small c#/xna project, which is also the first major programming project i've worked on in 8 years.

That said, I haven't had any major problems, but do have a question. Right now I have 4 "management" classes that handle different things in the game.(game states, art assets, etc) These classes need to be accessable by nearly everything else in the game. Is there a better way to accomplish this other than passing around references to the manager classes in drat near every constructor i'm writing.

Disclaimer: I know very little about C# (or programming in general), so this may not work for you, but in Cocoa or ActionScript, this is what I do:

Since presumably you only ever have one instance of each of your management classes, what you can do is have a static variable on each class that holds the reference to its instance. I.e. your SpriteManager class has a variable akin to:

code:
public static SpriteManager manager;
and then its constructor has:

code:
manager = this;
(first deallocating the previous manager, if needed) and then other classes can access the current instance by way of:

code:
SpriteManager.manager.someFunction();
without holding a reference to it themselves.

---

Although I came up with this solution on my own, when reading Cocoa documentation, I realized that I'd basically reinvented the Singleton design pattern.

As a refinement, rather than instantiating your manager beforehand and having a public static variable, you can make the variable private and access it via a getter method along these lines:

code:
public static function getManager():SpriteManager { 
   if (manager == null) { manager = new SpriteManager(); }
   return manager;
}

xopods fucked around with this message at 14:31 on Aug 5, 2011

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

EagleEye posted:

It's 4:22 AM and I have no clue how to fix this.
Each polygon is one brush side. Dump the polys as:

( v[0][0] v[0][1] v[0][2] ) ( v[1][0] v[1][1] v[1][2] ) ( v[2][0] v[2][1] v[2][2] ) [ texu[0] texu[1] texu[2] pan.u ] [ texv[0] texv[1] texv[2] pan.v ]

OneEightHundred fucked around with this message at 15:29 on Aug 5, 2011

Vino
Aug 11, 2010

Vinterstum posted:

There's also http://www.rusteddreams.net/faogen.html as well.

Forget that. http://getsmak.net/ is much better :smug:

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

quote:

I kept trying to find a way to get Turtle in library form, but no joy... this, at least might be an option.
Turns out you can get exactly what you want after all: Beast IS Turtle, Autodesk bought Illuminate Labs and renamed their product.


In other news, someone apparently made what looks like a low-cost set of rendering shaders to bake radiosity normal maps with Blender or modo, but their site is all kinds of hosed up so who knows what it'll take to get them.

OneEightHundred fucked around with this message at 19:44 on Aug 5, 2011

EagleEye
Jun 4, 2011
@108 I already had it that way, though I realized that Hammer-generated .maps always go in the order of:

{
Top
Bottom
Left
Right
Up
Down
}

So I tried it, and it still gave me lots-a spaghetti, and I made one of the malformed brushes into a func_wall for observation purposes. I saved the file, then saw an "unreal_dx.max" file. I briefly wondered what it could be, then realized that it was the same type of deal as .vmx files, just a backup with a different extension. So I looked in the saved .map file, expecting to see a lot of brushes missing. Instead, I saw a lot of planes missing. It said 600-something brushes could not be loaded, then discarded unloadable faces.

So I've been on a wild goose chase for the last couple of hours.

In a nutshell, I take in this data:
code:
    Begin Brush Name=Model75
       Begin PolyList
          Begin Polygon Item=OUTSIDE Link=0
             Origin   -00128.000000,-00128.000000,+00128.000000
             Normal   +00000.000000,+00000.000000,+00001.000000
             TextureU +00000.000000,+00001.000000,+00000.000000
             TextureV -00001.000000,+00000.000000,+00000.000000
             Vertex   -00128.000000,-00128.000000,+00128.000000
             Vertex   +00128.000000,-00128.000000,+00128.000000
             Vertex   +00128.000000,+00128.000000,+00128.000000
             Vertex   -00128.000000,+00128.000000,+00128.000000
          End Polygon
          Begin Polygon Item=OUTSIDE Link=1
             Origin   -00128.000000,+00128.000000,-00128.000000
             Normal   +00000.000000,+00000.000000,-00001.000000
             TextureU +00000.000000,-00001.000000,+00000.000000
             TextureV -00001.000000,+00000.000000,+00000.000000
             Vertex   -00128.000000,+00128.000000,-00128.000000
             Vertex   +00128.000000,+00128.000000,-00128.000000
             Vertex   +00128.000000,-00128.000000,-00128.000000
             Vertex   -00128.000000,-00128.000000,-00128.000000
          End Polygon
          Begin Polygon Item=OUTSIDE Link=2
             Origin   -00128.000000,+00128.000000,-00128.000000
             Normal   +00000.000000,+00001.000000,+00000.000000
             TextureU +00001.000000,+00000.000000,+00000.000000
             TextureV +00000.000000,+00000.000000,-00001.000000
             Vertex   -00128.000000,+00128.000000,-00128.000000
             Vertex   -00128.000000,+00128.000000,+00128.000000
             Vertex   +00128.000000,+00128.000000,+00128.000000
             Vertex   +00128.000000,+00128.000000,-00128.000000
          End Polygon
          Begin Polygon Item=OUTSIDE Link=3
             Origin   +00128.000000,-00128.000000,-00128.000000
             Normal   +00000.000000,-00001.000000,+00000.000000
             TextureU -00001.000000,+00000.000000,+00000.000000
             TextureV +00000.000000,+00000.000000,-00001.000000
             Vertex   +00128.000000,-00128.000000,-00128.000000
             Vertex   +00128.000000,-00128.000000,+00128.000000
             Vertex   -00128.000000,-00128.000000,+00128.000000
             Vertex   -00128.000000,-00128.000000,-00128.000000
          End Polygon
          Begin Polygon Item=OUTSIDE Link=4
             Origin   +00128.000000,+00128.000000,-00128.000000
             Normal   +00001.000000,+00000.000000,+00000.000000
             TextureU +00000.000000,-00001.000000,+00000.000000
             TextureV +00000.000000,+00000.000000,-00001.000000
             Vertex   +00128.000000,+00128.000000,-00128.000000
             Vertex   +00128.000000,+00128.000000,+00128.000000
             Vertex   +00128.000000,-00128.000000,+00128.000000
             Vertex   +00128.000000,-00128.000000,-00128.000000
          End Polygon
          Begin Polygon Item=OUTSIDE Link=5
             Origin   -00128.000000,-00128.000000,-00128.000000
             Normal   -00001.000000,+00000.000000,+00000.000000
             TextureU +00000.000000,+00001.000000,+00000.000000
             TextureV +00000.000000,+00000.000000,-00001.000000
             Vertex   -00128.000000,-00128.000000,-00128.000000
             Vertex   -00128.000000,-00128.000000,+00128.000000
             Vertex   -00128.000000,+00128.000000,+00128.000000
             Vertex   -00128.000000,+00128.000000,-00128.000000
          End Polygon
       End PolyList
    End Brush
I reorder it slightly to this data:
code:
{
( -128 -128 128 ) ( 128 -128 128 ) ( 128 128 128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( -128 128 -128 ) ( 128 128 -128 ) ( 128 -128 -128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1
( -128 -128 -128 ) ( -128 -128 128 ) ( -128 128 128 ) 1_24INCHFLOFIX [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 128 128 -128 ) ( 128 128 128 ) ( 128 -128 128 ) 1_24INCHFLOFIX [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1
( 128 -128 -128 ) ( 128 -128 128 ) ( -128 -128 128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
( -128 128 -128 ) ( -128 128 128 ) ( 128 128 128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1
}
But Hammer wants this data:
code:
{
( -128 128 128 ) ( 128 128 128 ) ( 128 -128 128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1 
( -128 -128 -128 ) ( 128 -128 -128 ) ( 128 128 -128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 -1 0 0 ] 0 1 1 
( -128 128 128 ) ( -128 -128 128 ) ( -128 -128 -128 ) 1_24INCHFLOFIX [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1 
( 128 128 -128 ) ( 128 -128 -128 ) ( 128 -128 128 ) 1_24INCHFLOFIX [ 0 1 0 0 ] [ 0 0 -1 0 ] 0 1 1 
( 128 128 128 ) ( -128 128 128 ) ( -128 128 -128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1 
( 128 -128 -128 ) ( -128 -128 -128 ) ( -128 -128 128 ) 1_24INCHFLOFIX [ 1 0 0 0 ] [ 0 0 -1 0 ] 0 1 1 
}
Looking at this, I know I've hosed something up, but I haven't a clue what. The polygons aren't in reverse order or something; they don't match up at all. Maybe I need to use the last 3 vertexes instead of the first 3? I don't know. I need a retard check and a break.

Again, I'd like to thank you guys for being patient with me. I would not have gotten as far as I have without you all.

Vinterstum
Jul 30, 2003

Vino posted:

Forget that. http://getsmak.net/ is much better :smug:

Might wanna put a "Full disclosure:" bit at the end there :).

OneEightHundred
Feb 28, 2008

Soon, we will be unstoppable!

EagleEye posted:

Looking at this, I know I've hosed something up, but I haven't a clue what. The polygons aren't in reverse order or something; they don't match up at all.
It looks like they use a different handedness. Like if you graph the X/Y coordinates of the first line of each, you'll notice that the first one has a counter-clockwise vertex order and the second has a clockwise vertex order.

Try exporting the vertexes in reverse order.

OneEightHundred fucked around with this message at 02:22 on Aug 6, 2011

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

ZombieApostate posted:

:words:

Figured out what was wrong. Forgot to initialize my root meshNode's matrix. :shivdurf:

I must thank OneEightHundred for suggesting Assimp to somebody else, earlier in the thread, since I had never heard of it before and ColladaDOM was a nightmare to work with. This is so much easier.

Vino
Aug 11, 2010

Vinterstum posted:

Might wanna put a "Full disclosure:" bit at the end there :).

That's what the :smug: was for. :smug:

Physical
Sep 26, 2007

by T. Finninho

ZombieApostate posted:

Figured out what was wrong. Forgot to initialize my root meshNode's matrix. :shivdurf:

I must thank OneEightHundred for suggesting Assimp to somebody else, earlier in the thread, since I had never heard of it before and ColladaDOM was a nightmare to work with. This is so much easier.

Are you using Hammer Editor to make maps? This is a subject that I want to explore more, 3D game level editors and using their file format in my 3D games.

ZombieApostate
Mar 13, 2011
Sorry, I didn't read your post.

I'm too busy replying to what I wish you said

:allears:

Physical posted:

Are you using Hammer Editor to make maps? This is a subject that I want to explore more, 3D game level editors and using their file format in my 3D games.

I haven't gotten that far, yet, but I was planning on using 3ds Max to start with and building my own simple tool when everything else is largely done. I don't see why you couldn't do like EagleEye is doing and import maps from Hammer into your project, though.

Physical
Sep 26, 2007

by T. Finninho
Well what are you using? I haven't gone back and read your posts yet.

edit: Read your posts EagleEye (except the one you deleted) and it seems you only mentioned hammer once. While this may or may not be what you are talking about, has anyone had any experience reading some level editors file format? I use to use the editor for HL1 and have used Hammer a little so I'd like to hear about people reading those file formats into their games, otherwise I could always make my own.

Physical fucked around with this message at 00:55 on Aug 7, 2011

Adbot
ADBOT LOVES YOU

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Something for the game engine types: How do you pass information back and forth across game objects? In all the stuff I gobbled up on component-based design lately, I saw there isn't really a consensus there. It's kind of interesting really to see what some people come up with. I've seen three things pretty often so far:

1. Subsystems and things that care about particular objects poll over them each frame and update game state. This appears initially repulsive to me but I imagine it works fine for smaller games, and since it's so simple I imagine it works fine for rapidly making little games.
2. Using event callbacks in some kind of way. I've naturally stumbled into this kind of came in my own thing. It means having to register to receive callbacks for anything that can send them. It's similar enough to GUI stuff that I'm used to it.
3. Some kind of message bus where message packets are transmitted and received by those that might care. I have the least detail on this and I'm the most interested in understanding it for general software design's sake; it might be something I might use in non-game stuff.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply