![]() |
| ||
| Trying to create a C++ object oriented game Hi guys, I'm quite new to C++, I have just recently gone through 3/4 of SAMS teach yourself C++ in 21 days and I am hoping to start programming my first object-oriented game. I have created a few games in the past (you can check them out on my site www.urix.us), all however procedural; and I would like to focus more on the OO side of programming from now on. What (or who) I need is a guide though, because I understand everything about OO programming, I just dont really understand yet how it can be implemented in a game concept. If anyone has an example of their own game it would be very helpful for me if you could send it over so I can check out the source code and get into the game programmers mind. Please help, thanks in advance :cheesy: |
| ||
| Re: Trying to create a C++ object oriented game I would strongly recommend you to try to simulate the programs you have written during your C days in C++. That would help you in gaining an OO perspective and make it to approach every problem in the OO way. Jumping head on in complex projects would only cause total chaos. But still if you must have it, try these sites: http://dmoz.org/Computers/Open_Source/Software/Games/ http://osswin.sourceforge.net/games.html Best of luck. |
| ||
| Re: Trying to create a C++ object oriented game Quote:
There's more to objects than just the full blown OO that you've prolly been learning. An object-based method is more common than an object-oriented method, if that makes any sense at all. :confused: When you write object-based stuff, it means that you're using objects for the data hiding and encapsulation benefits, but you don't really need inheritance and polymorphism for the organization benefits that only large projects really need. When you write object-oriented stuff, the main win comes from being able to use inheritance hierarchies to organize the concepts in a big project. That's a full OO approach, and you don't really need it unless your project is too big to get a big picture view without getting a headache. :D My (psychotic as my colleagues like to say) guess is that you're trying to go object-oriented and it's confusing you because you don't need that level of abstraction. If you drop down a level to object-based design, you'll prolly have more luck breaking your game concepts up into objects. :) |
| ||
| Re: Trying to create a C++ object oriented game Quote:
|
| ||
| Re: Trying to create a C++ object oriented game Quote:
Beginning Game Programming: $23.09 Product Details Paperback: 624 pages Publisher: Sams; Bk&CD-Rom edition (July 19, 2004) Language: English ISBN: 0672326590 Book description from publisher's homepage: If you are hooked on video games and have a basic knowledge of C++ and visual programming, you will be hooked on Beginning Game Programming. Clear, practical lessons based on C++ programming are the basis of this book's lessons. By focusing on the Windows API to construct games, you will learn game theory in double-buffered graphics, sprite animation, digitized sound effects and music. A fully functional game engine provided on CD, along with tools, code and graphics, will give you the ability to create your own games in the future. Learn the art and science of game programming with help from Beginning Game Programming. Here is another informational link: http://www.toymaker.info/Games/html/beginners.html |
| ||
| Re: Trying to create a C++ object oriented game Ye, sorry I'm not able to answer right away, I'm in Cyprus see n still got a bit of a crappy connection so I'm not always online. I'll def be here and answer everyday, probably even twice!! hehe :cheesy: But up to now, I think I get the picture of what you guys are trying to tell me. I have made a 3D tic-tac-toe chess game a while back for my Final Year Project at uni, using C++ and OpenGL; but as I mentioned before, it was procedural and becuase of that lowered my grade to 80% :sad: What this game is, just to get u into it, is a 4x4 playing board, each player having 4 pawns: Horse, Bishop, Castle and Queen. Each can move on the board using their corresponding chess moves, and the object of the game is to align them all together in a row either vertically, horizontally or diagonaly. Tic-Tac-Toe chess geddit?!..:cool: I am only going to focus on the C++ programming part, i don't care about the graphics right now. I am sure this game can be done using classes and basically this is what I need help with. After carefully consideration i have come up with the following classes: 1. Player (player1 and player2 who will be able to move the pawns around the board and change color-eventually in the graphics version) 2. Pawn (the Horse, Bishop, Castle and Queen pawns used in the game - will be derived from class Pawn) 3. Board (the 4x4 playing board that will consist of a 2-dimensional array of type int - int playingBoard[4][4]) 4. Location (I'm not sure of this one, but this is the location or block that the pawn will move to on the board?...) ...and hopefully a logfile with statistics of the game but i'll leave that for when i finish with this. You see, I'm sort of on the right track, I'm just not sure. Any comments how I can clear my mind? |
| ||
| Re: Trying to create a C++ object oriented game oh by the way, thanks for the links ~s.o.s~ but a bit too advanced just for now, I'll have to check them out a bit later on. ToySoldier, the link was great! nice n helpful stuff there. And Inanna, i totally get what you're trying to tell me. I understand I dont need all the levels of abstraction of a huge game, its just nice to classify and seperate objects into classes; I just dont know how to present them and how they will interact with each other :( |
| ||
| Re: Trying to create a C++ object oriented game Quote:
Each square can have: 1. Type of piece. 2. The player whose piece it is. 3. Position value (x, y) Well this is one way of looking at things, you can have your own go at it. |
| ||
| Re: Trying to create a C++ object oriented game Cool, i'll c wot i can do and i'll get back to you guys hopefully in the next few days with some source code to check out.. Thanks for ur help so far!!! |
| ||
| Re: Trying to create a C++ object oriented game ok guys, here's my code upto now. It's probably not much because it hasn't got much functionality in it. I would just like your opinions and help as to how to get on with it. So please, if it's good, say it's good. If it's crap, say it is with as much help as possible... Thankssss :-) #include <iostream> |
| All times are GMT -4. The time now is 2:21 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC