• Guidance towards small game
    15 replies, posted
Hey, I have an assignment I'd like to accomplish for my school I want to go to. The assignment is to write a small 2D game that has the theme "bubbles". It can be any game I want, it just has to do something with bubbles. The problem is: I have no experience with C++. I do know some basic code, I wrote a small console-application game where you had to pick a number and it tells you if the entered number is higher or lower than the "randomly picked number". I do not expect myself to write an awesome game, but I really have to write it to show that I'm capable of attending that study. I'm looking for someone who can help me to get the basics of a game, I've got ideas enough. It doesn't have to look flashy so I'm not looking for advanced stuff, but I litterally have no idea where to start. The reason for writing the game in C++ is because the study I want to attend is all about C++, a game written in another language would score lower than a game written in C++. Just some side information, I am not completely new to "coding" or "programming", I'm just not familiar with C++. My first experience with coding was in Garry's Mod, using WireMod's Expression 2. I know this isn't any kind of "proper language", but it helped me to understand how programming does work. I'm currently doing a lot with PHP, which all seems to work out well. PHP made me understand almost every code language that I've read so far, but now I'm trying to master C++, starting with the very basics. I've followed [url=http://www.cplusplus.com/doc/tutorial/]these tutorials[/url], but I didn't go any further than Functions (II). However, I do understand Arrays and character sequences. So, the final question: Could someone help me and explain me how to start to create your own small 2D game? [editline]3rd December 2012[/editline] Also "important", I've got "Beginning C++ Through Game Programming, Third Edition", since the school recommended it to me.
you should read on to Object Oriented Programming and try to understand most of it, if you are unsure create very simple classes to test(Animal, Dog, Cat, etc.) that just print stuff to the console. When you understood that(maybe not fully yet but at least youve heard of it) go on to getting something to draw on the screen :) To do that you want to get a library that does basics like image loading and drawing for you so you dont waste time trying to implement that yourself(since you need to get the game done). A good Framework that many people use here is SFML(get it at [url]http://www.sfml-dev.org[/url], i recommend you use 1.6 since there is a lot of sample code). Now try to set it up and run some of the example programs and modify them a bit. [url]http://www.sfml-dev.org/tutorials/1.6/start-vc.php[/url] Always have the documentation with you and read it when you dont understand how to use a class or want to know what a specific class is good for: [url]http://www.sfml-dev.org/documentation/1.6/[/url] Now you'll probably already know what to do next and just draw a few circles(bubbles) that the user has to click or something That's what i would do, i'm not that much of an experienced programmer but there are many others here who are and can help you, too :)
I've heard that it'll take at least a month to even get to understand SFML. And I don't really have that much time, I have about 6 weeks to get a simple game and I honestly don't know where to start. This what you told me seems like a good start, I'll start with it tomorrow.
[QUOTE=Cyberuben;38690980]I've heard that it'll take at least a month to even get to understand SFML. And I don't really have that much time, I have about 6 weeks to get a simple game and I honestly don't know where to start. This what you told me seems like a good start, I'll start with it tomorrow.[/QUOTE] Whoever told you it would take a month to learn SFML is silly. It takes a week max to get familiar.
[QUOTE=D:\;38691290]Whoever told you it would take a month to learn SFML is silly. It takes a week max to get familiar.[/QUOTE] Gives me some more confidence to start. Thanks.
If you know any other language down pat and well enough to write simple programs the switch shouldn't be that hard. What languages do you know?
[QUOTE=Wealth + Taste;38692117]If you know any other language down pat and well enough to write simple programs the switch shouldn't be that hard. What languages do you know?[/QUOTE] As said, I know some "decent" PHP, as long as I have documentation with me (php.net mostly), Expression 2 (if you even can consider this as a language), and very basic C++, enough to write this: [code]#include <iostream> #include <ctime> using namespace std; int main() { srand( time(NULL) ); int secretnumber = rand() % 100 + 1; int guess = 0; int chances = 0; int exit = 0; cout << "This is a guessing game! Enter a number between 1 and 100 and press enter!" << endl; cin >> guess; if(guess > secretnumber) { cout << "The secret number is lower" << endl; }else if(guess < secretnumber) { cout << "The secret number is higher" << endl; } while(guess != 0 & guess != secretnumber) { cout << "Please pick another number between 1 and 100!" << endl; cin >> guess; if(guess > secretnumber) { cout << "The secret number is lower" << endl; }else if(guess < secretnumber) { cout << "The secret number is higher" << endl; } ++chances; } if(guess == secretnumber) { cout << "You guessed the secret number! It was " << secretnumber << endl; cout << "It took you " << chances << " chances to guess the number" << endl; } system("pause"); return 0; }[/code] I'm sure some things could have been done better.
well there is a shortcut, what you can do is get marmalade sdk and IwGame, the setup is a joke, you can get a sample running in 10 mins and making a game with it is really easy too, it's mostly XML and just a little C++ ;) You get a full and free 2d engine and a crossplatform sdk that can deploy to windows and mobile(ios/android). However it costs something so you'd have to contact them and ask them for a license(they ask to contact them for educational projects but no idea if they will give you a discount or free or anything at all)
You're applying for IGAD right? Contact me on Steam some time and I'll help you out. We'll use the school template.
[QUOTE=Natrox;38693642]You're applying for IGAD right? Contact me on Steam some time and I'll help you out. We'll use the school template.[/QUOTE] I am indeed applying for iGAD. Not because I like to play games, but because I enjoy coding. I added you.
[QUOTE=D:\;38691290]Whoever told you it would take a month to learn SFML is silly. It takes a week max to get familiar.[/QUOTE] IMHO it only takes a few hours if you're familiar with other APIs...a day or two if not. It shouldn't be that big of a worry.
Does it have to be C++? If not, you could try C# and XNA.
Java and LWJGL are very fast to learn but yeah I might go with XNA if you are in a rush. Honestly, it should not take you very long to get the basics down of a graphics api. just look at tutorials, look at code, and you will figure it all out.
[QUOTE=Cyberuben;38690455] I'm looking for someone who can help me to get the basics of a game, I've got ideas enough. It doesn't have to look flashy so I'm not looking for advanced stuff, but I litterally have no idea where to start. [b]The reason for writing the game in C++ is because the study I want to attend is all about C++, a game written in another language would score lower than a game written in C++.[/b][/QUOTE] Yes, it has to be.
Ignore what people say about learning Object-oriented programming before proceeding. Maurice made Mari0 without an in-depth knowledge of OOP and other related practices. Link us the assignment's marking guide and we'll be able to tell you what's important. Here's a general guide: - Get [url=http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial]Allegro[/url] - Work your way through the [url=http://wiki.allegro.cc/index.php?title=Allegro_5_API_Tutorials]tutorials[/url]. Try out each example yourself. (Note: read this one straight after the display tutorial: [url=http://wiki.allegro.cc/index.php?title=Basic_tutorial_on_loading_and_showing_images]Basic tutorial on loading and showing images[/url]) - Experiment a little bit; load different images and render them around the screen. - Make a bitmap move according to time ("x = sin(time)*10" is a good one). - Make a bitmap move to where your mouse is. - Make pressing a button on your keyboard change which bitmap draws. From this stage, you should be able to make a basic game (NOT your final game). A day or two of concentrated work and you'll have hopefully ironed out everything; if you have strange problems (like black screen or so on), undo changes and try to see if your code conforms to the examples. If you're really stuck, post here and we'll try to help you. Then, after you're comfortable with Allegro.. it's time to design your game! (read this bit AFTER you've done the above) Draw some images of what you want your game to look like and think about the different "elements" of your game. For example, if you were to make "bubble invaders" (like space invaders), you'd need: GameWorld, Enemy, Player, PowerUp. Then for the display you'd have: Score, Health, PowerUpStatus. Try to make classes for each of these. (Note: you may have noticed that an Enemy, a Player and a PowerUp are all things that move. You might make an "Entity" class and have those classes inherit from the Entity class.) What you're doing with classes is Object-oriented programming. [b]Todo:[/b] Add example of using Allegro! I wrote a big example, but lost it.. sorry :/ I'll work on it later.
[QUOTE=Deco Da Man;38700120]Ignore what people say about learning Object-oriented programming before proceeding. Maurice made Mari0 without an in-depth knowledge of OOP and other related practices. Link us the assignment's marking guide and we'll be able to tell you what's important. Here's a general guide: - Get [url=http://wiki.allegro.cc/index.php?title=Allegro_5_Tutorial]Allegro[/url] - Work your way through the [url=http://wiki.allegro.cc/index.php?title=Allegro_5_API_Tutorials]tutorials[/url]. Try out each example yourself. (Note: read this one straight after the display tutorial: [url=http://wiki.allegro.cc/index.php?title=Basic_tutorial_on_loading_and_showing_images]Basic tutorial on loading and showing images[/url]) - Experiment a little bit; load different images and render them around the screen. - Make a bitmap move according to time ("x = sin(time)*10" is a good one). - Make a bitmap move to where your mouse is. - Make pressing a button on your keyboard change which bitmap draws. From this stage, you should be able to make a basic game (NOT your final game). A day or two of concentrated work and you'll have hopefully ironed out everything; if you have strange problems (like black screen or so on), undo changes and try to see if your code conforms to the examples. If you're really stuck, post here and we'll try to help you. Then, after you're comfortable with Allegro.. it's time to design your game! (read this bit AFTER you've done the above) Draw some images of what you want your game to look like and think about the different "elements" of your game. For example, if you were to make "bubble invaders" (like space invaders), you'd need: GameWorld, Enemy, Player, PowerUp. Then for the display you'd have: Score, Health, PowerUpStatus. Try to make classes for each of these. (Note: you may have noticed that an Enemy, a Player and a PowerUp are all things that move. You might make an "Entity" class and have those classes inherit from the Entity class.) What you're doing with classes is Object-oriented programming. [b]Todo:[/b] Add example of using Allegro! I wrote a big example, but lost it.. sorry :/ I'll work on it later.[/QUOTE] I'll try this out along with Natrox's stuff. He's attending the study I want to go to so he knows what the school "requires" me to do, and he'll help me to get used to their template.
Sorry, you need to Log In to post a reply to this thread.