Nypyren

Members
  • Content count

    4759
  • Joined

  • Last visited

Community Reputation

12065 Excellent

About Nypyren

  • Rank
    Contributor

Personal Information

  • Interests
    Programming
  1. OK, for deadlines the things you have control over that are independent of your team's development rate: - Costing (your estimate of time required for feature(s) that you provide to the person defining your deadline). Use a +20% or +40% (or whatever) adjustable over-estimate that you determine based on how far over/under the past few deadlines. However, try to avoid letting your teammates slack because they feel like there's no pressure. If you keep your team performance approximately constant you should be able to find the appropriate costing overestimate threshold fairly quickly. If someone else is making deadlines for you without asking you for estimates, then you should discuss this with them. - Estimate your return-on-investment (how awesome is a feature vs. how much of a risk/burden/etc it is to implement and maintain) and discuss eliminating features which are too risky for very little benefit. In some cases you might also identify a few key changes which could dramatically simplify the task.
  2. Sweet Jesus, get out of there while you still can! See if you can get moved to a different team. If that fails, look for a job outside the company NOW, not when it finally collapses. As for references, surely there are some people there who are not against you. Obviously you should only have people who like your work as references. If there isn't anyone who will vouch for you now then I doubt there will be any later on. As for the stubborn guy, just abandon him. You can probably contribute more to the team by doing your own work in the amount of time you spend trying to teach him. He's only going to drown you if you try to help him swim. Also, you mentioned your team is "among the lowest scoring". How are teams scored?
  3. I like to put spaces between statement groups like that as well. Managing large files: Most IDEs can collapse functions, letting you hide anything you're not working on. I usually jump between functions using GoToDefinition, NavigateBack, and symbolic searching; this reduces the need to scroll through files manually to look for something. If a file gets uncomfortably big, maybe it's just doing too much! It might be time to split it up.
  4. You're right, it comes down to personal preference.
  5. You're welcome However 'var' is still requires a bit of thought about when to use it or not. Things I consider are: - Can a programmer reading the code figure out the type quickly or not? If not then perhaps it's better to type out the name. - Do I save effort? I don't usually bother if the explicit type is 'int' or 'bool', etc. - If you explicitly want a less-derived type. For example if you say 'var x = SomeFunctionThatReturnsADerivedType();' but you want the type of the variable x to be BaseType instead of DerivedType so that you can reuse the variable with a BaseType value (or a DerivedType2 in a different fork of the inheritance hierarchy) later. In that case you have to either change the function to return the base type (the type inference happens using the statically-determined type, not the runtime type), or replace 'var' with the explicit type you want. - 'var' can automatically change if you refactor something involved in the inferred expression. This can be good or bad. Perhaps you use 'var' for a numeric type like int, but someone changes the expression to be 'long' instead. That might result in the code using that variable to change in behavior but still compile correctly. This isn't a big risk but it can occasionally lead to really strange bugs. - 'var' is very handy with generic code, and in foreach loops over Dictionaries, so that you don't have to type out a potentially complex thing like KeyValuePair<KeyType,List<ElementType>>.
  6. 'var' in C# is static type inference (the compiler replaces 'var' with the appropriate type name at compile time). It has nothing to do with dynamic typing. You can use it any time you want, if it makes things more convenient for you. The type of the variable cannot be changed to a non-assignable type later like a dynamically typed variable allows. (What I mean here is that if your 'var' resolves to class X at compile time, you can assign that variable a value of type X or any type derived from the class (or implementing the interface) X, just like an explicit typed variable). The C# keyword for dynamic typing is 'dynamic'.
  7. The Spawner class probably shouldn't be static - it would make it difficult to deal with if you ever needed two separate spawners, so you might as well change it and get the pain out of the way now. SpawnPatterns seems OK as a static class for now. The MSDN recommendations for public variables in C# are to use PascalCase (capitalized first letter), and private variables camelCase (lowercase first letter). Though these are coding conventions and you're free to choose whatever you want. That Func is complicated enough that you might want to define your own delegate type for it - this lets you give each parameter a name which will be helpful for remembering what each parameter does. For cumbersome types like the KeyValuePair<Enemy, float> you could use 'var' instead to shorten it. The {return;} all on one line looks weird. Just take the braces off and indent the 'return;', or put the { } on separate lines. This is another coding convention choice to make. Overall your code looks pretty good to me.
  8. I want a way to hide entire threads that I have no interest in, so they don't pollute the 'All Activity' section with their nonsense. Threads which I've already examined that I no longer have any interest in, or threads created by that petulant Cybergod dude. I'd like the ability to ignore both types of threads completely.
  9. AI will lead to the death of capitalism?

    If we do in fact manage to kill ourselves off (which seems like a possibility that cannot be ignored), it seems like we have a window of opportunity to bootstrap an AI that can carry on after we're gone. As individuals, we all eventually die anyway. It's more important in my mind that someone or something can continue where we left off, regardless of the form that entity takes.
  10. Affiliate links have always felt like clickbait to me. I was really sad when I started seeing them here.
  11. I watched the video you posted but did not see any mention of any-angle pathing. However I could see how it might be extended it to any angle pathfinding if you allowed more than 8 jump links per node. (i.e. links to all visible intersection/corner nodes). I looked at the source code and I don't see anything about any-angle support. Do you have a specific spot where an any-angle implementation is mentioned? Or did the example he gave in the video just happen to align with 8-direction, and the four diagonals are actually allowed to be any diagonal direction?
  12. C# Spaceship steering problem

    Update: OK, I examined the physics engine source code and it looks like it expects torques in world space. Looking at your code again, I'm worried about how you're manipulating the transformed vector on the AddTorque line. The fact that you're discarding the Z component could be what's causing the gimbal lock (see below for thought experiment). Ideally I think that your post-transformed torque vector should be passed directly to AddTorque with no further modifications, which means you should be making your tweaks before you transform it. Thought experiment: Torque vectors point along the axis of rotation that they would cause. If you want to rotate the nose to the left/right (yaw), your torque vector will be along the up/down axis of your ship. If you want to rotate the nose up/down (pitch), your torque vector will be along the ship's right/left axis. Assuming your base orientation is X=left/right, Y=up/down, and Z=forward/backward axis, if you put your ship into a 90 degree left/right orientation, your ship's front-back will be along the X axis and your ship's left-right axis will now correspond to world space Z axis. That means if you want to pitch up, your torque vector will need to be along the Z axis. But since you're zeroing out the Z component when you call AddTorque, this will result in zeroing out your torque vector completely and no torque will be applied.
  13. C# Spaceship steering problem

    It sounds like gimbal lock, but looking at the code I think that the high level concept of constructing a torque to apply should work like you want it to, regardless of orientation. My initial thought is that the transform step is somehow cancelling out the resulting torque whenever orientation starts significantly differing from your starting value (which is likely Identity?). Perhaps the torque needs to be applied in local space? Try just removing the Vector3.Transform line and pass (rot.TurnMultiplier*phys.SteeringTorque*0.00025f) directly to AddTorque and see what happens.
  14. I've interpreted the original question differently than all of the other posters.I believe you're asking about allowing "any-angle" paths (allowing continuous movement in arbitrary directions, not just 4 or 8 directions between cells). None of the previous responses are applicable to any-angle pathfinding. For a quick example, see Figure 1 in the following page: http://aigamedev.com/open/tutorials/theta-star-any-angle-paths/ The options I know of are: Find a path using the grid, and then use "string pulling" to straighten segments of that path. You will not get an optimal path using this approach, though, and it can be slow to perform something that tries to be close to optimal. Start with an "any-angle" algorithm such as Theta*. The stock implementation is slower than A*, however it may be possible to employ clever optimizations that are similar to JPS+ to an algorithm such as Theta*.
  15. Multithreading questions

    Don't use multiple mutexes to limit the number of simultaneous accessors - use a semaphore. If you use multiple mutexes, how do you pick which one to wait on? Then suddenly you have to synchronize that selection process as well or you're in for a world of hurt.