No longer updated: new and updated blog (including old content) at http://roy-t.nl

Archive for http://roy-t.nl, please update your bookmarks

Posts Tagged ‘Game Design’

Implementing A* into XNA

Posted by Roy Triesscheijn on Sunday 22 February, 2009

Edit: the full article + source-code is now available here.

Most of the day I’ve been toying around with the implementation details of A*.  A* is both easy and hard at the same time, small errors in the function that calculates the cost of each node can really break the algorithm (and especially an ‘<’ instead of an ‘>’ and a faulty initialisation can break it, of which I’m, after a good old debugger session, am now painfully aware.

I’m not ready to post my code yet (it still has a nasty quirk, diagonal tiles are somehow very rarely considered even if you try to go from 0,0 to 5,5 without obstacles where a diagonal path (1,1  2,2 3,3 4,4) would be the fastest.  I think I’ve found the piece of code where it goes wrong though)  But I’ll soon do once I eliminated all the bugs and optimized/refactored the code.

Meanwhile have a look at http://www.policyalmanac.org/games/aStarTutorial.htm it’s a very good beginners tutorial (not tailored to any language) be sure to read it front-to-end before implementing it .

Advertisements

Posted in Blog, General Gamedesign | Tagged: , , , , | Leave a Comment »

2D collision response for XNA (fourtwo games)

Posted by Roy Triesscheijn on Friday 3 October, 2008

Today we had a very nice chat on efnet irc #XNA. Be sure to join us fore a while. There allot of creative and intelligent spirits hanging around there. After a while the topic became collision detection and how to solve it.

Both Uhfgood and kelthar had good ideas on how to solve it, and Kelthar had already written working code and a tutorial for good 2D collision detecion and response. Afterall if your objects keeps bounceing into your wall and only gets placed at it’s last position you’re nowhere.

So if your about to make a 2D collision response engine for your XNA game, or are interested in XNA, be sure to check out his tutorial here.

Image and video hosting by TinyPic
kelthar’s resolution to 2D collision

Posted in General Gamedesign | Tagged: , , | Leave a Comment »