• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Pufixas

I learned C++ and SFML, What now?

11 posts in this topic

Hi good people!

OK, So I am learning C++ for more than a year now. I have watched some online tutorials (which sucked) So I decided to buy a book. I have read the book and I can say I am comfortable with the language now. After that I read some documentations on SFML. Now i'm trying to make Arkanoid, Breakout clone. But I don't know how to do things, what classes I should write, how every class interacts with each other. How to handle maps. And I need to learn some math about vectors and stuff. But I can't find a book or tutorial that covers it all...
I can find books but they are written for 3D games, and 3D maths. I don't know what to do. I'm REALLY lost...

I would like to hear how YOU learned to program games. What did you read, what tutorials have you read/watched? And how much math do I really need to learn.
0

Share this post


Link to post
Share on other sites
Have you checked out [url="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx[/url] ? Great set of tutorials using SFML and C++ to make a small Pong game. Not a huge game, but still enough to give you an idea what you'll need.
2

Share this post


Link to post
Share on other sites
[quote name='Inuyashakagome16' timestamp='1340023186' post='4950223']
Have you checked out [url="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]http://www.gamefroms...PP-Edition.aspx[/url] ? Great set of tutorials using SFML and C++ to make a small Pong game. Not a huge game, but still enough to give you an idea what you'll need.
[/quote]
Yeah I have checked it. But this is TOTALY not enough. It is really awesome article. Only if there could be more...
So yeah... I guess i'm doomed
0

Share this post


Link to post
Share on other sites
I learned by doing. At the time I didn't have internet or programmer friends, so apart from some very basic stuff, I made games on my own.

I guess that's the best way: doing it. Not just reading some book or maybe do the exercises in it.

For the specific examples you wrote:

1. What classes should you write? Well, that's a reason why I don't think learning C++ as a first language is good. Starting to think in classes up front is not a beginner topic in my opinion, but maybe I'm wrong about that one. Just hack for starting. Heck the shit out of the code so you learn what can be done or not, what leads to an unmaintainable mess, and what not etc.

2. Class interaction: the same as above (again: it's just my opinion, someone correct me if I'm wrong). Don't think in therms of classes, think in terms of desired behaviour, functions, and how you can break down bigger tasks to smaller ones that you can tackle, test, whatever. The more precisely and detailed you design the behaviour, the closer you will be to actually implementing it.

3. Map handling. There's no "map handling". There is file loading (not necessarily), arrays, data in the arrays, and accessing/manipulating the data.

4. Yup, you have to learn some maths, some "vector algebra" most importantly.


Maybe you should start smaller. Like Pong.


So to sum up: start small, invent and hack, and learn by trying things out on your own, not from some game making tutorials. you have to learn problem solving, and you can only do that on your iwn. Tutorials are only good (in my opinion) for very specific things, like explaining the use of specific features of specific APIs. Just like documentations. Use them as references but don't try to learn to think from them.


(I have the feeling there there are some BS in my post, but anyway...) Edited by szecs
1

Share this post


Link to post
Share on other sites
[quote name='szecs' timestamp='1340026669' post='4950239']
I learned by doing. At the time I didn't have internet or programmer friends, so apart from some very basic stuff, I made games on my own.

I guess that's the best way: doing it. Not just reading some book or maybe do the exercises in it.

For the specific examples you wrote:

1. What classes should you write? Well, that's a reason why I don't think learning C++ as a first language is good. Starting to think in classes up front is not a beginner topic in my opinion, but maybe I'm wrong about that one. Just hack for starting. Heck the shit out of the code so you learn what can be done or not, what leads to an unmaintainable mess, and what not etc.

2. Class interaction: the same as above (again: it's just my opinion, someone correct me if I'm wrong). Don't think in therms of classes, think in terms of desired behaviour, functions, and how you can break down bigger tasks to smaller ones that you can tackle, test, whatever. The more precisely and detailed you design the behaviour, the closer you will be to actually implementing it.

3. Map handling. There's no "map handling". There is file loading (not necessarily), arrays, data in the arrays, and accessing/manipulating the data.

4. Yup, you have to learn some maths, some "vector algebra" most importantly.


Maybe you should start smaller. Like Pong.


So to sum up: start small, invent and hack, and learn by trying things out on your own, not from some game making tutorials. you have to learn problem solving, and you can only do that on your iwn. Tutorials are only good (in my opinion) for very specific things, like explaining the use of specific features of specific APIs. Just like documentations. Use them as references but don't try to learn to think from them.


(I have the feeling there there are some BS in my post, but anyway...)
[/quote]

Thanks! Your post really helped me out.
0

Share this post


Link to post
Share on other sites
Just pratice really. I used xoax.net to get a foot on C++ and then I found some tutorials online how to make a win32 project. And I had[size=4] Sams Teach Yourself C++ in 24 Hours[/size] book. I followed along the book and the tutorials but I was making my own stuff rather than what they were doing. My goal was a small rpg text game. Which I was able to make somehow.

I guess similar to how you are feeling now, I felt kind of lost just following tutorials from the very begining. When I tried to do my own stuff, I was like frozen so to say.

While making that game, I acutally thought I would quit C++. Its too complex and I didnt know what the hell I was doing. There is a learning curve and you can only get over it by experiance and not giving up I guess. My little text game saw 3 revisions. But as I build it up, I started to see that my class design didnt work. Thought how to do it better.
I started planing things. Just a small plan.

Slowly you would get better and see how things are connected and how to make better classes. Initially there was only 1 class. But by breaking up the game and building it up step by step I got better.

Dont worry you are not doomed. Just relax a bit. Take a step back. Maybe try to plan the classes on paper to see how they make look like in the game. Who knows, maybe it would work ;)
1

Share this post


Link to post
Share on other sites
[quote name='Pufixas' timestamp='1340026438' post='4950238']
[quote name='Inuyashakagome16' timestamp='1340023186' post='4950223']
Have you checked out [url="http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition.aspx"]http://www.gamefroms...PP-Edition.aspx[/url] ? Great set of tutorials using SFML and C++ to make a small Pong game. Not a huge game, but still enough to give you an idea what you'll need.
[/quote]
Yeah I have checked it. But this is TOTALY not enough. It is really awesome article. Only if there could be more...
So yeah... I guess i'm doomed
[/quote]
It at least gives you a framework of sorts to understand. You should be looking at each part individually, not the whole picture.

[quote name='szecs' timestamp='1340026669' post='4950239']
I learned by doing. At the time I didn't have internet or programmer friends, so apart from some very basic stuff, I made games on my own.

I guess that's the best way: doing it. Not just reading some book or maybe do the exercises in it.

For the specific examples you wrote:

1. What classes should you write? Well, that's a reason why I don't think learning C++ as a first language is good. Starting to think in classes up front is not a beginner topic in my opinion, but maybe I'm wrong about that one. Just hack for starting. Heck the shit out of the code so you learn what can be done or not, what leads to an unmaintainable mess, and what not etc.

2. Class interaction: the same as above (again: it's just my opinion, someone correct me if I'm wrong). Don't think in therms of classes, think in terms of desired behaviour, functions, and how you can break down bigger tasks to smaller ones that you can tackle, test, whatever. The more precisely and detailed you design the behaviour, the closer you will be to actually implementing it.

3. Map handling. There's no "map handling". There is file loading (not necessarily), arrays, data in the arrays, and accessing/manipulating the data.

4. Yup, you have to learn some maths, some "vector algebra" most importantly.


Maybe you should start smaller. Like Pong.


So to sum up: start small, invent and hack, and learn by trying things out on your own, not from some game making tutorials. you have to learn problem solving, and you can only do that on your iwn. Tutorials are only good (in my opinion) for very specific things, like explaining the use of specific features of specific APIs. Just like documentations. Use them as references but don't try to learn to think from them.


(I have the feeling there there are some BS in my post, but anyway...)
[/quote]
That's very true. Start small, LIKE PONG. I started with SFML with that tutorial I posted and I edited a few of the classes and played with the shapes. All of that is experience and learning you'll need.
1

Share this post


Link to post
Share on other sites
I actually got into game programming by learning how "Metroid" worked. Not the best example for a pc-based modern game though.
As far as 2d games go, it's a lot easier than 3d, so that's one advantage of starting with a breakout game. Basically you're dealing with sprites, and backgrounds which are just bigger sprites that get drawn first. A 2d "map" is usually represented by an array. You can make it a static 2d array like map[100][100], or you can make it a 1d and use math to figure out how to translate from 2d coordinates to a 1d array offset:
[source lang="cpp"]offset = (coordY * width) + coordX;
[/source]
Each element in the array would be a tile number, and you could then render the image for that tile to the screen. Put that in 'for' loops for x and y and you've got yourself a map. For ease (not so efficient) you could just store a separate sf::Image for each tile. I'm not sure if SFML lets you render only part of the image or not, but what I've done in the past with DirectDraw (before it was obsolete) and windows GDI, was to basically have a "tileset" image divided into a 16x16 grid of tiles. Then you c an find the x/y coordinates of the tile you want within the source image by:
[source lang="cpp"]sourceY = int(tileNum / tilesPerRowInSourceImage) * tileHeight;
sourceX = int(tileNum % tilesPerRowInSourceImage) * tileWidth;
[/source]
Of course that's limited to 256 tiles, but you can make the dimensions larger. If you're using openGL textures though, you want to make your source image size a power of 2 or certain drivers might try to do a messy resize on it. I usually reserve tile # 0 for transparent.

One caveat is that certain image formats and GL textures put the origin (0,0) at the bottom-left of the image, while some systems start at the top left. If that happens just use (height-y) obviously. Not sure about SFML, I'm just starting to learn that myself.

There's a free program called "Mappy" that might be good for designing your levels. That will give you some test data to work with at least. It can save a raw format that you can just binary read into your map array. It's based on that second approach where all the tiles are stored in a single image.

One major hurdle to overcome is how to handle collision detection. There are math formulas on the internet for this, if you know the right math jargon to look for. You'd probably want something like "line segment intsersect test". There's one that can tell you the exact coordinates where it intersects. I like it better than a simple yes/no test because it lets you get right up to the edge. What I did once upon a time was to loop through all the non-zero tiles on the screen, and for each edge of the tile, figure out the x/y coordinates of the line that represented that edge. Then calculate the line segment from the current position to next frame position of the ball, and see if these intersect. (Edit: This can be optimized by only looking at tiles which are near to the ball. You can also eliminate half the edges by paying attention to the velocity of the ball. if it's traveling right, you only need to check the left edges of tiles, and so on.)

As for classes, it's really not necessary to make it fully OOP, but it wouldn't hurt to learn how to make a proper OOP project. I would at least have a class for the paddle or "Vaus", maybe one for user input cause you want to store the state of the input devices every time you get an input event from SFML, and probably one for the map. If you can manage to display a basic tile map I think you'll start figuring the rest of it out from there. Good luck! [img]http://public.gamedev.net//public/style_emoticons/default/smile.png[/img] Edited by DFPercush
1

Share this post


Link to post
Share on other sites
Thanks guys! You gave me some really good advice's. I don't use forum very much (I made only 6 posts or so) But from now I'm going to use it more often :)
2

Share this post


Link to post
Share on other sites

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  
Followers 0