Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 07 May 2003
Online Last Active Today, 11:52 AM

#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!
function f() {
    sleep "$1"
    echo "$1"
while [ -n "$1" ]
    f "$1" &
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.


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?

#5036604 Any point Learning XNA?

Posted by Oberon_Command on 25 February 2013 - 11:05 PM

Once you learn the basics, languages and APIs like XNA become interchangeable. Learn with whatever you like.

This. If the whole "XNA is no longer supported" thing really bothers you, I would start with XNA, but design your game architecture such that you can switch to a different library without much trouble if you decide to move away from XNA and go with something like SharpDX.

#5008280 Can I write GLSL shaders in Unity3D?

Posted by Oberon_Command on 07 December 2012 - 06:25 PM

1. This is the Lounge. I'm not sure your thread is in the right place.
2. Yes, but it isn't recommended because it'll only work on platforms that support it. See http://docs.unity3d.com/Documentation/Components/SL-GLSLShaderPrograms.html
3. The above link was literally the first link retrieved by the Google query "glsl Unity3D." Did you forget that Google exists? ;)

#5006089 Is C++ too complex?

Posted by Oberon_Command on 01 December 2012 - 02:44 PM

The parts of C++ that should generally be avoided (unless necessary) is misusing C stuff rather than the C++ alternative.
For example fopen, malloc and goto could be replaced with ifstream, new (with smart pointer) and exception respectively.

Whilst the ability to use classic C stuff seems to make the language complex, I actually prefer the way C++ extends rather than reinventing the whole language again from scratch (such as C#).

Kindof like OpenGL is seemingly quite hard to learn for new developers because it still has all the old stuff rather than dropping it all and starting with a brand new graphics API.

how would you replace the goto in this bit with an exception
for (int bar =0; bar < 100; ++bar)
	 for(int foo = 0; foo < 100; ++foo)
	 	 if (foo * bar == 100)
	 	 	 goto loopBreak;

	 printf("%d", 100);

The code I am presenting is not doing something usefull at all to be honest but imagine a difficult calculation going on over a grid in which if a certain condition is met you need to break out of both loops and continue the rest of the algorithm with the results already calucalted?

for (int bar =0; bar < 100; ++bar)
	 for(int foo = 0; foo < 100; ++foo)
		  if (foo * bar == 100)
               foo = 100;
               bar = 100;
printf("%d", 100);