Game from Scratch ? C++
#1 Members - Reputation: 150
Posted 15 December 2012 - 08:22 PM
I am 14 and made 1 year in game developing..xD
Currently learning c++ to make games with OpenGL and also rigging. :-]
#3 Crossbones+ - Reputation: 1018
Posted 15 December 2012 - 09:13 PM
Maybe when that is working, create a little "AI" that you can play against. Get creative, make it a 4x4 grid instead of a 3x3. Just start small, work piece by piece, and you will start to see your game.
#6 Members - Reputation: 451
Posted 15 December 2012 - 11:33 PM
#7 Crossbones+ - Reputation: 320
Posted 16 December 2012 - 03:37 AM
That depends. A random number guessing game is just a few lines of code and doesn't require intricate knowledge of a programming language.
GameCreator has a valid point. My suggestion is to start small. Take GameCreator's advice and create a random number game. After you finish that, take a stab at another little game. You need to build up your skills (which is often overlooked by new programmers).
This is the hard, but very real truth. You can't create a game in a language if you do not know the language. Learn your basics and learn them well.
But still on basics
If you are still on basics, you can't make a game.
Learn the language first.
EDIT: I figured I would answer your original question as well. If you look online quite a few companies have released the source code to their games. Id Software's Doom 3 comes to mind. You can find the source code here. With that being said, be prepared to have it handed to you. The level of coding that goes into games is extremely high. With that being said, however, studying other peoples code is an important part of learning to program.
Edited by ByteTroll, 16 December 2012 - 03:44 AM.
I see the future in 1's and 0's
▬▬▬▬▬▬▬▬▬▬▬ஜ۩۞۩ஜ▬▬▬▬▬▬▬▬▬▬▬▬▬
#8 Members - Reputation: 2048
Posted 16 December 2012 - 04:32 AM
The level of coding that goes into games is extremely high. With that being said, however, studying other peoples code is an important part of learning to program.
I very much agree that studying code is an important factor, but I don't believe it's applicable yet to the OP.
At this stage a good understanding of the language is a priority, especially so with C++ as there are so many ways to write functioning but terribly written C++ code. Source code for finished games might not always reflect the best practices, or might just do some things in a terribly hack-ish way because of time constraints or because something needed to be fixed quickly (I haven't looked at the source code for Doom myself, so I couldn't say whether this applies here).
Getting code for complete games just handed to you is not going to be all too helpful right now, it mostly encourages copy-paste behaviour and unless every technique/pattern/whatever used in the code is thoroughly documented, you probably won't understand the reason why the developer chose to use a certain technique at a certain location, or what the technique is even supposed to do.
The important thing now is to understand how to use the basic paradigms provided by C++ correctly at an elementary level, and how to properly implement problem solutions with these. Learn about the basic OOP principles, learn about what kind of functionality C++ provides to support OOP, learn about what kind of useful stuff the C++ standard library provides, etc. and work your way up starting from a very simple 'hello world' application while applying the concepts you've learned and using the data structures (eg. lists, maps, vectors, queues, stacks, etc.) and functionality you've read about.
Once you have some knowledge of object-oriented design and the tools your language provides it'll become clearer to you how to implement a simple game such as tic-tac-toe yourself.
#10 Members - Reputation: 538
Posted 16 December 2012 - 08:56 AM
Learn the language then move onto the movie,.. I mean game
#12 Members - Reputation: 123
Posted 16 December 2012 - 10:50 AM
You'd need to practice with boolean expressions a lot. Statements like if(!(var && !var2) && (!var3 || var4)).
Edited by farmdve, 16 December 2012 - 11:07 AM.
#13 Members - Reputation: 193
Posted 16 December 2012 - 04:36 PM
I suggest starting with writing small programs that do different things, not just games. Find different ways to manipulate data. Find and solve your own small problems. Try to implement a basic sorting algorithm, that sort of stuff.
When it comes to simple games that doesn't require anything fancy I generally divide the code in to three parts. Input, read user input and handle it accordingly. Update, update the game state accordingly to the game rules. Drawing, draw everything to the screen.
If I want to put together a simple game I just need to figure out how to represent the game state and then fill in these three functions.
#14 Members - Reputation: 164
Posted 17 December 2012 - 03:39 AM
To write your own game from scratch, use this:
int main(void) { return 0; }
Now you will have to add your own code to it, and turn it into a game.
I'm Sorry but this comment made me grin from Ear to Ear lol! As all the others said it's best to start small and move forward. my very first game was a text based CYOA ( Choose Your Own Adventure) , which eventually gave way to a text based RPG, which eventually gave way to a basic platformer, and etc. etc. and I definitely think looking at someone else's code and dissecting it can help but there are some principles you won't understand until you play with them yourself like the game loop . and how to best set up a basic game progress. any how goodluck!
Edited by JonathanJ1990, 17 December 2012 - 03:43 AM.
#16 Members - Reputation: 160
Posted 18 December 2012 - 06:37 AM
I know I'm probably sounding facetious, but frankly, C versus C++ provides scant, almost zero advantage one way or another as either way whether you write C++ or not you're going to be compiling C at the end of the day, and is all up to whether or not you think you need the concept of distinct objects that are protected from access from one another and things like generic code or compile-time code generation, or operator overloading to make a decent program.
Give C a try if you're on the basics, and see if you pick it up faster than C++. If you *need* some feature of C++ at some point later for any reason, then by all means, use C++ if it suits you at that point.
I also laughed uproariously at ultramailman's post.
Edited by darkhaven3, 18 December 2012 - 06:38 AM.
#17 Members - Reputation: 151
Posted 18 December 2012 - 07:08 AM
I really feel like as a beginner vanilla C is going to be more intuitive and straightforward than trying to learn C++ out the door.
Honestly, I feel if the OP is learning C++, let them learn C++ without telling them they need to learn regular old C. They're both Turing-complete languages, each with pros and cons. I personally find C++ to be more intuitive than C, but if someone is learning C then I'm not going to suggest switching because of my personal taste. (sorry
But if you want to learn to program a game like tic-tac-toe, there are a number of tutorials out on the web, and many books you could get that would help you along. I don't know where your skills are, but try searching around the net for beginner c++ lessons, or checking out your local library for books on programming or c++ if you can't afford to buy one. But like everyone else has been saying, be careful about not copy-pasting, or you won't learn anything! When you do find a tutorial or a book or whatever, play around with the code and see what happens; try and make it better, or try and make it do something different. This way you aren't just copy-pasting, you're actually figuring out what the stuff you're typing in actually does. I hope that helps!
#18 Members - Reputation: 160
Posted 18 December 2012 - 07:54 AM
Absolutely. I might find that using generic programming or templates is by and large leaving the door open for bad programming practice, but I appreciate and accept that you will probably feel that my usage of structs and function pointers is archaic and meaningless. I don't mean to make it sound like I'm saying "C is better than C++" or even "C++ sucks", I am simply sharing my feelings that as a beginner I found the idea of just writing a function and being able to call it a much simpler process than having to worry about whether or not other objects should be allowed to see it.They're both Turing-complete languages, each with pros and cons.
Of course that is completely arbitrary and up to subjective evaluation by anyone at any point, and by no means do I mean to represent my opinion as fact. I apologize.
I personally find C++ to be more intuitive than C, but if someone is learning C then I'm not going to suggest switching because of my personal taste. (sorry
I just feel like discussions of which language is better, especially with C/C++, are totally pointless and especially don't help a beginner)
Like I said, I meant what I said in an absolutely subjective manner and I did not mean to present my opinion as anything but. I've just always seen C as a more attractive option for game programming as a personal preference, and I am sure I'm not the only person who might feel that way is all.
#19 Members - Reputation: 150
Posted 18 December 2012 - 08:43 AM
Give C a try if you're on the basics, and see if you pick it up faster than C++. If you *need* some feature of C++ at some point later for any reason, then by all means, use C++ if it suits you at that point.
actually i think i can learn c++ fast
I am 14 and made 1 year in game developing..xD
Currently learning c++ to make games with OpenGL and also rigging. :-]
#20 Members - Reputation: 151
Posted 18 December 2012 - 07:20 PM
Of course that is completely arbitrary and up to subjective evaluation by anyone at any point, and by no means do I mean to represent my opinion as fact. I apologize.
It's ok! This is a forum, after all. You're allowed to express your opinion.







