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
15 replies to this topic

#1 darmani2   Members   

116
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   

44366
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   

116
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   

8723
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   

283
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   

116
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   

129
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.


#13 Cwhizard   Members   

99
Like
0Likes
Like

Posted Yesterday, 03:48 PM

C/C++ is the best language to learn as a first language.  It shares concepts and keywords with most other high level languages such as C#, Java, Javascript, etc.  Learning it first makes learning those other languages easier, but not necessarily the other way around.  C# is simpler for beginners to avoid mistakes, because it wipes your butt for you a lot, but it also encourages, or at least fails to discourage, bad programming habits, like the infamous failure to deallocate memory and other resources.  It also doesn't really bring anything to the table that I have seen.  Admittedly I've only been using it sporadically for a couple years now, and mostly just for writing scripts in Space Engineers.  Everything I write professionally is in C++ or assembly.  

 

What framework you use is entirely up to personal taste.  Frameworks change more often than the weather, and what is popular today might be deprecated a few years from now.  Understand that I'm coming from 35 years of programming. My first game was written in GW-BASIC (Nuclear Bomber) and everything was line art and sprites.  When I started serious (non-game) programming, DOOM (the original) and Castle Wolfenstein (the Original) were the epitome of high end game development, raster operations where done by the CPU, most of which didn't even have floating point units, graphics cards were little more than VRAM and a DAC.  Over the years I've seen hundreds of frameworks come and go, and even a few languages, but C++ has stuck around.  So I'm not basing my suggestion on some entrenched elitism.  C++ is here to stay.  It has everything a language truly needs and 50+ years of history.  You will never regret learning C++ as your first language.  



#14 Lactose   GDNet+   

11073
Like
1Likes
Like

Posted Yesterday, 03:51 PM

C/C++ is the best language to learn as a first language.
 

Highly debatable. It's worth mentioning that the FAQ we tend to guide beginners to advocates against C++ as a first language: https://www.gamedev.net/reference/faq.php/_/for-beginners-r1


Hello to all my stalkers.

#15 ApochPiQ   Moderators   

22654
Like
1Likes
Like

Posted Yesterday, 10:18 PM

C/C++ is the best language to learn as a first language.  It shares concepts and keywords with most other high level languages such as C#, Java, Javascript, etc.  Learning it first makes learning those other languages easier, but not necessarily the other way around.  C# is simpler for beginners to avoid mistakes, because it wipes your butt for you a lot, but it also encourages, or at least fails to discourage, bad programming habits, like the infamous failure to deallocate memory and other resources.  It also doesn't really bring anything to the table that I have seen.  Admittedly I've only been using it sporadically for a couple years now, and mostly just for writing scripts in Space Engineers.  Everything I write professionally is in C++ or assembly.  
 
What framework you use is entirely up to personal taste.  Frameworks change more often than the weather, and what is popular today might be deprecated a few years from now.  Understand that I'm coming from 35 years of programming. My first game was written in GW-BASIC (Nuclear Bomber) and everything was line art and sprites.  When I started serious (non-game) programming, DOOM (the original) and Castle Wolfenstein (the Original) were the epitome of high end game development, raster operations where done by the CPU, most of which didn't even have floating point units, graphics cards were little more than VRAM and a DAC.  Over the years I've seen hundreds of frameworks come and go, and even a few languages, but C++ has stuck around.  So I'm not basing my suggestion on some entrenched elitism.  C++ is here to stay.  It has everything a language truly needs and 50+ years of history.  You will never regret learning C++ as your first language.

  • There is no language called "C/C++". There is C, and there is C++, and if you can't name ten differences between the two off the top of your head, you know neither well enough to recommend languages to anyone.
  • Sharing "concepts" and "keywords" is less than meaningless in this context. Python has some keywords that overlap with C++. Intercal has some concepts that overlap with C++. All three are vastly different languages.
  • Learning programming and learning C++ is a tall order. Learning programming in a more forgiving environment and then diving into C or C++ is much more gentle. This ground is so well-trodden on GDNet that we have a FAQ about it, linked above.
  • The fact that you have to try really hard to even make mistakes like memory leaks in C# is a powerful reason to embrace it; C# - like most modern languages - goes out of its way to make it difficult or even impossible to make certain categories of programming errors. It isn't "wiping your butt" and that language is frankly condescending and borderline offensive.
  • C# is actually responsible for popularizing a lot of modern programming concepts: generics without type erasure (c.f. Java), first class functions, concurrent garbage collection, LINQ... the list goes on. Even things that C# did not "invent" it did a lot to drive forward into mass adoption.
  • If you haven't done professional or even non-trivial programming in C#, why are you advocating against it? By your own statement you don't know the language well enough to make that value judgment for yourself let alone for an impressionable beginner.
C++ is a roaring dumpster fire of a language that was barely saved from extinction by C++11 and C++14. The existence of better languages is largely what has motivated its slow crawl away from stagnant extinction in the past decade. It hardly has "everything" and yet some would even argue it has far too much.

It also doesn't have "50 years of history" unless you count all of its predecessors (C, BCPL, etc.) and even that's tenuous at best.

It's fine if you like the language, but please keep in mind that your personal taste is not objective truth, and what you like is not necessarily the right thing to recommend to a beginner.


[edit]
Oh, and Wolfenstein 3D was not the "original" Wolfenstein game. That honor goes to, well, Castle Wolfenstein, originally on the Apple II.

Edited by ApochPiQ, Yesterday, 10:24 PM.
Afterthought

Wielder of the Sacred Wands
[Work - ArenaNet] [Epoch Language] [Scribblings]

#16 GibbonThatCodes   Members   

283
Like
0Likes
Like

Posted Today, 02:07 AM

I wouldnt really call C++ a roaring dumpster fire .. but thats probably because I love it as a language, was the language I started out with all of like a decade ago now. It's not the worst language to start out programming with because as mentioned it really does leave a lot of ways open for you to fuck up so you either end up with poorly made programs or you improve your coding standard fairly fast.

I would say that a transition from a C# programmer would probably be harder than the other way round obviously, though C# is a pretty decent language and it would introduce the key areas without frowning you in "oh god I need to be super careful on my code".

I would still say that learning C++ first is the proper "trial by fire" .. heh "trial by roaring dumpster fire" way to learn programming. Though it wouldnt be suited to everyone.