Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 11 Mar 2000
Offline Last Active Jun 16 2014 06:36 PM

Posts I've Made

In Topic: Best practice for presenting enumerated display modes?

28 August 2013 - 12:11 PM

The easiest way is to choose which display modes you are interested in as game designer, check if they are available on client side, and display those which are correct. I dont think you need to display all.



Even so, let's say I want to include 1920x1080 in the list. When I enumerate the display modes, I get five different modes with that resolution. One is 50Hz, and four are 60Hz (either 59940 / 1000 or 59950 / 1000). At the latter ratio, there is one mode for each of three scaling types (unspecified, centered, and stretched). Out of the four 60Hz modes, which one do I choose? Even if we ignore the scaling type, there's still two 60Hz modes, and when we create the swap chain we have to choose one set of ratios... I'm just not 100% clear on the implications of choosing one ratio over another.

In Topic: Help with visibility test for AI in 2D

21 August 2013 - 05:35 PM

If you're willing to accept tile granularity for your vision detection (which it seems you are), then you can solve this problem using a series of ray traces. For each tile occupied by the player, trace a ray through the world from the enemy's eye to the player's tile (center point). If the ray passes through any tile occupied by an occluder (solid wall, floor, etc.), early-out and move on to the next ray. If none of the rays reach any of the player's tiles, the player is considered hidden. There are various tricks and adjuments you can make to increase accuracy, but this should provide a good rough start :)

In Topic: Determining effect order

20 August 2013 - 04:57 PM

It's difficult to give an exact answer without knowing exactly what effects can... well... affect in your game, but ideally, you don't want effect order to matter. There are ways to design such a system so that effects can be applied in an arbitrary order, and an intermediary layer can sort out the side-effects and make sure objects are actually affected in a sane manner.


The analog is a graphics engine which renders in two phases: the first phase collecting all the objects that need to render (or in your case, all the effects that need to be applied), and then breaking down the objects into their component pieces and rendering them in the correct order to minimize state changes, handle transparency properly, etc. (which in your case is breaking down a high-level effect into its low-level state changes and sorting them appropriately).

In Topic: about lines of code

19 August 2013 - 12:25 PM

I never use newlines, so technically I haven't even finished my first line of code yet :P

In Topic: Do you find C#'s lack of an explicit destructor to be an issue?

16 August 2013 - 12:32 PM

If you write a class that has any IDisposable members, also make that class an IDisposable, and have its Dispose() method dispose all the members. That will emulate destructors in C++, which automatically call members' destructors. Other than that, I can't see what else C# lacks in these regards.