• 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
DejaimeNeto

"Oh God, Who Wrote This?", "You Did", "Wait? I wrote This?"

13 posts in this topic

Yeah, that's really common. But in my college they taught me pretty well this kind of best practices.

Of course, by then I only thought that was unnecessary and overrated, and only got to understand what I was taught long after that...

 

This one I knew was going to be a problem when I typed the r in for... "I'll make it like this anyway, who's going to read this anyway?", and ta-da! I probably spent 40 minutes debugging this loop...

Guess I'll start to do what needs to be done, it is not like I did this out of inexperience, neglect would be the word!

 

And I even have a KISS T-shirt... (I really do)

0

Share this post


Link to post
Share on other sites

Yeah, that's really common. But in my college they taught me pretty well this kind of best practices.

Of course, by then I only thought that was unnecessary and overrated, and only got to understand what I was taught long after that...

 

This one I knew was going to be a problem when I typed the r in for... "I'll make it like this anyway, who's going to read this anyway?", and ta-da! I probably spent 40 minutes debugging this loop...

Guess I'll start to do what needs to be done, it is not like I did this out of inexperience, neglect would be the word!

 

And I even have a KISS T-shirt... (I really do)

 

My university has horrible coding classes. I took three of them: Intro to C, and Comp. Sci. 1 & 2. 

 

In my last class, I had a teacher who used inconsistent namings, strange variable names, passed vectors by value like a baus, didn't bother deleting allocated memory, and wrote a crap ton of comments in the style "int add(int, int); // Adds two integers," some of which I found to be lying about their return values.

 

Currently, and this is about 4 years now since I started programming, I am quite anal about consistently structuring my code and focus quite about on making sure it's as straightforward as I can make it. Of course, everyone says I'm over reacting, but I've seen the effects of not caring, and I know how big of a benefit clarity and consistency carry.

0

Share this post


Link to post
Share on other sites

 


Of course, everyone says I'm over reacting, but I've seen the effects of not caring, and I know how big of a benefit clarity and consistency carry.

There is definitely a balance to be struck there. Ideally you are able to write both sorts of code: the throwaway prototype you needed yesterday, and the carefully structured (and tested) code that is headed for production.

 

 

I agree that perhaps it's unnecessary to structure code with utmost care when prototyping, but even if prototyping I feel like there's still things one could do to write cleaner, albeit throwaway, code.

 

The poster in this thread is a prime example: http://www.gamedev.net/topic/652538-pathfinding-behaviour/

 

I wouldn't put code like this in production, but I would certainly not write it as throwaway either. I managed to fix an error in his adding function merely by giving the variables proper names, which, if he had done in the first place, he would have noticed the glaring logical error. 

2

Share this post


Link to post
Share on other sites

laugh.png That is indeed horrible. Way too many parenthesis to keep track of what's inside what (and some are entirely unnecessary). Try separating the function arguments onto separate lines so you can see them, and separate out some of the repeating ugly things into variables.

for (totalMatches = 1; totalMatches <= (pIt)->first->getSize(); ++totalMatches)
{
    int eventIndex = eventLog.size()-totalMatches;
    const Event *event = eventLog[eventIndex];
    if (!(pIt)->first->compare(
         (pIt)->first->getSize()-totalMatches,
         event->getType(),
         translator->translate(event->getKeyCode()),
         getTimeDiff(eventIndex)))
         break;
}

Or better yet, put the whole thing in a function that returns true at the end, and have the if statement return false instead of breaking.

0

Share this post


Link to post
Share on other sites

laugh.png That is indeed horrible. Way too many parenthesis to keep track of what's inside what (and some are entirely unnecessary). Try separating the function arguments onto separate lines so you can see them, and separate out some of the repeating ugly things into variables.

for (totalMatches = 1; totalMatches <= (pIt)->first->getSize(); ++totalMatches)
{
    int eventIndex = eventLog.size()-totalMatches;
    const Event *event = eventLog[eventIndex];
    if (!(pIt)->first->compare(
         (pIt)->first->getSize()-totalMatches,
         event->getType(),
         translator->translate(event->getKeyCode()),
         getTimeDiff(eventIndex)))
         break;
}

Or better yet, put the whole thing in a function that returns true at the end, and have the if statement return false instead of breaking.

 

variables  for   (pIt)->first  and  (pIt)->first->getSize()   outside  loop  to simplify even more

 

Im trying to remember when I just started using that kind of simplification and pre-optimization automatically

1

Share this post


Link to post
Share on other sites

 

Way too many parenthesis to keep track of what's inside what (and some are entirely unnecessary).

 

Parenthesis are never unnecessary as long as they increase clarity, in my opinion.

 

True. Especially with math, sometimes it's better to be explicit even when order of operations already does what you want. But I was mostly talking about this, which really doesn't have any redeeming quality:

getTimeDiff( (eventLog.size()-totalMatches))

Edited by DekuTree64
0

Share this post


Link to post
Share on other sites

And then there was LISP (well, Scheme, but anyway...):

(define (factorial n) (let recurse ((n n) (acc 1)) (if (zero? n) acc (recurse (sub1 n) (* n acc)))))
0

Share this post


Link to post
Share on other sites

 

And then there was LISP (well, Scheme, but anyway...):

(define (factorial n) (let recurse ((n n) (acc 1)) (if (zero? n) acc (recurse (sub1 n) (* n acc)))))

every time i see lisp:

 

20120914120348!Exploding-head.gif

0

Share this post


Link to post
Share on other sites

 

 

And then there was LISP (well, Scheme, but anyway...):

(define (factorial n) (let recurse ((n n) (acc 1)) (if (zero? n) acc (recurse (sub1 n) (* n acc)))))

 

Of course then Lisp was a contemporary of Fortran when teh programmers were just happy NOT to have to program in machine code any more....

 

I believe also that the indent also had been invented by then  (as in - its always possible to make code look crappy(er) by running it all together into a contiguous block)

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