Rogue is a dungeon crawling video game first developed by Michael Toy and Glenn Wichman around 1980. It is generally credited with being the first "graphical" adventure game, and was a favorite on college Unix systems in the early to mid-1980s, in part due to the procedural generation of game content.

-- http://en.wikipedia.org/wiki/Rogue_(computer_game)

Friday, May 28, 2010

Getting too clever

The nice thing about holiday weekends is that you can get so much done. Fortunately this gave me more time to program. Today was an exercise in possibly getting too clever. Yesterday I stumbled on to making my own operators for custom data types and I may have gone a wee bit overboard. My little old position structure is now a full class with addition, scalar multiplication, equality comparison and even a funky divisor for dealing with pixel movement per frame refresh.

Also I created structures and objects doing collisions on circles and rectangles. This way I can just do Entity1 < Entity2 to see if they overlap for collision. It got a little more convoluted then I wanted. But now I can define an object as a collection of circles and rectangles and see if it overlaps with another object of circles and rectangles. It is crude and will work.

There are better methods out there, but I will have to read up on them. I think what I need to find is a good Game Algorithm book. Something that will help with advance collision detection, AI programing as well as other more advanced topics.

However, what I have now will be more then adequate for what I have in mind for YAR. Everything I have is still really a 2D sprite in one plane, so circles and rectangles should be good enough. I will need to figure out how to do the map collision for Pac-Man. Defining all the walls as rectangles could work. I just should have something that tries the closest walls first. Though I may do it though tile definitions. Each tile has a predefined set of exits to other tiles.

Overall it has been a good week, even though I don't have anything to release this week. I might have something done over this weekend.

1 comments:

evolutional said...

With games like PacMan you often do collision with the tilemap and don't need to go down to any other detail. For example, if your man is at 4,5 on the tilemap and is trying to go right, but there is a wall at 5,5 your game logic would stop him from moving right. The tilemap would be as simple as saying tiles of type 1,2,3,4,5 are non-walkable, so you'd do that as a check in your collision/movement code. Of course, you could get more complicated if needs be.

Post a Comment