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
shodanjr_gr
Nov 20, 2007

Pfhreak posted:


That seems straightforward enough to me. However, I'm looking into doing some pathfinding for my characters. The easiest (and most coarse) method is just to push them around until they stop moving, and then turn them, and push a different direction. That's what my first prototypes did, and I'm not satisfied. I've read about A* and nodegraphs, and I can see how I might use these to navigate with a flying agent, land based enemies don't seem to make sense. Can anyone point me to resources (or give me some pointers [HA! programming joke!]) on managing 2D navigation?

I have had an AI class in Uni, but havent worked on game-purpose AI (yet), so read the following with a grain of salt.

Why do you have trouble dealing with land based navigation?

Id assume its the same as air navigation, only the network of nodes were the agent can move to is more limited (id suppose you switch that by altering the costs on the edges that link to non-ground nodes and setting it to infinity, thus causing any algorithms you run on your new node network to consider those edges as "impassable" objects).

I would also assume that each edge on your network has an associated action with which a client can traverse said edge (for instance if node A is on the ground and node B is directly above node A (in the air), then the action from A->B would be "jump").

You can use A*, or some other optimal solution finding algorithm to determine the optimal action for your agent at any time (actions judged by their end results).

If you know your intended action (for instance a Goomba in Mario would want to try and get to the square that mario is in) you can run a shortest path algorithm to determine the optimal path from the agent's current node to the target node. Then have your agent follow that path by traversing the edges the shortest path algorithm returns.

Adbot
ADBOT LOVES YOU

shodanjr_gr
Nov 20, 2007

IcePotato posted:

This might be a really simple question, but I'm having a giant brainfart.
Using XNA: My levels have a time limit. I'd like to display remaining time left on-screen, but only in seconds. I initialize my 'timer' variable to the map's timeLimit variable, but
code:
timer -= gameTime.ElapsedRealTime.Seconds;
doesn't work, because that's the elapsed time between steps.
code:
timer -= gameTime.TotalRealTime.Seconds;
similarly doesn't work because it subtracts the entire amount of time elapsed, so it starts off going down fast and the rate at which it decreases is constantly increasing.
What's the logic I need here?


Timer = TimeLimit
StartingTime = gameTime.TotalRealTime.seconds;

then in the idle function do

Timer = Timer - (gameTime.TotalRealTime.Seconds - StartingTime);

If i figure it out correctly gameTime is the time since the start of the game (that's how GLUT counts time if i recall correctly). So you need the time at which the level starts rolling (Starting Time) and you subtract that from the current time value when you want to update the timer, giving you the elapsed time in seconds.

Not 100% sure though, cause i havent done any XNA development.

shodanjr_gr
Nov 20, 2007

DBFT posted:

I have some knowledge of C so I guess I'll use C and try to fill in the blanks in my knowledge as I go. Does anyone have any recommendations for tutorials/books for beginning with SDL+OpenGL?


I havent worked with SDL, but as far as OGL goes, you cant go wrong with The Red Book. That, plus the tutorials by NeHe on Gamedev should set you well on your way.

shodanjr_gr
Nov 20, 2007
I am writting a small deferred renderer using GLSL.

I want to be able to use the depth buffer values to extrapolate the eye-space coordinates of each texel of the depth buffer. I intrinsically understand how this is possible, but i cant for the life of me figure out how do it inside a shader.

My thinking was that:

A) i get a vec3(x,y,z) where x,y are the texture coordinates and z is the depth buffer value.

B) i multiply by 2 and subtract 1 to bring the values to [-1,1]

C) then i make a vec4(x,y,z,1.0) and multiply that by the inverse of the projection matrix to bring the clip space coordinates into eye-space.

And yet this does not work, and i am clueless as to why....Any ideas?

shodanjr_gr
Nov 20, 2007
Thanks for the answer, it turns out that i actually (among many other things) wasnt dividing by w when i was trying to use the coordinates, and this was screwing up my results.

code:
float depthValue = texture2D(viewDepth, gl_TexCoord[0]).x;//reading depth value from buffer	
vec3 screenSpaceCoords = vec3(gl_TexCoord[0].x * 2.0 - 1.0, gl_TexCoord[0].y * 2.0 - 1.0, depthValue* 2.0 - 1.0);
//unpacking screenspace coordinates
vec4 eyeSpaceCoords = projectionMatrixInverse * vec4(screenSpaceCoords, 1.0);//unprojecting back to eyespace
vec4 worldSpaceCoords = modelviewMatrixInverse * (eyeSpaceCoords);//transforming from eyespace to worldspace
this is the code i used, it should make sense to most people. projectionMatrixInverse and modelviewMatrixInverse are calculated offline and sent to the shader as uniforms.

Ive had quite a bit of progress today, getting multiple lights to work (with minimal overhead, since the rendering process is deferred :science: ).

What i am now looking into is some guide/paper/words of wisdom, on how to set up my lights in such a way that my final scene does not end up looking WAY too bright once i have done all my lighting passes. Right now i am just tweaking the numbers by hand, and still cant get nice results. Any ideas?

Also, is there a place i can pull some proper gl_material properties off of, instead of ballparking them? (diffuse, ambient, specular, shininess factors for materials like metal/wood/etc)

shodanjr_gr
Nov 20, 2007
Is there a place where i can download ALL the official tutorial material for XNA game development (D3D stuff, HLSL stuff etc)? I am going on a vacation at a barbaric place with no high speed internet, and id like to have all the necessary material with me....


In other news, the OpenGL 3.0 spec is out, and it looks crappy...

shodanjr_gr
Nov 20, 2007
Weren't they planing at some point to switch to a more object oriented approach, instead of this whole freaking "bind identifiers to stuff then switch states using those identifiers" mentallity?

shodanjr_gr
Nov 20, 2007

OneEightHundred posted:

They added that as an extension:
http://www.opengl.org/registry/specs/EXT/direct_state_access.txt
... which is core in OpenGL 3.

I dont see how Direct State Access makes OpenGL more Object Oriented.

Sure, it saves you switching active Texture Units/Matrices etc but you still have to screw around with uint identifiers if you cant be bothered to write wrapper classes/methods for everything...

I hoping for something like:

Texture my_texture;
my_texture.setParameter(GL_TEXTURE.GL_MIN_FILTER, GL_TEXTURE.GL_LINEAR);

I dont know...maybe Java has spoiled me...

shodanjr_gr
Nov 20, 2007

OneEightHundred posted:

A strictly multi-pass renderer is slow, since you're constantly trashing state and you require twice as many draw calls for the vast majority of surfaces. Quake 3 itself tries single-passing as much as it can.

How about a deferred approach?

Use multiple render targets to save all the stuff you need per fragment (normal map value, diffuse value etc), then do a final pass with constant cost in which you combine the data for each fragment. It works pretty well if you dont wanna do transparency...

shodanjr_gr
Nov 20, 2007
code:
void Update(float delta, HWND hWnd)
{
   float displacement = 100 * delta;

   if (KEY_DOWN(VK_RIGHT))
   {
      [b]diceSprite.pos += D3DXVECTOR2(32.0,0);[/b]
   }
}
Mind you that i have no knowledge of D3D programming, but this looks about right...(if you do screenspace translations or something like that, assume that W = your rendering width, then displace by 1/W * 32.0 (which is the equivalent of 32 pixels, assuming your screenspace is mapped to [0,1] in x/y dimensions)).

shodanjr_gr fucked around with this message at 00:27 on Aug 22, 2008

shodanjr_gr
Nov 20, 2007
@Kimani

What if he actually wants the block to move while the button is held down?

(add a frame counter maybe and dont repeat the input until after X frames, so that the block doesnt shoot to the edge of the screen once the key is pressed).


To be honest i think the question was centered around the actual "displacement" of the block, rather than handling the input.

shodanjr_gr
Nov 20, 2007

Gary the Llama posted:

:siren: POSSIBLE IDIOT ALERT AHEAD :siren:

Edit: Okay, this may be a sign that I need sleep or something. I added an innocent for loop to my render method and put my sprite->draw call in it. Innocent enough, right? So I run the program and it runs like normal except now I'm hearing a faint whistling. It's not from my speakers and I have NO SOUND CODE in the game at all. So I remove the code, compile, and run. No whistling sound. Add the code, re-compile, run... Whisting sound. I put my ear closer to the computer and realize it's coming from there.

So... Uhhh, why would code added to my d3ddev->BeginScene cause my computer to whistle? Did I accidentally do something very bad to the video card? Seriously, this is the weirdest crap ever and it actually made my heart race. Without fail, my computer whistled every time I ran that code. Truly a wtf for the ages. Someone please explain what I did.


Whistling sounds can come from "leaking" capacitors inside computers. Try to check if the sound is localized to your graphics card (since it seems to start when you render stuff), then that's the probable cause, in which cause you should get it RMA-ed.

shodanjr_gr
Nov 20, 2007
What's a good place to get some free 3D assets?

I'm looking for a few "ground" (aka gravel/stone/etc) textures with their respective normal maps that tile well.

shodanjr_gr
Nov 20, 2007

MasterSlowPoke posted:

Paper Mario's effects are purely billboarded sprites, as far as I know.

He may mean those background pieces that "look" 2D in 2D mode but actually have "depth" when you look at them in 3D mode. I dont see how those things are any different than normal objects. The only things that change are the camera position and the way clipping/collision detection is handled.

shodanjr_gr
Nov 20, 2007
Can someone give me some practical tips on collision detection for 3D games?

Any links to tutorials, info, etc?

shodanjr_gr
Nov 20, 2007
Thanks for the suggestions guys!

I checked out COLDET and it seems stupidly easy to use. Cheers :)

shodanjr_gr
Nov 20, 2007

Vinterstum posted:

Try dividing your terrain into chunks (N by M tiles) and use some kind of spatial partitioning scheme and/or frustrum culling to draw just what you need.

This.

Alternatively (or complimentary) to the above, you can use bounding boxes + occlusion queries to figure out of a given tile (or group of tiles, along with everything lying on them) needs to be rendered.

You can also toy around with the order of rendering things in order to reduce overdraw.

Actually this issue has come up a couple of times before, both in this thread and in the Graphics Questions Megathread, so you can try looking there as well.

shodanjr_gr
Nov 20, 2007

Unparagoned posted:

What's the best way to implement a multi difficulty AI. Should I just have one AI, and have if statements throughout it, checking if it's hard or easy? I thought about subclassing but if I change something in the hard AI, I'm likely going to have to modify the easy AI as well.

A multi difficulty AI implementation can be as simple as having the same AI code for all difficulties and only altering one parameter. If you have an algorithm that "explores" possible ways to kill the player/win a chess match/form a tic-tac-toe and then picks the optimal one, you can add a random chance for the algorithm to pick a suboptimal way instead. That chance can increase as the difficulty decreases so the AI can end up making wrong or random decisions. Another way to decrease the difficulty is to reduce how many "moves deep" can an AI look at (if we are thinking chess for instance). If it is an action game, and you have an AI opponent targeting the player with a ranged projectile, you can add an offset to the aim of that opponent. The offset can be zero for the hardest difficulty then gradually increase as the difficulty decreases, making the AI less accurate.

shodanjr_gr
Nov 20, 2007
I'm doing some hacky ND-buffer creation on the iPhone. However it seems that at the moment OpenGL ES 2.0 does not support floating point textures, so it is not possible for me to grab the depth buffer from my current render and use it. Thus I have to do multipass rendering and pack the normalized Z-value into a 4 channel texture.

What would be the optimal way to do that, inside a shader?

shodanjr_gr
Nov 20, 2007

brian posted:


With regards to OGRE, I'm not a huge fan, the rendering engine is very well made and incredibly extensible, but the community (or lack thereof) is atrocious and at best it's obtuse and at worst it's a bloated mess. Now I'm sure some people will disagree and I haven't used it in about a year, but when you have options like Unity which probably has the single best development community in existence (especially the IRC channel), the only benefit of using OGRE is to prove you're capable of developing in C++. It abstracts all the graphical API and input usage so you don't really learn anything about that either. Torchlight is great and all, but as I understand it they wrote a huge toolset for their engine that isn't publically available for use in other OGRE projects (nor would it necessarily make sense).


I've been using OGRE for developing a CAVE rendering framework and having access to the underlying source of the whole engine has helped a whole lot, especially when it comes to coding in some low-level rendering features that the engine originally might not support (such as quad-buffered stereo for instance).

Also I don't think it's fair to compare OGRE to Unity. OGRE is a RENDERING engine (as the R suggests) while Unity is a complete game engine with support for networking, input handling, etc. Heck, in the last 2 revisions of OGRE they even got rid of the tight integration with the CEGUI renderer, if I am not mistaken.

shodanjr_gr
Nov 20, 2007

OneEightHundred posted:

I wouldn't have dreamed that Epic would have released a free version of UE, but I'm not actually that shocked by the lack of good low-end C++ options. That much has pretty much been the territory of open source engines, which have been awful starting with Crystal Space (1997) and continuing through today because the developers are all more interested in making stuff that's fun to develop (i.e. renderer features) than useful (i.e. tools, cohesive integration, scripting, networking).

The other sad thing in my opinion about open source C++ rendering engines is that they've sorta reached feature parity with each other and they don't even ship with some of the more exciting stuff that you find in recent games (or if they do, its in the form of small examples, aka token deferred shading example).

I'm working on some software for a power wall and a CAVE system at my school and I've ended up using visualizationlibrary (visualizationlibrary.org) along with equalizer for distributing the rendering. At the end of the day, I find that an object oriented wrapper on top of OGL works pretty well if all you care about is rendering. Plus VL supports all the latest OpenGL wiz-bang (4.2 tess shaders and what not).

Although if Unity decided to expose fine grained control over buffer swaps, I'd switch to that in an instant...

shodanjr_gr
Nov 20, 2007
What's the verdict on Corona (http://www.coronalabs.com/products/corona-sdk/) for developing/publishing to iOS/Android? Is there anything fishy behind their publishing scheme? Do they handle their publishing process?

shodanjr_gr
Nov 20, 2007
Are there any good resources about structuring game code? I'm familiar with the graphics side of things (scene graphs and what not) but I'd like to read up a bit on patterns for interactive games with physics/sound/multiple input methods (and potentially multiplayer). Don't care so much about the technical aspect but rather the high-level stuff so I can structure code in such a way that it won't come back to bite me in the rear end later.

shodanjr_gr
Nov 20, 2007

OneEightHundred posted:

It's also a function of what your game needs to do. Things like saves, out-of-scope objects (i.e. almost everything in a sandbox), level transitions vs. stream-in, multiplayer, physics, and your lighting model all have severe effects on how the rest of your game will be designed. Even reusable engines have to nail some of those aspects down before they can do much.

Yeah I am aware of that. I have narrowed down the scope pretty well (its a 2D SHMUP-ish concept) and I don't plan on doing everything from the ground up (I'm looking into using a write-once-publish-anywhere game engine such as Corona that publishes to Android/iOS - I'd consider Unity too but the Android/iOS + basic license plugins end up being quite expensive for an "experiment".).

Looking at something like id Tech for inspiration is a bit out of scope since lots of things are heavily decoupled (client/server architecture/VMs/etc).

shodanjr_gr
Nov 20, 2007
Your first terminating condition is getting a null value from fc.GetRoom(). If you end up with infinite recursion, you should look into what fc.GetRoom() actually does. Do you actually set it to return null when the x,y coordinates are not within your map boundaries?

I've barely worked with Unity but maybe its scripting engine also has some sort of stack size limit that you might have to increase?

shodanjr_gr
Nov 20, 2007
Can someone recommend a decent book on modern game engine design that tackles things like a job system, the boundaries between game state, renderer/scene graph, AI, audio and input system, scripting language integration, etc?

I'm much more interested about the proper software engineering side of things rather than super-technical code-level nitty-gritty.

"Game Engine Architecture" by Gregory et al. seems highly rated on amazon but a new edition is right around the corner (coming in July). Any other suggestions?

Adbot
ADBOT LOVES YOU

shodanjr_gr
Nov 20, 2007
There's a blog post floating around from a few years ago about the pitfalls of trying to develop and architecture "too generic" code in the context of game development (I recall the example used being about a tool for laying down street geometry or something along those lines).

Does anyone recall where this was posted?

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