Jump to content

  • Log In with Google      Sign In   
  • Create Account

ThePointingMan

Member Since 09 Nov 2010
Offline Last Active Jan 10 2016 02:40 AM

Topics I've Started

Inversion of control across libraries

06 November 2015 - 12:02 AM

Alright so lets say I've got a little library for graphics called... "GraphicsLib", a Physics library called "PhysicsLib", and another to hold them together... the "EngineLib." How can I go about making sure that EngineLib is not entirely dependant on GraphicsLib and PhysicsLib? I've read about Inversion of control/dependency injection and it sounds like it's the right thing for this, but it's left me a little bit puzzled.

 

What I've read about dependency injection is that you would create an interface and then inject the actual object you want it to be into the object using it. So in this example lets there would be an interface for the graphics and physics and then the Engine class would have a setter for each of those interfaces.

 

Now that's pretty straight forward but what happens when the graphics system isn't part of the same library? the interface needs to exist in both sections, the engine needs to know of the interfaces existence so it can call all of its functions yes? but then the graphics and physics libs need to know of their respective interfaces as well so they can inherit from them. Is Dependency injection really not the tool for the job here or am I just thinking about things all wrong?

 

I've also thought of an alternative where there is another library that both the "Engine" and the "Physics/Rendering" libs use that contains interfaces for everything the engine might use but... that seems like it could be a bit of a stretch to force this to work.


Communication between objects and systems in Game engines.

19 May 2015 - 03:28 AM

Heya! I've been doing some work on a little engine for myself, and I've stumbled upon a little thing that I'm not entirely sure how I should approach. I'm not sure how I should handle instances where an object needs to communicate with one of the modules of the engine. A specific example of this would be for a raycast. If I have a player who needs to care about whether or not their on the ground for example, when I update the player I'm going to want them to shoot a raycast down to see if there is in fact something beneath them. This would mean that the object needs to know about the physics systems existence, a dependency that I'd rather avoid! Searching through some older topics I've seen a suggestion that the objects store a pointer to the scene, and then the scene contain things like the collision system etc, an idea that scares me for similar reasons. Am I just being too paranoid about this? Functionally it would work to have these dependencies, should their existence bother me or would anyone be able to explain to me some better designs on avoiding these kinds of dependencies?


Is hatred for unity justified?

21 March 2014 - 03:09 PM

I'm currently going to school for programming, and my 3d graphics teacher absolutely hates unity. He complains about how he can always tell when a game was made with unity because the load times will be huge for small things and he will think to himself, "That shouldn't have taken that long." Another complaint of his is that it does everything for you and thus leads to incredibly generic games. I rather like unity, as it allows me to wip up a game fairly quickly without having to worry about first making a framework, but I must admit hearing his hate for it does spark a bit of fear in me, in the long run if my productions do get bigger, despite unity's ease of use, will it harm my product in the end, or is that entirely dependent on the user? If my fundamentals of coding are strong enough does it's easy workflow still come with a price or is it just as efficient as any other engine or is my teachers hate for unity justified?


Smoothing out the ray tracing of a surface on a curve

13 October 2013 - 04:51 AM

I've been using unity for some school projects recently, and I made a  racing game fairly similar to F-zero GX. It was really unpolished though, and I've got a question about one thing that I thought really needed polish. While the hover car goes along the track, it shoots a ray directly below it and orientates itself so that the car's up is the same as the surface's normal. Gravity is always pulling in the hover cars down direction. The biggest problem I am having with doing this is that with upward curves. Lets say I was doing a loop de loop. The car would move forward by an amount, then orientate itself and move forward again. If you are going fast enough though, you end up moving so far forward that you tap the surface of the loop de loops curve with your ship, making you loose all momentum. Does anyone have any ideas as to what I could do to work around this?


Depth Transparecy issues.

18 June 2013 - 09:43 AM

I've been working on a Direct3D game run for a while now and I've come across an issue with alpha blending that I don't quite know how to solve. 

I've set my render states like this

// both sides of the triangles
    d3ddev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE);    
	//Set render states
	d3ddev->SetRenderState(D3DRS_LIGHTING, FALSE);// turn off the 3D lighting
	//make it so things color can fade
	d3ddev->SetRenderState(D3DRS_ALPHABLENDENABLE, TRUE);
	d3ddev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
	d3ddev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
	//-------------------------------------------------------------
    d3ddev->SetRenderState(D3DRS_ZENABLE, TRUE);    // turn on the z-buffer
	d3ddev->SetTextureStageState(0, D3DTSS_ALPHAOP, D3DTOP_MODULATE);

Now at first I thought everything was perfectly fine, things that where transparent in my png file would go on screen transparent, but I later found out that they will only be transparent to things they have been rendered after, so if i render a see through a space ship, and then a red cube and then an asteroid and put the red cube in front of both the space ship and the asteroid, only the space ship will be visible with a red tinge, the asteroid will be completely blocked out. Does anyone know why this is happening and how it can be solved?


PARTNERS