Sign in to follow this  

ok....

This topic is 3489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello everyone!!! I would like to know how to make a game? I take a computer class at school but sadly my school only teaches Java.... I 1-6 of the programming Gems books but they are of no good use at my current lvl of c++ understanding. SO first can yall direct me first on how to make text base games so I can get some understanding on basic commands and such. Any help would be nice.

Share this post


Link to post
Share on other sites
Pay attention in class. When you know enough it's very obvious how to start with text based games. You're right, Game Programming Gems won't help you much yet, wait another year or so and they'll be magic.

Share this post


Link to post
Share on other sites
I know how to make very basic text games in Java but I know nothing about c++ in order to do the same :(. Thats why I asked on info or a article that shows basic c++ commands so I can try to do the same.

Share this post


Link to post
Share on other sites
You don't need C++ to make games. Making games is not language specific.

In any case, we would advise that you not deal with C++ for quite a while. It's complexity and quirkiness is not suited for beginners. Once you can comfortably make basic games in Java or some other higher level language, you may then consider C++.

You don't learn "C++ commands". You need to learn the language, and by extension, it's libraries, idioms, and working with the common C++ tools. You cannot look at an article, look at a few "commands" and make anything out of it.

Share this post


Link to post
Share on other sites
oler1s is correct in the sence that games are not language specific. Being a computer programer you should pick the best langauge for the job at hand. However i am against his idea that C++ is complexe and maybe a bad idea. What i suggest is you finish laerning java because java is a classed based langauge and is relativly easy to use or at least can be.

The big thing here is that once you learn one langauge it only gets easyer to learn others so finish one and if you find you need a differnt language for a differnt job then that is what you do. Basic text based games are easy there are some basic task you need to do so break it down into them and the picture of what needs to be done becomes clear.

For instance.

Display information to user.
Get Input
determin if input is a valid action.
Make nessicary changes.

Repeat.

I personaly love C++ and it was more or less my first language so don't be afriad of it but don't close yourself off to the idea of learning a new language as that is sort of a back firing trait.

You may get stuck one day and instead of useing a language that is more suited to that type of task you might just try to muddle through it in the language you know and give your self much more of a head ache then is needed.

If you are determinded to do C++ pick up a book try and get a newer one with some thing called STL in it or at least a few chapters about it and start from there. now as for a better explaintion as to libraies and extentions.

Games are not done just in straight C++ they use Libraires and witch can also be refered to as API's for instance to make a window that uses something called win32 API witch is a windows API and for doing some graphics you may use OpenGL or DirectX bolth are API's themselfs an api is basicaly an add on to the C++ language in a way. because you can call differnt functions to accomoplish differnt tasks. Needless to say it can become complicated if you try to jump into the pool before you know how to float but don't decied never to go near the pool as it can be enjoyable even when its frustrating at times :)

If you have a question or if i did not explain something well enough you can pm me :) or just post back.

Regards Jouei.

Share this post


Link to post
Share on other sites
I have all the Programming Gems 1-6 books and I have Code Completion 2nd Edition. I even have Modern c++ Design. What Im trying to say is, are there articles that show basic code or how to do this and that? Basic things to the point of the old 'How to write 'Hello World!' and stuff like that in c++... I jumped the gun early back when I tryed to go right into OpenGL. After a week of looking at code and Nehes site I still could not understand what parts did so I want to start from scratch and work my way up.
We used JCreator to program in Java and it was really easy for me because the Library was easy to read and undestand. So is there a site or a book that explains whats in the Visual c++ Librarys and what everythign does? If I can get that info I can begin experimenting with it. Sorry for any trouble I might be causing..

Share this post


Link to post
Share on other sites
Well ill attempt to help you out abit and since you have a C++ book or at least it appears you have stated so ill assume you know what variables are how how to use them.

First off take a look at iostream its used for win32 console input and output and probaly dos too im not 100% sure.

once you know how to do that lear about loops aka while and for loops in paticular.

you alos need to know what the program entrey point is in a win32 console it goes something like this.

int main()
{
//all program code here
return 0;
}

that is where the program starts exicuting lines of code. It seem's kind of hard to imagin that you have read a C++ book and would not know that but i supose some how it is posible.

some basic examples of taking in input from a user is as follows even a small sample bit of code.

#include <iostream>
using namespace std;

int main()
{

char Text[250];
cout <<"Hello please tell me your name: \n";
cin >>Text; //This gets input from the user tell they hit the
//return key.
cout <<"Nice to meet you \n"; //This prints text to screen
cout <<Text; //This prints the Variable to the screen

return 0;
}


the librays in MVC++ Express are basic there is nothing really added but what the C++ language is standard for reading and writeing to files geting a console users input and doing output.

here a tip for clearing the console screen however system("cls");
for the most part just try doing a basic game of guessing numbers
and work your way up from what it seems you asking for a basic small games source code for a text based game i personaly if i was at home could program a maze game for console in less then 15 mins where you only see the squares around you guy and the reast is black. If you have a C++ book read it over ro again and do all of its exersices and try to really understand them as win32 console text based are not complexe really one other thing if you want to do menus for your game to check out is the switch statment. google it like this C++ switch statment and im sure you find out a good desription of how it works if you are not really sure what something does check out msdn.com and search for it there.

mabye tommrow i can write a small sample guessing game or something and hope you understand it but almost any programing C++ book will tell you what i have some far oh and win32 console do not have graphics beyond letter and numbers btw adding color can be done but thats for a later disscusion.

Regards Jouei.

Share this post


Link to post
Share on other sites
Thx for the reply. I beleave switch in Java is the same in c++ so for the basic games I made were Rock,Paper,Scissors where you type 1-3 and a Random method pickes 1-3 and sees if you won or lost. I think ifs and whiles and do/whiles work the same in both languages since JCreator was made with c++.

Share this post


Link to post
Share on other sites
Well you have basicaly what you need then to make a game a text based game will require you to check what the user typed in or just leave the user to press a key to do something if you want to get a single letter input without having the user to press return you can use the get function built into iostreams cin

basicaly you go like this var = cin.get();

cin is actualy a class if your not sure what a C++ class is you might want to read up on that it can get abit advanced but they are eternaly usefull and it is what makes C++ as powerful it is you are right in assuming that java was built useing C++ asa java itself is a C++ classed based system.

for the most part a text based game will require abit of work and planing one way to acomplish abit of a map like effect is to have an arry of data structres and when the user moves say south you decrement or increment what part of the arry tyou are attempting to display look up struct as it is useful and it is actualy a C based functionality and is not nearly as power as a class but can do in a pinch.

i recmond useing an arry a double arry for a maze game try that as your next project something like this

int Map[25][25];

That would make an arry 25 by 25 so in a sence you have a map and just figure out wether the user can move there based on wether or not the specific spot they want to go to is 0 or no zero a non zero spot may represent an ascii graphic per say.

Anyways im actualy off to bed now but ill be back tommorow.

Regards Jouei.

rembember you can allways rate pepole good or bad on how they help you.

Share this post


Link to post
Share on other sites
Quote:
Original post by Jouei
char Text[250];
cin >>Text;

This happens when someone learns C before C++ I suppose :) Use real strings to prevent buffer overflows!

std::string text;
cin >> text;

Share this post


Link to post
Share on other sites
you can also try making a basic mod using quake 3, it will help you see how larger games are structured, and its super easy to make small changes that can make the game fun as well. Check out http://code3arena.planetquake.gamespy.com/ for some good (but a little dated) tutorials on that.

Share this post


Link to post
Share on other sites
Quote:
Basic things to the point of the old 'How to write 'Hello World!' and stuff like that in c++...


You may want to take a look at this link, first one that came up when typing in "C++ tutorial" at google ^^:
C++ Language Tutorial

Good luck.

Share this post


Link to post
Share on other sites
i completly agree with the part about useing strings but rather then through a bunch of new stuff that probaly differes frmo the book he was reading or any info he has looked up i though i would just leave it as char for the moment and explain strings later as they are class based and may have just confused him at the point in time.

However id like to thank all who pointed out the stl string.

id like to also point out that you can quialify the std::string by using its namespace but it is not totaly recomended out side of a code block.

this will qualfiy all things in the standard namespace.

useing namespace std;

this will qualify just the string
useing std::string;

by qualifying it you no longer need to write tthe variable as std::string instead just useing string after qualifying it but as i sead it is not nessicarly a good idea out side of the code block useing it.

Regards Jouei.

Share this post


Link to post
Share on other sites
Thx everyone for the info. Im now rereading some of the books I have. I main goal is to get to the point of making bigger and bigger text based games and later moving on to OpenGL or pass it and go right into DirectX. I would like to make my own game engine and try making games off of it. Even if it wont match some of the ones out there it would be a cool project to pass the time on ^^.

Share this post


Link to post
Share on other sites

This topic is 3489 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this