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

Author Topic: How much do you need to know to create something like SFML?  (Read 7687 times)

0 Members and 1 Guest are viewing this topic.

ineed.help

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
As a new programmer, I've been overwhelmed by the ridiculous complexity of modern PCs. Just writing code in your average high-level language with someone else's API is easy enough, but I've been asking myself the question of how much do you really need to know to create something like SFML? Do you have to know how all the transistors in the PC works? (Sorry if I sound amateurish, but I am an amateur.)

This question is specifically addressed to SFML's creator, but if someone with his level of knowledge regarding the subject has an answer for me, that's fine, too.

ChronicRat

  • Sr. Member
  • ****
  • Posts: 327
  • C++ programmer
    • View Profile
    • My blog
Re: How much do you need to know to create something like SFML?
« Reply #1 on: June 02, 2014, 05:49:56 pm »
You need not to know but learn. No one can just create Doom without any experience. Start from simple console "guess number", write your own "crosses and zeroes" in text mode, then convert it to graphics mode.

zsbzsb

  • Hero Member
  • *****
  • Posts: 1409
  • Active Maintainer of CSFML/SFML.NET
    • View Profile
    • My little corner...
    • Email
Re: How much do you need to know to create something like SFML?
« Reply #2 on: June 02, 2014, 06:08:13 pm »
TL:DR - programmers use abstractions and "black boxes" all the time when coding, so to write something like SFML you do not need to understand every single level of a computer.

Well this is a really good question, but I think it boils down the concept of abstraction. It is impossible to know everything about computers, let alone the entire universe... But you live every day in a world you do not fully understand and are able to get along quite nicely. Think of food, you know when you eat food that it is going to nourish you and sustain your body - yet you do not really understand how exactly your body breaks that food down into energy or even how your body utilizes that energy. This is also called a "black-box", you know how to eat food, but not exactly how your body uses it.

Now the same concept of abstraction/"black box" is applied to computer programming. There is no way a single person could ever know everything about a computer and this is a good thing. This is exactly why if you want to work with computers you should focus on a specific area. If you want to know how the hardware works then you can play with bread boards all day long. But if you want to be a programmer then you focus on the software side and just take the hardware as a "black box" meaning you assume it will work. A quote that goes with this is "ignorance is bliss" meaning that not knowing something can actually help what you are doing. However it can go both ways, not knowing something could also possibly cause you to make a mistake - that is where APIs like SFML come in, they abstract away the concepts of lower level graphics programming so that it can be used as a "black box". The same goes for compilers, do you need to actually understand how a compiler converts C++ code to machine language to write code? In most cases you don't need to know how it does what it does, just how to utilize it and make it do its job.

Sure it helps to have a good overview of how a computer works at different levels, but having intimate knowledge of the protocol that is used to transfer data from the hard drive to the cpu isn't needed. The same goes for SFML, internally SFML uses OpenGL for rendering so a good knowledge of OpenGL is what is needed to write SFML. You don't really need to know how OpenGL is implemented in the driver and what the driver uses to talk to the video card, you just need to know how OpenGL works. This is true when it comes to the window management, all you need to know is the platform specific functions for managing a window and then you can write a window manager. You don't need to know how the window manager actually manages the windows internally, all you need to know that it works.

Long wall of text, but if you made it this far all you need to know is that computer programming is built on top of abstractions built on top of other abstractions to make life easier at every single level. And to anyone new to programming, for now focus on understanding the APIs that you are working with. Treat them as a "black box" and assume them to work properly as you learn to program and maybe later you can delve into what makes XYZ library do what it does.
« Last Edit: June 02, 2014, 06:12:10 pm by zsbzsb »
Motion / MotionNET - Complete video / audio playback for SFML / SFML.NET

NetEXT - An SFML.NET Extension Library based on Thor

ineed.help

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: How much do you need to know to create something like SFML?
« Reply #3 on: June 02, 2014, 06:19:04 pm »
Thank you - I didn't know that SFML is written using OpenGL. It's good to know that you don't have to be a "genius" (by which I mean a person who is ridiculously focused, like Einstein) to program video games. However (and you might not be able to answer this), creating something like OpenGL must require intimate knowledge of how a computer works, right?

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: How much do you need to know to create something like SFML?
« Reply #4 on: June 02, 2014, 07:08:05 pm »
OpenGL is just a standard API for managing a graphics card. Each GPU fabricant then implements the OpenGL standard for their product, so it works in their cards as good as in all others. Obviously, it takes a really low-level knowledge of the hardware they created for it to work properly. Even so, they still get it wrong sometimes, and that's why they need to release new graphics drivers, in order for the OpenGL/DirectX API to function better.

Without pretty difficult reverse engineering or a clear specification sheet of the graphics hardware, I don't think a regular programmer could do it from home, something like OpenGL, and it still only would work in a single GPU or family of GPU's.. :)

ineed.help

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: How much do you need to know to create something like SFML?
« Reply #5 on: June 02, 2014, 07:35:49 pm »
Thanks; hearing that from someone experienced is nice, to be honest. ;)
« Last Edit: June 02, 2014, 07:41:15 pm by ineed.help »

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: How much do you need to know to create something like SFML?
« Reply #6 on: June 02, 2014, 08:49:44 pm »
In sum, making a game framework is just another layer of knowledge deeper than just knowing how to make games.

If you keep making nice games using a framework like SFML and/or others for enough time, you will be completely comfortable to take the next step and do a framework of your own if you dedicate enough time.

Though, I don't recommend doing that, I just recommend that you always focus on making the current game project with the best tools that are available to you. Only when there are no tools that you can afford or there are no tools that fit your task appropriately, then roll your own.

But please don't go and lose time creating a framework that brings nothing new to the scene. Its cool if you think you can provide some value to other developers or your studio, but otherwise its kind of wasted time. At least its what I think and many others in the industry :)

select_this

  • Full Member
  • ***
  • Posts: 130
  • Current mood: just ate a pinecone
    • View Profile
    • darrenferrie.com
Re: How much do you need to know to create something like SFML?
« Reply #7 on: June 02, 2014, 08:52:44 pm »
As one wise soul put it, "write games, not engines". Of course you'll benefit from knowing how things work and how they fit together, but it's something you can learn along the way.
Follow me on Twitter, why don'tcha? @select_this

Syntactic Fructose

  • Jr. Member
  • **
  • Posts: 80
  • Overflowing stacks and eating snacks
    • View Profile
Re: How much do you need to know to create something like SFML?
« Reply #8 on: June 02, 2014, 10:32:26 pm »
I wouldn't be too intimidated by how much you might need to know, with some perseverance and drive you could tackle SFML pretty quickly as long as youre open to learning. I jumped into SFML after about 6 months of practicing with c++ and had a lot of trouble, but you'll easily figure out what you need to study more in depth. In my case it was C++  as laurent mentioned almost two years ago ;D :

Quote
Hmm... Don't you think you should learn C++ first? :P
« Last Edit: June 02, 2014, 10:36:04 pm by Syntactic Fructose »

ineed.help

  • Jr. Member
  • **
  • Posts: 56
    • View Profile
Re: How much do you need to know to create something like SFML?
« Reply #9 on: June 03, 2014, 10:04:26 am »
Quote
I wouldn't be too intimidated by how much you might need to know...
I'm talking about creating an API like SFML, which would require extensive knowledge of OpenGL, at least as far as two-dimensional graphics go, not just using SFML; that's not difficult, really, for the most part, thanks to its intuitivity.

Quote
But please don't go and lose time creating a framework that brings nothing new to the scene...
I wouldn't say that - it's experience, isn't it? If you can create the next RPG Maker (well, ???) you'll have that knowledge with you forever.
« Last Edit: June 03, 2014, 10:07:23 am by ineed.help »

Grimshaw

  • Hero Member
  • *****
  • Posts: 631
  • Nephilim SDK
    • View Profile
Re: How much do you need to know to create something like SFML?
« Reply #10 on: June 03, 2014, 10:08:02 am »
If you can make the next RPG Maker then you are bringing something new to the scene by definition. If you are only cloning RPG Maker you probably never get to the original's quality and get nowhere.

That's why I mentioned, do things as exercises and learn a lot, that is okay, but don't engage in making complex and time consuming software unless you know exactly what you are doing :)

Nexus

  • SFML Team
  • Hero Member
  • *****
  • Posts: 6287
  • Thor Developer
    • View Profile
    • Bromeon
Re: How much do you need to know to create something like SFML?
« Reply #11 on: June 03, 2014, 10:08:57 am »
I wouldn't say that - it's experience, isn't it? If you can create the next RPG Maker (well, ???) you'll have that knowledge with you forever.
Yes, everything you do helps getting experience, and for the first few things the project itself doesn't matter, because the code will usually be ugly enough that you can't use it productively anyway ;)

However, if you do something that has not already been there, the community interest will be higher, and you will get more feedback and other help.
Zloxx II: action platformer
Thor Library: particle systems, animations, dot products, ...
SFML Game Development:

select_this

  • Full Member
  • ***
  • Posts: 130
  • Current mood: just ate a pinecone
    • View Profile
    • darrenferrie.com
Re: How much do you need to know to create something like SFML?
« Reply #12 on: June 03, 2014, 10:24:00 am »
I used to be a part of the RPG Maker community in the 2k and 2k3 days. IIRC they've released futher versions since (remembering that awful 'pixel art is awesome' advert) but dunno how good they are at what they do.
Follow me on Twitter, why don'tcha? @select_this

Jesper Juhl

  • Hero Member
  • *****
  • Posts: 1405
    • View Profile
    • Email
Re: How much do you need to know to create something like SFML?
« Reply #13 on: June 03, 2014, 08:10:19 pm »
Nobody knows everything at every level.
To be productive in a given field you usually just need to know the abstractions you work with. A game programmer can get by just fine knowing just C++, SFML & STL (and relevant algorithms like A*) for example. A driver writer needs to know something about how to interact with the hardware she is driving but doesn't need to know verilog or similar.
We all work with abstractions and black boxes since it's impossible to be an expert all the way from the transistors to user-space programs.
Having said that, I also want to say that; a basic understanding of multiple layers can certainly be beneficial. Knowing a bit of asm and how your compiler optimizes your program is certainly useful sometimes. As is knowing a bit of operating system theory and implementation so words like page fault, elevator, page cache, scheduler etc are not just Mumbo-Jumbo. A little bit of hardware knowledge can also be useful - interpreting profiler results get a lot easier when you understand pipelining, branch prediction, cache hierarchies, store buffers, cache lines etc.

The best advice I can give is; learn a lot about the abstraction layer where you do most of your work and then try to learn just a bit about the layers below it - it'll help make things easier.

A book I can recommend if you are curious about the full stack is this: Computer Organization and Design: The Hardware / Software Interface - it's a very good read, explains everything very well from the basics of the hardware and up to user programs - well worth the money.
« Last Edit: June 03, 2014, 08:20:19 pm by Jesper Juhl »