eurybaric
I am thinking of creating a small text-based RPG game...
actually im trying to do something similar to a old game ive played ( i think its called adventure something...)
anyway, in the game you have like different rooms, that can contain objects(key, coin, treasure, person).
The player navigates through rooms by going north, south, east, or west. and can interact by using two-word commands (e.g.: go west, get treasure....).
the thing is I want (and need) to use classes for the player, rooms, objects, and something that connects them all.... but I have no idea where to start.
Can anyone point me to some tutorial that deals with this kind of issues, or in some direction?
P.S: im a self-taught programmer (well newbie if you like), and kinda know a bit of programming basics n stuff, but nothing really serious...
Thanks a lot in advance!! :-)
arithma
This could be a good forum exercise. Get your self a lad. Heat up the discussion. Make sure you fire up questions.
You can immediately start with a player with x and y properties, and by the methods the player can do: walk, talk, smell, look, hold, use.
Create also an environment for the player to walk through, it could be empty for the beginning. It may just be a 2 dimensional grid where each location is specified by a single character that signifies the existence of something ('X' for black hole, 'D' for dagger, 'B' for banana, 'K' for key, ...). You can place objects in one grid, and the environment in another (Walls, furniture, Doors).
On second thought you probably need an expandable list of items that each have a location.
You should soon start to see object relationships.. A locatable item (x and y coordinates), root for all objects like player, items, keys...
eurybaric
Get your self a lad
i didnt exactly get what you meant by that.
ok so what im gonna do here is start coding as soon as i get from uni today. like you said im gonna start with the player class properties and methods, and see where to go next. Ill keep you guys updated.
Thanks for the help! :-)
arithma
Get your self a friend so that you can talk it out with. Someone at your level. (If they're much less experienced, it'll pull you back, if much more experienced, you will be defaulting to their designs and losing a lot of the experience). With the right kind of friend, you both will learn much more than any one of you can on your own. It's ok if you do it alone though.
Keep us updated!
Joe
I would suggest reading a generic C++ tutorial first, as it is a pretty complicated language. Or even better, use another language. I would definitely recommend Python, its syntax is pretty close to C++ and you will be very productive in no time.
arithma
I am assuming the question was: "I need more practice using C++ Classes". The OP says he has some experience playing with the language. I wouldn't recommend rapid hopping between languages when you're starting to learn programming in general. You will lose the intimacy of the learning experience.
C++ is not inherently hard to learn or complicated. Especially when it is your own code. Start reading other expert's code and you'll have trouble. As Bjarne Stroustrop puts it: "C++ is an expert friendly" language. So it will give you much more leeway when you know its intricacies. You shouldn't be having a lot of trouble learning your own programming with it though. Just don't be happy when you learn a new feature and go feature-happy implementing it haphazardly everywhere till you learn the next feature.
When learning languages you should always keep on track:
"Do I know this idiom. Do I know how to implement it. Do I know when to implement it. What do I lack knowledge about this particular idiom". This way you'll know exactly how to maneuver through your exercises.
Take encapsulation for example. You know you can implement it for those structures you were talking about. You know actually should be implementing it as it makes things clearer. And you should start to see how to go ahead and implement it. What you maybe don't know is inheritance. It's a step beyond encapsulation (in the manner that it requires the latter). You should at least have a little read about it to see how you should go ahead with encapsulation so that you don't have to rewrite everything when you want to refactor your code.
eurybaric
@Rahmu => thanks for the suggestion man but im already into c++ and im liking it very much.
@arithma =>
Man I gotta say thats some freakin solid advice you gave me there! :D
OK so about the coding buddy there i dont know anyone at this point who's on the same level as me (either really advanced progs or total newbies).
So what im doing now is reading (class features, general design strategies, etc..). I decided not to start this particular exercise right off(at least not the actual coding) until i have enough insight to write efficient and maintainable code.
Again, thanks a lot for the help