Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Aug 2002
Online Last Active Today, 04:57 PM

#5264178 Are there two definition for methods or what?

Posted by Nypyren on 29 November 2015 - 08:15 PM

The word "define" itself also means something special in programming which might be confusing you. It means "Writing a piece of a program and giving it a name." Sometimes you might see the word "identifier" instead of "name".

In this instance:

"main" is the name of the method.
"void" is the return type of the method (the type of output the method is promising to return under normal circumstances).
"static" is optional and means that the method can be called using the class name instead of an instance of the class.
"(string[] args)" is the "parameter list" for the method (the inputs).
The code inside the { } which come after the parameter list is the "body" of the method.

When you have all of these things, it is the "definition" of that method. Each method has a definition *somewhere*, whether it's in code you write, or code someone else writes.

Similarly, a definition of a variable consists of the variable's type, and a name for the variable, such as "int someNumber;", and a definition of a class includes the class name, base class, interfaces, all of its methods, variables, properties, and anything else that can be defined inside a class.

#5263973 Access Violation

Posted by Nypyren on 28 November 2015 - 12:07 PM

I came here because of the C# tag and was completely betrayed...

#5263970 bool as class item argument

Posted by Nypyren on 28 November 2015 - 11:55 AM

ball.Check1 = true;

That should work. Can you post the exact error message(s) you get?

#5263969 How Can Games Natively Port-Forward?

Posted by Nypyren on 28 November 2015 - 11:46 AM

The program contacts the router via UPnP (or some similar protocol) and asks it to forward a specific port to your PC. Sometimes it works, sometimes the router has UPnP disabled or doesn't implement the protocol in the same way the program expects.

#5263284 C# System.Numerics.Vectors slow?

Posted by Nypyren on 23 November 2015 - 12:05 PM

It's definitely 64-bit; his disassembler is showing 64-bit instruction addresses.

Definitely looks like it's using scalar instructions. Perhaps Visual Studio's "Suppress JIT optimization" thing is causing this? Have you turned that off yet? There are some strange things I've had to do in the past to view fully optimized JIT disassembly; attach after launching, executing the function in question in a tight loop, etc.

#5262357 Production graph prediction

Posted by Nypyren on 16 November 2015 - 10:46 PM

I'm probably misunderstanding your goal, then.

Note that I am disregarding the amounts needed,  I am just looking to give a hint about what is possible to attain, so any item that is present in greater than 0 amounts will be attainable, and fulfill the next process step.

I've been interpreting this as: If you own at least one of any input, it considers the entire process and all of its outputs attainable.

If you meant that you need at least one of every input before you show hints for a process's output, then the problem with my algorithm is that it is not traversing the graph in topological order - i.e. it can traverse a process before all of its OTHER predecessor processes have marked its inputs.

The easiest way to solve this is to iteratively brute force it.
Foreach entity you own
  Mark it attainable

todoList = all processes;

bool needToLoop = true;
While (needToLoop)
  needToLoop = false;
  Foreach process in todoList
    If the process is valid (all inputs and tools are attainable, or any other condition checks you want)
      Remove process from todoList
      Foreach output in process
        If it is not yet marked attainable
          needToLoop = true;
          Mark it attainable
This just continues checking all "todo" processes until it no longer finds anything it can mark attainable.

If you want to fill out hint information with missing inputs, you can do this at the end by using whatever's left in the todoList - those are the processes that the player can't make.

#5262313 Production graph prediction

Posted by Nypyren on 16 November 2015 - 02:48 PM

Traverse the entire graph at once, storing the attainability result for every node. Any time your traversal moves to an entity where you didn't change the attainability flag of the output(s), stop that branch of the traversal. You can do this depth-first or breadth-first, whichever you prefer.

When the player acquires (zero -> nonzero) or loses (nonzero -> zero) an entity, update the graph by evaluating successors of that node.

#5261939 MOBA - Ability Bug

Posted by Nypyren on 13 November 2015 - 03:14 PM

Bugs are game specific. However, there are some common things you can do to help the developers.

In order to fix a bug, the testers and developers need to do three things:

1. Figure out exactly how to reproduce the problem.
2. Find the code/data responsible for the problem and attempt to fix it.
3. Test it to make sure it's actually fixed, and make sure nothing else broke due to the change.

You, as a tester, are responsible for helping the developers out with part 1. What you need to do is figure out how to *cause* the bug to occur reliably. Once you've figured out these "repro steps" as we call them, you report them to the developer.

For part 2, the developer then runs the game with a debugger or other diagnostic tools and watches what happens in the code when they follow those steps, and compares the result against what they expect to happen. This frequently lets them find the problem, and lets them work on a fix.

For part 3, the developer tests their fix by following your repro steps again (and any additional tests they have come up with after determining what other problems could happen).

Well that's the problem nobody can figure out what is going on...

If that's true, we can't help you either.

I just wanted to know if somebody had this issue...

Your description of the problem is extremely generic. I'm sure people have all run into a "game didn't let the player do something" bug. The problem is too implementation-specific for us to even begin to speculate about what is wrong. Even if the genre is the same (MOBA), each team implements their code in completely different ways. This is why you need to experiment while playing the game until you figure out what the actual repro steps are, and discuss with the team itself. This kind of bug isn't specific enough for people who aren't working on that game to help with.

#5261862 Getting Y-Axis And Setting It In Unity?

Posted by Nypyren on 12 November 2015 - 10:19 PM

Since the Input.GetAxis functions return values from -1 to +1 on each axis, the easiest solution would be to normalize your Vector3 between lines 19 and 20, but ONLY if its length is already greater than 1, because you don't want to force vectors slower than the speed limit to be forced UP to the speed limit (which can happen if you don't press any key, or when you start using a joystick). And we can use sqrMagnitude since it's slightly more efficient and still works in this case (anything less than 1 squared is still less than 1, 1 squared is 1, and anything greater than 1 squared is greater than 1).

if (moveDirection.sqrMagnitude > 1.0f)

#5261831 [c++ | asm x64] I think I call a function in the wrong way

Posted by Nypyren on 12 November 2015 - 03:56 PM

Here is an introduction that covers some stuff you need to know. It is a fairly down-to-earth description and walkthrough of some basic things.


#5261633 Getting Y-Axis And Setting It In Unity?

Posted by Nypyren on 11 November 2015 - 12:16 PM

Try putting the position check outside the isGrounded if block, or in an else block for that if. If you're falling, you're not on the ground, right?

#5261452 Visual Studio C#, Best way to implement many "GUI Panels"

Posted by Nypyren on 10 November 2015 - 06:48 PM

I would really appreciate if you could recommend me any tutorial where I can learn more about user controls.

For the most part, you can think of UserControl as if it was halfway between a control like a Label/TextBox and a Form.

- You add them to an existing form or inside a panel or other container control.
- They don't have any of the Form-specific things like resizable border controls or minimize/maximize/close buttons.
- You can use the Forms Designer to put multiple controls inside them just like you can with a Form and set up tabbing, anchoring, docking, etc with the child controls.
- Each UserControl is a separate class, so you can encapsulate their members or expose them if you want, similar to how there's many different ways you can pass data between two Forms. Choose whatever works best for you.

You can Google search for "WinForms C# UserControl tutorial" for more in-depth tutorials.

For your specific case, what you would want to do is make your UserControls, and then have your form create them and then set userControlInstance.Dock = DockStyle.Fill; to make the user control automatically fill the entire form. Then design each UserControl so that the controls nested inside of it are anchored or docked properly within the UserControl.

To do inter-page navigation, have each UserControl's navigation buttons raise an event for your Form to handle, and have the Form switch between pages. You can encapsulate these events or expose the navigation buttons directly, depending on what your personal maintainability/rapid development biases are.

#5261413 Visual Studio C#, Best way to implement many "GUI Panels"

Posted by Nypyren on 10 November 2015 - 02:45 PM

Which kind of app are you making? WinForms? WPF?

I mainly use WinForms. In WinForms if I wanted to do this I would probably use multiple UserControls to use the designer interface more easily. UserControls can also be instantiated on the fly which allows you to create multiple instances of the same page if you ever need to. Creating UserControls on the fly and removing them once they're done being used also lets you make sure you never leave a page in a bad state like you might do with tab pages.

#5259619 How to did Spelunky not get sued

Posted by Nypyren on 29 October 2015 - 02:05 PM

If you think Spelunky is iffy, check this out:


#5259453 How do I cause a character to jump away from point of origin (planet)?

Posted by Nypyren on 28 October 2015 - 01:08 PM

character up direction = Normalize(character position - center of planet);
jump => character velocity += character up direction * jump speed;
gravity => character acceleration -= character up direction * gravitational force; // If you want to have a distance falloff like "real" gravity, use a standard gravitational equation here.
This is one general idea. You obviously will need to adapt this to factor in your timestep, etc.