Jump to content

View more

Image of the Day

Adding some finishing touches...
Follow us for more
#screenshotsaturday #indiedev... by #MakeGoodGames https://t.co/Otbwywbm3a
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Is starting with gamedev too much?

4: Adsense
  • You cannot reply to this topic
11 replies to this topic

#1 darmani2   Members   

115
Like
2Likes
Like

Posted 11 May 2017 - 05:01 PM

So i wanted to learn programming and got myself a nice C++ book because that seems to be the language where i can realize most of the things i wanted to do. (Things like emulation programming). I read the book, understood most of the concepts and got myself pretty comfortable in C++ (still a beginner though). So after finishing the book, i wanted to get really good with the language before i dive into reverse engineering/assembler and such things, so some people recommended to learn a nice framework as the next step. So i chose to learn SFML as my next step and make some games with it (also really interested in gamedevelopment). I read the rather short tutorials on their website and was able to make my first game within a day. Even though it was just a pong clone i had so much fun doing it so i bought myself a SFML book. This one to be precise https://www.amazon.com/SFML-Game-Development-Jan-Haller/dp/1849696845 

The first chapter was still easy to understand but by the second chapter already, where the author talked about Resource Management, i couldnt follow it anymore. He used concepts i never heard of such as unique pointers for example. 

So my question is, should i learn something else entirely to get better in C++, learn something even easier than SFML for game dev. or even a complete different laguage? I would like to stay at game development at first, because making games seems to be a really fun process where you learn alot. 

 

 

 



#2 Awoken   Members   

1075
Like
0Likes
Like

Posted 11 May 2017 - 06:45 PM

Hi, I don't know if I can offer the best answer, someone on these boards will no doubt be better educated to answer your question, but from my understanding c++ gives you tremendous power to develop software specific to a particular system.  So the pointers you've mentioned I think are more the nitty gritty of what C++ can do.  It's there if you really reeeally need it but isn't necessary to game development.  What do others think?  am I out to lunch on this one?



#3 frob   Moderators   

44324
Like
4Likes
Like

Posted 11 May 2017 - 06:58 PM

If you can handle the learning curve c++ is a great language. It is popular in games because among today's languages it is the best for systems-level work. Learning other languages will give you new perspectives, and as you learn more computer languages you gain new insights. In addition to giving more ideas for leveraging languages you know, it also makes it easier to learn new languages in the future.

None of the options you mentioned are bad. SFML or not if you wish, C++ or another if you wish.

Once programmers have a good grasp on C++, C#, Java, Python, JavaScript, and a few others, my recommendation is to learn about one a year. Until you've got those, I'd recommend any of those languages. Python and C# have the easiest learning curves, but you should get comfortable with all of them.

Check out my book, Game Development with Unity, aimed at beginners who want to build fun games fast.

Also check out my personal website at bryanwagstaff.com, where I occasionally write about assorted stuff.


#4 darmani2   Members   

115
Like
0Likes
Like

Posted 11 May 2017 - 09:40 PM

Thanks for the answers :)

Hi, I don't know if I can offer the best answer, someone on these boards will no doubt be better educated to answer your question, but from my understanding c++ gives you tremendous power to develop software specific to a particular system.  So the pointers you've mentioned I think are more the nitty gritty of what C++ can do.  It's there if you really reeeally need it but isn't necessary to game development.  What do others think?  am I out to lunch on this one?

I never looked at it like that, always thought everything i read in a book is super important



#5 Khatharr   Members   

8720
Like
2Likes
Like

Posted 12 May 2017 - 12:38 AM

std::unique_ptr allows you to create a pointer that will delete its contents when it leaves scope. It's found in the <memory> header.

One of the most common errors in C and C++ programming is called a "memory leak". This is a case where you allocate memory for an object and then forget to release the allocation after you're done using it. Apart from simple forgetfulness, there are a significant number of "gotcha" situations where it may seem like you're releasing the allocation, but the program's path of execution doesn't reach that point for one reason or another.

Rather than expending more and more resources trying to teach programmers to do something that's simply not easy for humans to do correctly, we have come to rely on design patterns that make common bugs like this either impossible to commit or else obvious and easily identified when they occur. In the case of memory leaks the answer is smart pointers.

std::unique_ptr is for sole ownership of an allocation. It can't be copied as it is not intended to be copied, so it defends its ownership. If you want shared ownership (note: this is usually a mistake) you can use std::shared_ptr<>, which allows itself to be copied and doesn't release its resource until all the copies for that resource are destroyed.

Here's an example for unique_ptr

#include <iostream>
#include <memory>

struct Derp {
  Derp(int val) {
    a = val;
    b = a + 1;
    c = b + 1;
  }

  int a, b, c;
};

int main() {
  std::unique_ptr<Derp> derp; //this is a pointer to a Derp - the initial value is nullptr

  derp = std::make_unique<Derp>(1); //use std::make_unique<>() to safely allocate and pass constructor arguments

  std::cout << derp->a << ":" << derp->b << ":" << derp->c << "\n"; //you can dereference the smart pointer as if it were a raw pointer

} //when the object leaves scope it will delete the allocation automatically

It would be worth your while to check out http://en.cppreference.com/w/cpp/memory/unique_ptr.

You may also want to take a look at other common STL objects such as std::string and std::vector.


void hurrrrrrrr() {__asm sub [ebp+4],5;}

There are ten kinds of people in this world: those who understand binary and those who don't.

#6 _Silence_   Members   

881
Like
0Likes
Like

Posted 12 May 2017 - 12:40 AM

If when reading your first book about C++, you haven't read anything about unique pointer or such, then your book might be old, or it might not cover the standard library.

Then I suggest you to move to a book talking about the C++ standard library. A recent one (which should cover C++ 11 at least). This one should cover all concepts/practices modern C++ programming should go along with, but which might not be covered by a book talking only about the language.



#7 GibbonThatCodes   Members   

278
Like
0Likes
Like

Posted 12 May 2017 - 02:12 AM

Well, speaking from my own experience, the first thing I did with programming was decide "I want to make make games" so picked up some books focused on games programming in C++. Realistically, the very starter books were just intros to programming / programming concepts with a "game" theme.

I would say that jumping straight into C++ can be a great, and very fun experience, but it will require finding the right books / style of learning for you. There are some books I just dont get along with, so if you have the budget I would say buy a few different books to give yourself different writing styles / teaching methods.

And as mentioned above, make sure the books are up to date, most will state C++11 etc on them so you can see which ones will be using the newer features of the language. The only time this is slightly less relevant is when you have a decent amount of experience and are looking for books on certain topics where you would be able to easily adapt the code examples to use the newer features yourself.



#8 Neometron   Members   

595
Like
0Likes
Like

Posted 12 May 2017 - 02:49 AM

Oh I remember the days when I first learned c/c++ over a high school summer break. I also grabbed a book on making video game during that time. I had to learn how to make a c/c++ game using vga's modex. I still have that book on my book shelf, ripped in two down the spine, and I just paged through it after reading the original post. In my opinion; SFML is metaphorically like programming for dos. Make some system calls here and there to setup your graphics, sound, and input and then make some library calls to render some geometry after some processing in your main loop. My two cents here is to say go for it!

Since it was mentioned that emu programming is a driving aspiration to learn; I suggest my favorite starter book here, because the author really simplifies the explanation on how to build a computer literally from relays and transistors. I think that would guide you towards understanding how computers truly work.
 



#9 darmani2   Members   

115
Like
0Likes
Like

Posted 12 May 2017 - 07:38 AM

Since it was mentioned that emu programming is a driving aspiration to learn; I suggest my favorite starter book here, because the author really simplifies the explanation on how to build a computer literally from relays and transistors. I think that would guide you towards understanding how computers truly work.


Looks like a really interesting book, but im studying technical computer science so i have a bit of knowledge about that already :P
 

If when reading your first book about C++, you haven't read anything about unique pointer or such, then your book might be old, or it might not cover the standard library.

 
Yea the book is rather old, its was written in 2008/9 or something and i bought it when i was 14 or 15. Never really finished it until recently.



#10 Lucas_Cage   Members   

128
Like
1Likes
Like

Posted 17 May 2017 - 04:31 PM

C++ can be a rough road. I took two semesters of the language in college and foud it to be a fun challenge. When it comes to C or C++ I always tell people to look at their end goal and ask a question. Is there a more modern language I can use to achieve my goal? If the answer is yes then use that language. The biggest learning curve is on your first language if you have learned the basics of programming in C++ then interpreting those concepts in modern day languages isn't likely to pose the same challenge as your initial experience.

The simple fact is that you are the artist l. Languages, libraries and frameworks are tools. Always choose the most efficient tools that will allow you to express your vision.

The Quarry Works Creed

We who shape mere stone must always envision cathedrals


#11 the incredible smoker   Members   

499
Like
1Likes
Like

Posted 19 May 2017 - 08:49 AM

It is easy, only what do you want : something windows ?, that is more difficult, alot to learn.

Get your project where you can program in, and forget all the windows codes, later you can adjust.

Dont forget, test every aspect, add small things and test and fix before adding big things, testing cost more time then programming.


S T O P   C R I M E !

Visual Pro 2005 C++ DX9 Cubase VST 3.70  Working on : LevelContainer class & LevelEditor


#12 Asik   Members   

171
Like
1Likes
Like

Posted 19 May 2017 - 10:58 AM

unique_ptr is one of many C++-specific concepts you will have to learn. It's definitely a difficult language to start with; you'd have a far easier time with Python for example. And it's not like Python's limitations would be an issue for you anytime soon; you can write great games and even emulators in it if you want. By the time you're advanced enough to run into some of its limitations, you'll be in a great position to decide where to go from there and whether that's C++ or something else.


Edited by Asik, 19 May 2017 - 10:59 AM.