Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Using an API(SFML), early on in the learning process.  (Read 5357 times)

0 Members and 1 Guest are viewing this topic.

omfgkittens

  • Newbie
  • *
  • Posts: 3
    • View Profile
Using an API(SFML), early on in the learning process.
« on: March 13, 2013, 10:34:52 pm »
Evening SFML Community!

For the past month or two I've been doing my best in learning C++ (and programming in general for that matter). While I'm starting to get the fundamentals down fairly well, I'm well aware that I've just seen the tip of the iceberg that is programming and C++.
    This morning I started playing around with SFML, just basic stuff, movement and collision and stuff like that. I found it a great deal of fun with a break from console programs and I found the very detailed documentation to be of tremendous help. However I'm wondering if introducing an API this early on might act more as a source of confusion and actually hinder and slow down my learning.
   So, to the actual question. What's your experience and/or opinions on using an API such as SFML while still learning the basics of programming? Would I be better of focusing more on the core concepts of C++?
   I know this is a very vague question, but please any input would be helpful.

Thanks in advance(sorry for the possible broken English)

- omfgkittens

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: Using an API(SFML), early on in the learning process.
« Reply #1 on: March 13, 2013, 11:17:37 pm »
The danger of taking a look at SFML so early is that you get fascinated by game programming and neglect C++ itself. SFML is quite beginner-friendly, but to use it efficiently, you still need to have knowledge of advanced C++ concepts. It is possible to achieve cool stuff with few C++ knowledge, but your applications are likelier to have bugs and run slowly and unstable.

If you know the basics (control structures, functions, classes, pointers), you can approach SFML. But I recommend to continue learning C++ steadily. Some very important concepts that are not treated in many books are RAII (or how to avoid manual memory management), templates, and the STL with its containers, iterators and algorithms. Also C++11 becomes more and more important, but most of it concerns advanced topics anyway.

In any case, you should have a good C++ book. Unfortunately, there is a lot of bad literature, a good list can be found here. Note also that after learning the basics, you should take a look at a book teaching good C++ practices like Meyer's Effective C++. By applying the read knowledge in your projects, you also get practical experience, which is a very important part too.

And don't look at other's game code, except you know it's really well written. Unfortunately, many game programmers use an awful C++, based on antiquated techniques, myths and plain wrong understanding. They eventually still create good games, but they develop longer, debug longer and maintainance is a bigger pain. SFML is a notable exception, it is one of the best designed C++ libraries I have ever encountered.
« Last Edit: March 13, 2013, 11:19:41 pm by Nexus »
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

omfgkittens

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Using an API(SFML), early on in the learning process.
« Reply #2 on: March 13, 2013, 11:38:06 pm »
Thanks for the very detailed answer Nexus!

I'm currently working my way through C++ Primer fifth edition (Which seems to come highly recommended  across boards in terms of teaching good C++ standards, as well as incorporating C++11). Effective C++ is in fact next on my reading list.

I guess SFML's beginner-friendliness can be a double-edged sword.

Ones again, thanks for shedding some very needed light on the area and confirming some of my fears regarding premature exposure to API's!

firefly2442

  • Newbie
  • *
  • Posts: 23
    • View Profile
Re: Using an API(SFML), early on in the learning process.
« Reply #3 on: March 14, 2013, 06:00:39 pm »
Thinking in C++ is pretty good as a book/resource:

http://www.mindviewinc.com/Books/downloads.html

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11034
    • View Profile
    • development blog
    • Email
Re: Using an API(SFML), early on in the learning process.
« Reply #4 on: March 14, 2013, 06:13:42 pm »
Thinking in C++ is pretty good as a book/resource:
http://www.mindviewinc.com/Books/downloads.html
I'm not familiar with the book, but I just took a very quick peak and it seems to contain quite a few examples and can thus be useful, I think specially for people, who can't afford those ~$42 for C++ Primer.
But if you have some spare money (or can convince your parents or whoever) to get C++ Primer, it's definitely worth it. It's very uptodate (August 2012 vs December 2003), takes C++11 into account and is maintained by some notable authors. Though I guess it's not the best book to start with, since it's quite complex and covers some good depth.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

omfgkittens

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: Using an API(SFML), early on in the learning process.
« Reply #5 on: March 14, 2013, 09:14:05 pm »
For someone like me with very little programming experience, C++ Primer has been fairly in depth on the basics given that the first 400ish pages covers the fundamentals. It also seems to expect no prior programming experience.
But like you pointed out eXpl0it3r it can be quite expensive( long live used book stores! )

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Re: Using an API(SFML), early on in the learning process.
« Reply #6 on: April 12, 2013, 07:36:50 pm »
I had this idea early on in my c++ career for using sfml 1.6 with every application. Short answer, I would recommend no. As nexus pointed out it draws away from more c++ aspects and pushes you toward a subject you have yet to learn the basics of. Use the good 'ol console until you feel you have built up enough knowledge on the language to start using API's