Beginners Observation: Fundamental Lack of Source Code Examples?

Started by
20 comments, last by The Gamemaster 9 years, 7 months ago

Greetings All.

After a few months of searching the web and this site, I wanted to share my observation as a beginner to graphics programming. So, without further ado, here I go:

FYI: This is not meant with any animosity. It is offered more as a report on the current state as seen, offered in the dry 'Dragnet' voice of, "Just the facts, Ma'am."

There should be concrete examples in the 'Beginner's Resources.'

Like the human genome, I don't believe 'Best Implementation Examples' should be patented or relegated to super-secrecy. Yes, you're not going to learn anything if all you do is cut-and-paste; but, if you're like me, who takes a piece of code and breaks it apart to fully grasp it, then us 'Noobs' would not be filling the forum with so many questions. A case in point would be Input. When I began a few months back, I was trying to tackle Direct Input. I should have been spending my time on RAW Input instead. I realized my mistake recently while reading through these forums. Here's an example which should be in the beginner's resource Designing a Robust Input Handling System for Games, by ApochPiQ. At least, it should be there if the off-site source code was explained a bit more clearly. I understand enough to know that, following this example would vastly improve my knowledge of how a game engine interacts with different aspects of my game, simply through the Input system.

There is a vast amount of code going on under the hood just to get the graphics up and running. I keep seeing people referred back to the DirectX SDK for examples which is fine if dealing with anything other than DirectX itself. These examples can be confusing because they're bare bones and don't fully implement error-checking. I started learning with the Rastertek DirectX 10 tutorials. Finally, when I started onto DirectX 11, I stumbled on Chuck Walbourn's blog which gave references to the new dxerror files you need to download and use. Although I might not have found it yet, there should be source code available in the beginner's resources or DirectX, for a solid implementation that includes feature checks, device capability, error-handling, lost-device, and properly switching between windowed and full-screen modes. Once all this stuff is in place, everything then comes down to the actual graphics programming. And, when the beginning programmer has the ability to get input from the user, any further questions would then be on dealing with specific graphics related items.

Of course, I'd love to see a good implementation for handling and or creating entities such as sprites with different AI, etc.

My whole point, really, is that a few solid source examples in these areas, would save a great deal of time searching for articles that may or may not supply code that actually works. Beginners need a solid foundation, and good coding practices. Example code that can be built upon is extremely valuable. I know that on multiple occasions, I've followed along with book code examples only to learn after 4 hours that it doesn't compile. What did I learn from that? I'm sure much of it was workable, but in the end, I had to throw it all out and start over.

Peace!

If there is sufficient feedback to this post with useful suggestions, I will put them all together into an article to cover those topics. I, for one, am still trying to get all this together myself. I'll make the time to offer both DirectX 9 and DirectX 11 full implementations (I mean the checking, error-handling, etc,.. not the installer portion).

Advertisement

I don't believe 'Best Implementation Examples' should be patented or relegated to super-secrecy.

Well, the issue is, that they do not exist. Once you are knee deep into development, you will understand, that there isn't anything like the 'best solution to solve problem <x>', other then some standards (like A*) which has already been docuement all over the internet and wiki.

The second problem is, that as experienced developer, you can only provide one of many working (not necessarily good) solutions, often limited by a NDA if you work in the game industry (a working solution embedded in a game is often not your property and you are not allowed to distribute it).

The third problem is, that your solution is often embedded in a quite complex program which will most likely not help any noob at all. A week ago someone asked me to show off my behavior tree implementation. Even if I have provided my 5000 lines of code, it would communicate with so many other sub-systems, that a noob coder would most likely not understand a single piece of code.

Well, as experienced coder, the best option would be to write dedicated example code (lot of unpaid work!) or to provide some of your knowledge in a forum.


... (a working solution embedded in a game is often not your property and you are not allowed to distribute it).

I understand about the property rights, I just disagree about its usage. In my case, if I uploaded a 'Metallica' mpeg onto a secret computer, then only until a Security Officer verified that this was not indeed 'Secret' and reclassified it, that mpeg would be considered 'Secret'. Stupid-right?


Well, as experienced coder then best chance would be to write dedicated example code (lot of unpaid work!) or provide some of your knowledge in a forum.

I'd love to collaborate on some of the examples. The only reason I didn't start with an article at first, was that I haven't solved some of these issues... like the switching between windowed and full-screen that properly resizes the buffers. I didn't want to fill this up with a bunch of code that wasn't worked out yet.

*snip*

The fourth issue is that you got a lot of (rightfully) concerned professionals who discourage you from teaching openly and freely to beginners, because of the potential for learning what later needs to be unlearn. With a certain level of critical thinking, this becomes a non-concern (because critical thinkers know how to follow up on sources) a but, regretfully in our world of reverence of authority over science, those professionals to often end up being correct.

Oh well, my two cents.


The fourth issue is that you got a lot of (rightfully) paranoid professionals who discourage anyone from teaching openly and freely to beginners, because they're afraid that the beginners will somehow learn a bunch of stuff that they'll later have to unlearn. With a certain level of critical thinking, this becomes a complete non-issue but, regretfully in our world of ignorance, those professionals to often end up being correct.

Oh, sad but true. Why should knowledge that benefits all of mankind be secreted away? I agree with paying an instructor for his time, but I don't believe I should have to pay for courses at a college/ university if I've already learned the subject. I should be able to challenge it and if need-be, pay the accreditation cost. The same thing applies to school text books teaching the same stuff that is open-source. Somebody is making money here and it sure isn't the student, and rarely the teacher.

I will freely share what I learn after I get it into a more cohesive form. Now, if only we can find some more open-minded professionals.

Specially on graphics programming. There is just so much stuff you have to learn before even starting to worry about how many draw calls are you making, how often you change state around and how the rest of the game communicates with the render system .

In most things at least, you can (should) learn basics first, then start to ask around how to make them fit in a bigger system, which is a whole issue on its own. Once you separate those two steps, you can learn new things in a more efficient manner (ie, first make them work, then make them fit).

"I AM ZE EMPRAH OPENGL 3.3 THE CORE, I DEMAND FROM THEE ZE SHADERZ AND MATRIXEZ"

My journals: dustArtemis ECS framework and Making a Terrain Generator

Question on How to Proceed?

Should I start an Article and have a massive amount of updates/revisions to be referred to?

Or...

Should I start another Forum Topic with the code that needs to be revised through collaboration?


Should I start another Forum Topic with the code... [emphasis mine]

Perhaps more difficult than simply posting a topic.

Your topic indicates you're interested only in C++ and DirectX. DirectX 9.0c with the June 2010 SDK? Direct3D 11? DirectInput, RAW or just windows messages for input? D3DX, XM or SimpleMath? Visual Studio IDE only?

When those decisions have been made, then another topic will be opened - "Why aren't there examples for my setup?" wink.png

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.


Your topic indicates you're interested only in C++ and DirectX. DirectX 9.0c with the June 2010 SDK? Direct3D 11? DirectInput, RAW or just windows messages for input? D3DX, XM or SimpleMath? Visual Studio IDE only?

I just put a caveat at the top of my post to explain that it's more of a Dragnet style voice for the report... no animosity intended.

In this topic I was speaking more in the general sense which applies to all versions of DirectX.

C++, Direct3D 11, and RAW input since MSDN does not recommend Direct Input for mouse and keyboard. Also, before I even attempt it, I need to decipher ApochPiQ's source code for robust input handling. I had started out with DirectX 10 and 9.0c and had the Direct Input working, but I realized that since DX11 supports windows 7, there was no reason I shouldn't take full advantage of all the new features, math included, by learning version 11. I own a copy of VS2010 pro, but to fully take advantage of the new items, I grabbed a copy of VS2013 Express Update 3 for Desktop. Yes, I am using the DirectXTK.


(ie, first make them work, then make them fit).

Exactly!

I'm coming into this from the Animation side where I want to insure proper 'tweening' and set those ease-in and ease-out of keyframes in a coded environment. Coding is a lot more difficult than I anticipated... but I refuse to give up. Once I can get them working like a proof of concept, I can then delve into the coding needed to make it all fit together. Hardest part is keeping a clear and ordered path to learning.

This topic is closed to new replies.

Advertisement