Jump to content

  • Log In with Google      Sign In   
  • Create Account

Oberon_Command

Member Since 07 May 2003
Online Last Active Today, 03:09 PM

#5192681 What to do if a coding project starts to feel too complex to handle?

Posted by Oberon_Command on 13 November 2014 - 11:44 AM

 

 

Next time maybe spend more time on the design.

 
That's not always enough. It's quite rare that you know exactly what you're going to build when you set out to build a game. You might start out trying to build one thing, but find that it just isn't fun, so the requirements change the game into something else. Or the design just isn't workable because you didn't think of something, or the way you designed a particular component puts unnecessary restrictions on how other features of the game can access that component. Or maybe you have to redesign something because you didn't foresee where the performance bottlenecks would actually be, and end up putting in a whole bunch of complicated hacks to keep the program in your memory or speed requirements.
 
In any case, the longer you work on a program, the more complicated and unwieldy it is likely to get. This holds true regardless of how disciplined you are and this is why refactoring is important. In my view, refactoring (and knowing when and how to do it) is an important part of being a disciplined programmer.

I might be stubborn, but any project would benefit from having some sort of design thought out before running of to code. At least that's my opinion, unless it's just experimenting around a bit. 

 

 

Oh, many or most projects DO have some sort of design thought out before coding starts, even if only at a high level. But having a design thought out before you code is not in the general case going to prevent situations where refactoring is beneficial, which is what you seemed to be implying.

 

In my view, it's better to prototype a design to work out the kinks before you put it into production. Prototypes not only serve as working demonstrations of your concept, but they also serve as iterations in designing the implementation.

 

Of course it doesn't have to 100% in detail and can change/ adapt to new insights.

 

You mean through... refactoring? :)




#5192190 What to do if a coding project starts to feel too complex to handle?

Posted by Oberon_Command on 10 November 2014 - 07:17 PM

Next time maybe spend more time on the design.

 

That's not always enough. It's quite rare that you know exactly what you're going to build when you set out to build a game. You might start out trying to build one thing, but find that it just isn't fun, so the requirements change the game into something else. Or the design just isn't workable because you didn't think of something, or the way you designed a particular component puts unnecessary restrictions on how other features of the game can access that component. Or maybe you have to redesign something because you didn't foresee where the performance bottlenecks would actually be, and end up putting in a whole bunch of complicated hacks to keep the program in your memory or speed requirements.

 

In any case, the longer you work on a program, the more complicated and unwieldy it is likely to get. This holds true regardless of how disciplined you are and this is why refactoring is important. In my view, refactoring (and knowing when and how to do it) is an important part of being a disciplined programmer.




#5187579 Weird if() behavior

Posted by Oberon_Command on 16 October 2014 - 10:20 PM

What does logData do internally? Is there any way something in there could be doing something strange?

 

Have you tried stepping through the program in the debugger and seeing what the value of the variable is at different points?




#5176122 Strange Visual Studio Release Mode Behavior

Posted by Oberon_Command on 25 August 2014 - 09:38 PM

That looks fine to me given the context you've provided. What happens inside of set()? What are you expecting to see and what sort of "garbage values" are you seeing, exactly?




#5176119 Strange Visual Studio Release Mode Behavior

Posted by Oberon_Command on 25 August 2014 - 09:11 PM

Is it possible that mainPlayer->position hasn't actually been initialized at that point in the program? When I see an accessor appearing to spit out garbage in release but not debug, that's usually the first thing I check. 

 

Also, how are you checking for these garbage values? If you're only seeing them in the debugger and the program is otherwise behaving as expected (or even if it isn't), that's not too unexpected. Very optimized code can make a debugger very confused.




#5154742 A Rose by Any Other Name...

Posted by Oberon_Command on 19 May 2014 - 11:17 PM

Now, where do we draw the line on case-sensitivity?

 

How about on case-sensitivity? tongue.png

 

A lot of people make no distinction between case-sensitive and accent-sensitive.

 

But should make that distinction because accents and case have separate orthographical functions, and not doing so is handling case-insensitivity improperly. So those people are doing it wrong.

 

 

Furthermore, we already know it is possible to encounter "File.txt" and "file.txt" at the same time in a lot of filesystems; using a scheme that can't deterministically pick one or the other just asks to be bitten by this.

 

I think that's a different issue - isn't that just a matter of the filesystem not actually enforcing full case-insensitivity? I would expect a case-insensitive file system to be able to deterministically pick one or the other, ie. reject naming a file "File.txt" if there already existed a file "file.txt" in that directory while still preserving the casing of whatever filename I originally gave it.

 

My stance is that case-insensitive filesystems (for those language for which case is actually a relevant concept) are more convenient to the user than case-sensitive filesystems. Since writing software is ultimately about doing things that are useful to the user, I conclude that to me, a software developer, the user's needs are more important than mine in this case.




#5148384 Why is the first spritesheet laid out like this? Seems harder to read the spr...

Posted by Oberon_Command on 20 April 2014 - 11:55 AM

I've actually heard the terms "sprite sheet" and "texture atlas" used to refer to different things. A "texture atlas" is simply a collection of textures packaged into a single image. A "sprite sheet" is a texture atlas which is specifically used to store sprite assets for a game object (like a character) and has the additional restrictions that each of the sub-images are the same size and are laid out in some regular fashion to improve the efficiency of animation frame lookup. For what it's worth, I didn't hear the term "texture atlas" until my first industry job, where they were used for packaging custom GUI element textures together. I've never heard "texture atlas" used in the context of sprite animation.




#5139551 Industrial Strength Hash Table

Posted by Oberon_Command on 16 March 2014 - 03:36 PM

This looks like Java code that someone tried to port without an actual understanding of C++.




#5130415 How much planning do game programmer before writing a single line of code and...

Posted by Oberon_Command on 10 February 2014 - 05:42 PM

 


Doing something for the first time is always the hardest.
Hence no amount of planning can trully prepare the developer for a solution to the problem. 
 
Planing/Design is a very subjective thing.
Sometimes just writing prototype code to see if a design works, can lead to understanding the problem better. 
Rather than having talks with people of what could be and what not.

 

Correct. This is why almost all internships do diagrams and charts rather then pure coding.

 

 

This is contrary to my experience. Certainly I was working on the codebase from the start in all of my own internships. Most other people I've talked to also worked on the code during their internships and only used diagrams as prototyping or documentation aids. Maybe this depends on the company, but every place I've worked has preferred that I use my skills to actually write code and accomplish things rather than play with diagrams all day.

 

 

 

1 great programmer can not program nearly as good as a 100 moderately good programmers working as a team.

 

I don't think those are really comparable and I'm not sure I see what you're getting at beyond the obvious (more people = more man-hours). Sometimes you neither have nor need 100 moderately good programmers to do something and happen to have a great programmer on hand; would you advocate dropping the great programmer and hiring 100 moderately good programmers? Plus, those 100 moderately good programmers could have trouble communicating with each other, leading to much lost productivity. There is such a thing as too many cooks in the kitchen and adding more people beyond a certain point does not automatically mean more actual work being done.

 

 

 

 I would much rather work with the person that needs the flow chart and communicates well with me than someone who is too good for anyone else.

 

The bold text is what I think is the real issue. You want to work with someone who thinks like you. But do you really need the flow chart or diagram if the person can explain an architecture or algorithm to you without it? Is a programmer who can explain how the code works without a diagram really "too good for anyone else?" After all, ultimately a flow chart or diagram is just a tool we use to communicate with each other. There are other ways of communicating ideas.




#5084757 Data structure for dialoge?

Posted by Oberon_Command on 10 August 2013 - 01:54 PM

The program at the end of the array list and cycles towards the first item. I learned that this is the "good" way to use an array list. Is it okay at some times to start from 0 and count upwards?

 

Yes, it's actually preferred in most cases. Backwards iteration is a micro-optimization that only applies to certain programming languages. I seem to recall that Java is one language where backwards iteration is said to be faster, but I couldn't tell you if that's the case for Processing.

 

My position: use forward iteration until you have a demonstrated need to use backwards iteration. Don't optimize individual lines of code until it works and your profiling tells you that it will be worth it.




#5084751 Data structure for dialoge?

Posted by Oberon_Command on 10 August 2013 - 01:38 PM

I will have to load the speech data backwards from a file.

 

This seems odd. Could you explain why you have to do this? What happens if you don't?

 

 

Is there another data structure that would be better for loading from a file and other stuff?

 

I don't know about "better for loading from a file," but it seems to me that dialogue would be better modelled as some sort of tree if you want NPCs to say different things depending on the situation, or to (more generally) carry out different actions depending on how the player responds to them. This wiki article may be helpful to you: http://en.wikipedia.org/wiki/Dialog_tree

 

I've heard about stacks, but I don't know much about them.

 

 

A stack is what's known as a "first in, last out" abstract data structure. As you can probably deduce from the name, this means that the first element you put into the stack will be the last one you take out of it. In particular, you may only insert ("push") or remove ("pop") data at the "top" of the stack. As you add elements to the stack, the stack "grows" from the "top" towards the "bottom" of the stack. As you remove elements, the stack "shrinks" from the top towards the bottom. I don't know much about Processing, so I don't know what kind of data structures are built into either it or its standard libraries, but from what I've seen, it does have arrays, so you could implement your own stack on top of those. More information here: http://en.wikipedia.org/wiki/Stack_(abstract_data_type)

 

But again, why do you think you need a stack to handle your dialogue?




#5078381 Extremely frustrated trying to find the right engine/language/api/whatever

Posted by Oberon_Command on 17 July 2013 - 12:01 AM

 


So what do you mean by "customize," exactly? Did you check here: http://docs.unity3d.com/Documentation/Manual/Input.html?

 

My problem with this method is that I had planned to have a full screen game experience, and so while yes- technically -you could change the controls it would have to be done in a very immersion breaking way. There was no way to access the settings of the Input from inside the script, which to me was a very fatal flaw... at least for my usage!

 

 

I believe you can still get the raw input, and even if you can't, you can write your own input manager on top of the default one. Sure, it's a hassle, but then you don't have to pay anything. I looked through the Unity docs and skimmed the description of the input system available on the asset store and I didn't see anything that I couldn't write myself given a day or three.

 

I must admit that 2D in Unity can be a bit of an annoyance, however.




#5043114 New forum - Coding Horrors

Posted by Oberon_Command on 14 March 2013 - 12:29 PM

Sleep sort!
#!/bin/bash
function f() {
    sleep "$1"
    echo "$1"
}
while [ -n "$1" ]
do
    f "$1" &
    shift
done
wait
example usage:
./sleepsort.bash 5 3 6 3 6 3 1 4 7
edit: removed link to source since it apparently has NSFW material that I didn't notice before posting.


#5042748 Reference Types and Scope

Posted by Oberon_Command on 13 March 2013 - 11:13 AM

But because memory is explicitly allocated on the heap via the new operator, and a reference independent of the GeneratePopupScreen method is assigned p's memory address immediately upon p being instantiated it also seems like maybe p could persist after GeneratePopupScreen ends.

Correct.

Will p go out of scope once GeneratePopupScreen terminates?

Yes, because p is just a (nullable) reference; p isn't the object. The reference might go out of scope, but the actual object to which it's initialized will persist until the next garbage collection run, or longer if Game.ChangeScreen does something meaningful with it (like push a reference to it on a state stack, for instance), since an object is not considered "dead" until there are no more references to it.

For reference types, lexical scope does not constrain object lifespan.


#5038158 IDE/windows development dilemma

Posted by Oberon_Command on 01 March 2013 - 03:49 PM

What about using VC++ 2012 Express?




PARTNERS