• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
GraySnakeGenocide

Does anyone else struggle with problem solving?

23 posts in this topic

I understand what the syntax for the languages do, how to use them, etc.

Problem is. When it comes to solving a problem (ie making a simple console game of tic-tac-toe). I struggle to figure out HOW to solve it, like what variables, etc are needed. Is there a way around this? I have a book called "How to Think Like A Programmer". But is this really something I can work around?
2

Share this post


Link to post
Share on other sites
This mostly just comes with experience. When I started programming (which was well before the internet mind you), my solutions to solving problems were horrible. I had limited knowledge of HOW to solve the problems, so I solved them the only way I knew, which was massive global variables, goto's, and other ugly practices.

But, I kept working at it, kept reading books and I had a friend who programmed as well, and we would bounce ideas off each other (what the internet is good for these days). Eventually, i got better at it, learned new ways to solve problems, and I could make new things.

So, I'd say stick with it. It's not going to be easy, but eventually, things will start to "click" and you'll woner why you didn't think of that before. Good luck!
1

Share this post


Link to post
Share on other sites
When you're trying to come up with a solution to a problem, don't immediately start thinking in code.
Your code has to be a tool to implement your solution, not a tool to come up with a solution.

The first thing you should do when trying to solve a problem is breaking it down into smaller and more manageable sub-problems.
For tic-tac-toe you have several simple aspects: You'll require a representation of your game board and a way to manage your game logic (ie. managing who's turn it is, checking for winning conditions, etc.)

A potential breakdown for a game board could look something like this:
-You need a game board, containing 9 squares. This means you'll need:
-A way to represent a square. Each square can hold 2 values, so you'll potentially need:
-A simple structure which can represent these values

So now you have a very basic and manageable overview of what you need to implement for a visual representation of tic-tac-toe.
Now you can do a similar breakdown for your game logic aspects.

Once you have these two major aspects figured out you'll have a complete overview of your program. Now you can start thinking about how you want to implement your solutions in your language of choice.
2

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354216665' post='5005410']
I struggle to figure out HOW to solve it, like what variables, etc are needed.
[/quote]

I find this common lament kinda odd. I never have run into this. I never really have problems thinking about how a syntax element might be used to solve problems... Granted, what I come up with (especially starting out) isn't always the best or most practical solution for things but it's a solution.

I dunno... did I just play with too many Lego's as a child?
1

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354216665' post='5005410']
I understand what the syntax for the languages do, how to use them, etc.

Problem is. When it comes to solving a problem (ie making a simple console game of tic-tac-toe). I struggle to figure out HOW to solve it, like what variables, etc are needed. Is there a way around this? I have a book called "How to Think Like A Programmer". But is this really something I can work around?
[/quote]

Problemsolving is what programming is all about, the language is just a tool you use to express your solution.
You get better at problemsolving with practice, (start with simple problems and work your way up).
The key to solving all big problems is to break them down into smaller, more managable problems.
1

Share this post


Link to post
Share on other sites
[quote name='Telastyn' timestamp='1354219904' post='5005430']
did I just play with too many Lego's as a child?
[/quote]
Impossible.

And I think your progression is a textbook process for skill advancement and experience programming: new programmers rapidly learn how to use the tools, but their solution is brute-force or inelegant and often resource-wasteful. The more practice (with a paradigm or problem domain) the better the solutions become. Just like a pianist knows how to hit the keys, but a beginner's music sounds all clunky and off compared to a master.

OP: it just takes time and practice. But mostly practice. If you're not attempting solutions and writing code, you're not making any headway.
1

Share this post


Link to post
Share on other sites
I'll keep at it. I just switched back over to C++ after a couple years learning C# (for XNA). I just recently (read: about 8 months ago) started understanding C# finally, and now things click easy (thank you Head First C#).

But with XNA being all but dead. I feel it's best to stick with C++ from now on, then eventually learn OpenGL/Direct X, and whatever else I need to start making simple games. But first I gotta start making sure I can solve these problems I face. The syntax/language is a non-issue.
0

Share this post


Link to post
Share on other sites
Do you have the free time to enroll in a Data Structures or Algorithms class at a local college? Once you know what all the tools in the tool-box do, its easier to pick the right ones to solve problems.
1

Share this post


Link to post
Share on other sites
[quote name='Steve_Segreto' timestamp='1354233618' post='5005505']
Do you have the free time to enroll in a Data Structures or Algorithms class at a local college? Once you know what all the tools in the tool-box do, its easier to pick the right ones to solve problems.
[/quote]

I plan to go to a University here soon, I just need to see if they'd have the right classes.
1

Share this post


Link to post
Share on other sites
[quote name='alnite' timestamp='1354240401' post='5005533']
I find this a problem common among beginners. If I give you code, you can understand the process and what the code does. But if I tell you to write a brand new code from scratch, you are stuck right from the beginning. Did I run into this when I first started? I don't remember. But I see this all the time.

The era of the Internet today makes it easy to copy and download code snippets, which encourages lazy thinking. You see this all the time on blogs. People would comment "Code doesn't work! HELP! HOW DO I FIX!?!?". And this is coming from using a simple code how to convert a file to a string object, for example. I'm not pointing out that the code doesn't work, but I'm pointing out the sheer laziness in people that they expect things to fall on their lap and work. When things not operating the way they expected, they don't bother to find the solution themselves.

It only comes from experience, and it has to be the right experience. Always write code from scratch. It's okay to look at code from web, but only as a reference, not meant to be copied directly to your code. 90% of the time that code won't be compatible to your code anyway. Never, ever, copy-paste and use code you get from web, conferences, CDs, or anywhere else. It's okay to use prepackaged libraries (like STL, SDL, Ogre, 3rd party libraries), the ones that you don't have to look at their code to use it.

How can a writer be a writer, if all he does is copy someone else's work? Programming the same way.
[/quote]

That's a main problem of mine.

For example, the Tic Tac Toe game, I keep trying to do it the exact way that the other guy does it, and I get stuck, and constantly refer back to his code to see what I am doing wrong. Not to mention whenever I try doing it by myself, I constantly think about that persons code. So I can never try it myself. Edited by Bill Fountaine
0

Share this post


Link to post
Share on other sites
You just have to break up a problem into smaller chunks. Go find a sheet of graph paper and get it out. Start drawing a flowchart of your game loop and its variables, start planning out your program. It really helps sometimes, and gets you motivated.
0

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354242306' post='5005539']
That's a main problem of mine.

For example, the Tic Tac Toe game, I keep trying to do it the exact way that the other guy does it, and I get stuck, and constantly refer back to his code to see what I am doing wrong. Not to mention whenever I try doing it by myself, I constantly think about that persons code. So I can never try it myself.
[/quote]

Then forbid yourself from looking at anyone else's code until you've completed your own. It's just like playing a game. You can play with a strategy guide your first time through, but you're just cheating yourself out of the accomplishment. Finish it once yourself and then look at the guide to see what you missed.
1

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354242306' post='5005539']
For example, the Tic Tac Toe game, I keep trying to do it the exact way that the other guy does it, and I get stuck, and constantly refer back to his code to see what I am doing wrong. Not to mention whenever I try doing it by myself, I constantly think about that persons code. So I can never try it myself.
[/quote]
[quote name='Khatharr' timestamp='1354244108' post='5005542']
Then forbid yourself from looking at anyone else's code until you've completed your own. It's just like playing a game. You can play with a strategy guide your first time through, but you're just cheating yourself out of the accomplishment. Finish it once yourself and then look at the guide to see what you missed.
[/quote]

^ This

When I was a beginner I did this too. I constantly looked at others code and thought "But this guy does it this way, isn't that a better solution..?" Well, maybe it [i]is[/i] a better solution, but it's not [i]your[/i] solution. As I realized that, I also realized how ugly my own code was, but it didn't matter, as long as I was the one who came up with the solution. The ugliness of the code goes away with practice. I'm not saying you shouldn't look at other peoples code, only that it's bad for your problem solving skills to do so.
1

Share this post


Link to post
Share on other sites
[quote name='Telastyn' timestamp='1354219904' post='5005430']
[quote name='Bill Fountaine' timestamp='1354216665' post='5005410']
I struggle to figure out HOW to solve it, like what variables, etc are needed.
[/quote]

I find this common lament kinda odd. I never have run into this. I never really have problems thinking about how a syntax element might be used to solve problems... Granted, what I come up with (especially starting out) isn't always the best or most practical solution for things but it's a solution.

I dunno... did I just play with too many Lego's as a child?
[/quote]
I think the problem is more in how do I express the solution I came up with, and that is a problem when you start programming, as you are learning how to program and how to express this problem at the same time.

If the problem is just how do I express a solution in my language Mathematical equations like Greatest Common Divisor, finding the zero points for quadratic equations and stuff like that is great to figure out how to express this in a language. The reason behind this is that maths already split these up into steps for you and you only have to express those in your language.
Working out the solutions for these equations and learning the algorithms involved on the other hand is a great way to learn how to divide problems in to more manageable chunks I found.

[quote name='Bill Fountaine' timestamp='1354242306' post='5005539']
That's a main problem of mine.

For example, the Tic Tac Toe game, I keep trying to do it the exact way that the other guy does it, and I get stuck, and constantly refer back to his code to see what I am doing wrong. Not to mention whenever I try doing it by myself, I constantly think about that persons code. So I can never try it myself.
[/quote]
It's not a problem to take code you find on the internet and use it, you just have to play with it until you actually understand what it is doing. From reading source code you get the major gist of how it is doing it's job, however what you usually don't get is what is the problem that this code is solving. When you start modifying it and it breaks and you start debugging why it is breaking that is where the understanding of the algorithm comes in, because at that point your are forced to go through the same thought path as the original author. How soon that understanding of the code kicks in is experience and your familiarity with the problem area. Once you start working this is the most useful skill you can have, "read and understand(debug) other peoples code". It is very seldom that you get to work on writing an application from scratch when you work for somebody. Edited by NightCreature83
1

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354242306' post='5005539']

For example, the Tic Tac Toe game, I keep trying to do it the exact way that the other guy does it, and I get stuck, and constantly refer back to his code to see what I am doing wrong. Not to mention whenever I try doing it by myself, I constantly think about that persons code. So I can never try it myself.
[/quote]

If you can't think of a solution for a tic-tac-toe game, then maybe it's too much of a challenge for you. Step back, and start something much simpler, like a number guessing game, text-based adventure, dice rolls. I have no idea how many useless/random programs I have written back in my GW/QBASIC days: draw random lines, circles, rectangles, compound interest calculators, address books, fake shell, etc.

It's a good thing that you are doing this because you want to learn. Keep this attitude, and never stop writing code.
1

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354242306' post='5005539']
For example, the Tic Tac Toe game, I keep trying to do it the exact way that the other guy does it, and I get stuck, and constantly refer back to his code to see what I am doing wrong. Not to mention whenever I try doing it by myself, I constantly think about that persons code. So I can never try it myself.
[/quote]

What I learned, and I think everyone learns, organically just by going through the process of programming without any professors, is that to improve your ability to problem solve, you must be able to focus on specific problems without thinking about all the 600 other problems you'll have to solve before you're done. To do that, you need to plan out what you will program before you ever program. The first time I did that, it gave me a huge boost in productivity, and it was a lot easier to focus on specific problems rather than be distracted by the fact that I don't know what's next or why. If you sit and write it all out, you have your own notes to refer to, not anyone else's code.

It should be super high-level, too. Like:

Tic Tac Toe:
- UI:
- There will be a main menu, and you enter a number to choose an option:
--0 is Exit
--1 is New Game

etc, etc, etc.

Notice there that I'm not talking about any code. I'm just describing the game or program or whatever. You start with concepts, at the highest level possible, and then you work your way down. You do this because working from the highest to the lowest level of design means you decide that a certain thing is necessary before you decide how you implement it. Working from the bottom up would be the opposite: You'd be coding functions that do things, but you don't know why you need them to do that yet. That means later you're almost definitely going to change those functions.

Aside from that, I think you should quit on tic tac toe. Forget it. You're gonna keep looking at the other guy's code, and you're probably tired of it by now. Do something you only have a small idea how to implement. Are you familiar with dynamic arrays yet? Make a "Database" where users will specify the amount of entries they need to make, and then create a dynamic array of that size. It can be an array of objects that the user fills out the data members of, and then the user can delete, move or change things around in the database, which means you'll have to manage the memory, make new resized arrays, and play around with different C++ features. Don't worry about actually saving the data. But if you're interested, you could use fstream, or if you're on unix you could use I/O redirection, and that'd be something else to learn too. But the point is to just do stuff that takes thought and taxes your knowledge of the concepts of programming and the specific language you're using.

[u][b]Other ideas: [/b][/u]Hangman, a calculator with factorial, square roots and powers, rock paper scissors, a text adventure (if you like writing, too). A personality quiz? An IQ test? When I was first starting, I tried to come up with ideas for iPhone apps that I could implement little prototypes of in a console program, sort of like proofs of concept. This was great because I honestly believed in the idea, planning to actually make them real, usable applications, but I was also realistic about the current scope, limiting it to console programming and simple user input/output. Edited by Shaquil
0

Share this post


Link to post
Share on other sites
Right

What can you guys recommend in terms of a good learning resource, preferably one that isn't outdated?

I've seen people say that cplusplus.com is horrible learning resource. I've also heard people say that C++ Primer is a good book.
The C++ tutorials from thenewboston seem decent as well.

I know there is a million tutorials out there. I just want something that doesn't leave any information out that I need to learn/know.
0

Share this post


Link to post
Share on other sites
if your problem is problem solving and logic, there is no tutorial that will save you. You need to get that brain produce some outputs, stuffing in more inputs into a congested brain won't do any good. You've been studying programming for years you say, time to get something out. If you can't code a tic tac toe game after 2 years of studying, imo you should start considering the option that, perhaps, your energies would be better spent on something else than programming. Edited by kunos
0

Share this post


Link to post
Share on other sites
[quote name='kunos' timestamp='1354517407' post='5006515']
if your problem is problem solving and logic, there is no tutorial that will save you. You need to get that brain produce some outputs, stuffing in more inputs into a congested brain won't do any good. You've been studying programming for years you say, time to get something out. If you can't code a tic tac toe game after 2 years of studying, imo you should start considering the option that, perhaps, your energies would be better spent on something else than programming.
[/quote]

I don't spend nearly as much time coding as I should. And I tried coding the game in C++, which I haven't really experienced yet.

I'm not quitting now, I've wasted too much energy in this to quit.
0

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354216665' post='5005410']
I understand what the syntax for the languages do, how to use them, etc.

Problem is. When it comes to solving a problem (ie making a simple console game of tic-tac-toe). I struggle to figure out HOW to solve it, like what variables, etc are needed. Is there a way around this? I have a book called "How to Think Like A Programmer". But is this really something I can work around?
[/quote]

Draw a flowchart of what you want your program to do before you start writing code. Plan it out ahead of time and what variables and functions you need will start to become more obvious. Let that stuff come out of the design.
1

Share this post


Link to post
Share on other sites
[quote name='Bill Fountaine' timestamp='1354495046' post='5006452']
I've seen people say that cplusplus.com is horrible learning resource. I've also heard people say that C++ Primer is a good book.
The C++ tutorials from thenewboston seem decent as well.
[/quote] Who says that cplusplus is a horrible resource (not saying its good) and then says that The New Boston is decent? TNB is absolutely horrible. I remember watching his videos when I was a nub and even then I could tell he had errors and didn't even cover many a subject. But, take my advice, don't go learn C++. If you want to learn a low level and powerful language, learn C, but not C++. K&R is a great resource for C.
0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0