Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Aug 2002
Offline Last Active Today, 01:21 AM

#5255679 Stopping distance

Posted by Nypyren on Yesterday, 11:07 AM

Distance is the integral of speed. Have you done integrals yet?

#5255177 Virtual / abstract class variables / functions that are shared across all ins...

Posted by Nypyren on 02 October 2015 - 11:03 AM

(Vehicle example)

If you have an instance of the non-abstract base class "Vehicle", how many wheels does it have?

If you have a Boat, which is intuitively a vehicle, how many wheels does it have?

Use composition, not inheritance.

#5255062 Virtual / abstract class variables / functions that are shared across all ins...

Posted by Nypyren on 01 October 2015 - 05:47 PM

Usually when you encounter this problem, your only option is to use functional style (passing functions to your static functions in this case).

But it might also mean you need to redesign your code.

#5254861 How can I make a text parser?

Posted by Nypyren on 30 September 2015 - 01:41 PM

If you want to be robust and well-designed, I recommend reading up on the following:


And examine the tools available to do most of the hard work for you:


#5254735 Need help with pathfinding C#

Posted by Nypyren on 30 September 2015 - 01:41 AM

Im not sure how loops (or any commands beside manually naming it like (new Rectange recty;)) can be used to name things but if you can find that out it will be extremely helpful.

I'm not sure why you're jumping in to pathfinding already without having the fundamentals down already. You MUST understand the basic principles of programming, or else you'll ask extremely weird questions like this.

You can't make a loop to generate multiple *variables* such as "Rectangle myRect1; Rectangle myRect2;" without using code generation, and you should NEVER use code generation for this kind of problem. You can't do ANYTHING to make new variables in C# at runtime unless you're compiling code on the fly, which you shouldn't do. You can only set the values of existing variables and use collections such as arrays, lists, etc.

In this case you need to use an array. Here is an example of a 2D array of Rectangles in a C# WinForms app:
Rectangle[,] grid = new Rectangle[20,20];

for (int y=0; y<20; ++y)
    for (int x=0; x<20; ++x)
        grid[x,y] = new Rectangle(x * 50, y * 50, 50, 50);
And like jdean300 said, where did you get 44 tiles? That isn't even a square number. (1000 / 50) per axis is 20, squared is 400.

#5254626 What exactly is API-First?

Posted by Nypyren on 29 September 2015 - 11:01 AM

The terms "scrum master" and "story captain" still make me laugh. smile.png

#5254520 What exactly is API-First?

Posted by Nypyren on 28 September 2015 - 06:43 PM

It basically espouses to build your web service as an API, and let an independent team of designers (first or third-party) worry about how to expose that in a way that has end-user appeal; it also seems to include API aspects such as versioning, and other concerns.

All the web services I've used work like that already. Am I just lucky?

#5254504 What exactly is API-First?

Posted by Nypyren on 28 September 2015 - 04:53 PM

API First == Another Producer's Imagination First

#5254037 XML Parser for Asset Manager

Posted by Nypyren on 25 September 2015 - 01:17 PM

2. I'm also worried about resources. Are all of these hashmaps in each element going to use up a lot of memory? I'm not sure how Hashmaps are implemented in Java, but I'm thinking there is probably an array under the hood that is allocating enough memory for the hash function to address the maximum value that it can come up with. If I use the hashmaps to keep track of assets I've loaded in the assetmanager, is it going to slow things down? What is big O for a hash function in Java?

If you're concerned with resources and speed, you have a bigger problem than hashmaps: XML itself. Manipulating strings, converting strings to integers, allocating new substrings each time you read a string, etc. XML has plenty of overhead that you can completely avoid if you use a different format.

Using XML offline and then converting to a more optimal format (such as protobuf) before shipping the game is better.

At runtime, you want to store your data in the most efficient data structures you can. If those are hashmaps, then fine. I would personally use typical class instances instead. Your top-level "get me an asset by name or numeric id" would be a map of some kind, though.

#5253474 Best language for solving diamond problem & is this a good idea for multi...

Posted by Nypyren on 22 September 2015 - 10:54 AM

I suspect most people here will suggest trying composition instead of using inheritance at all. It's easier to get what you want, and you don't have to fight with the language.

#5252914 What do gamers prefer, graphics or gameplay

Posted by Nypyren on 18 September 2015 - 12:41 PM

Graphics should be polished for its intended style. The *style* of the graphics is a subjective preference or historically a technical limitation (photorealistic, cel-shaded 3D, pixel art, etc), but there is also the matter of whether it looks polished or not. There is awesome pixel art and terrible pixel art.

#5252906 DirectX高级动画制作(Jim Adams)

Posted by Nypyren on 18 September 2015 - 11:29 AM

Amusingly, ankhd posted *both* Japanese and Chinese in his post. smile.png

#5252895 What do gamers prefer, graphics or gameplay

Posted by Nypyren on 18 September 2015 - 10:44 AM

Gamers prefer both. If the game has major problems with either one, it won't be received as well.

#5251808 Whats True -1?

Posted by Nypyren on 11 September 2015 - 07:45 PM

All implicit casts that don't lose precision are handled automatically in C++ because they are safe, as no information in the cast is lost. That is why this stuff works safely, upcasting from bool > int > float is safe the other way round is not because you lose precision, this is also when the compiler will spit out warnings.

int (32-bit) to float (32-bit) is not safe and can lose information, even though it will be automatically promoted in C++.

#5251267 How do you divide 1.6 / 0.1

Posted by Nypyren on 08 September 2015 - 10:58 PM

m_vSteeringForce.x    = -2.6226043701171875e-005;


x = -2.6226043701171875e-005;

m_vSteeringForce.y = -6.1118044e-010;
m_vSteeringForce.z = 2.5629997e-006;

y = -6.1118043959140778e-009;
z = 2.5629997253417969e-005;

Conclusion: Your computer is haunted.