Article View: rec.games.programmer
Article #644Question on game design
From: Matthew Smith
Date: Wed, 12 Aug 1992 21:39
Date: Wed, 12 Aug 1992 21:39
39 lines
2475 bytes
2475 bytes
I have a question for those who have done some game design in the past. I'm looking to write a game for the IBM, and I have all of the low level part pretty much completed (read: graphic drivers) and working fast. However, I started working on the engine that controls the characters, walls, treasures, etc, and I was wondering how people were keeping track of collisions? I thought that the way I did it was the way most people did it, however, talking with a few people, I have realized that there is a different way to go about doing things. What I've done is created a library in C++, where, to create a character, I just derive it from an object called GAME_CHARACTER, with a few parameters such as initial position, the byte buffers that are displayed on the screen, buffer masks, etc. I also have a linked list of all of the characters that are currently in the game. Whenever I move any character (or, it could be an object, like a bullet, but that is irrelevant), it goes through the linked list of characters, comparing the new coordinates of the object with each of the coordinates of all of the characters in the list. The way I draw everything to the screen is to have each object draw itself when it initializes and every time it moves. Now, my question is this. The people that I have talked to do things a bit differently. They have a virtual buffer that they draw everything to, and then every once in a while, go out and refresh the screen from the virtual buffer. They use certain colors for the background (maybe 10 or so), and the rest are reserved for character objects. Then, whenever something moves, it only needs to check the virtual buffer for the chunk that it is moving into for any colors that aren't reserved for the background to see if the object has run into anything. So, has anyone ever played with these two methods? What other methods do others out there use (that aren't top secret)? Thoughts? Matt Smith msmith@peruvian.utah.edu Student - University of Utah Department of Computer Science
Technical Details
Message-ID:
<1992Aug12.153928.25823@hellgate.utah.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!caen!hellgate.utah.edu!peruvian.utah.edu!msmithShow Full Headers
Complete Article Headers
Newsgroups: rec.games.programmer,rec.games.design Path: arc1-ca.pugleaf.net!sparky!uunet!caen!hellgate.utah.edu!peruvian.utah.edu!msmith From: msmith%peruvian.utah.edu@cs.utah.edu (Matthew Smith) Subject: Question on game design Date: 12 Aug 92 15:39:28 MDT Message-ID: <1992Aug12.153928.25823@hellgate.utah.edu> Organization: University of Utah CS Dept Distribution: w Lines: 39