ApochPiQ

Moderators
  • Content count

    11136
  • Joined

  • Last visited

Community Reputation

23004 Excellent

About ApochPiQ

  • Rank
    Moderator - General Programming

Personal Information

Social

  • Twitter
    ApochPiQ
  • Github
    apoch
  1. Behavior Pure Decision AI...best method to use

    I would tack on to that by saying that having a true "nothing looks good" option is a must. You need to be able to distinguish between "I am deliberately choosing to do nothing" and "I am not doing anything because the AI is busted."
  2. It sounds to me like OP wrote the code already but is interested in cleaning up existing work. It isn't a permanent arrangement, just the current situation. My interpretation is that he wants to continue using a cleaner style moving forward but has pre-written code that isn't conformant with the convention.
  3. I actually disagree with the suggestion to not over-sanitize code. Reviewers will know that you put in extra effort, sure, but I don't see that as a bad thing. What I typically would suggest is instead to over-sanitize the important parts of your code, and just format/lightly-comment the stuff that doesn't need as much explanation. I would rather hire a programmer who submits thorough and clean code (and takes a bit longer to do so) than a programmer who submits messy but "realistic" code.
  4. My gut says to fix the compilation errors. Int <-> float coercion is evil and you should not rely on it. More strongly, you should be scared shitless of it and hate the possibility that it might bite you someday - because it just did. You can simplify your function to: template <typename T> bool within (T value, T min, T max) { return (value >= min) && (value <= max); } But I don't think that actually eliminates the silent int/float coercion so it's more a side issue. The root problem is that you are passing a float and two ints to your function, which is defined to take either three floats or three ints. The conversion that the language allows between float and int makes this call ambiguous. The correct solution is again to fix the passing of ints when you want to check a float. The easiest change is to suffix your literals with f, as you noted. The harder and arguably messier change is to cast explicitly.
  5. Have you tried running the other half of the clipboard operation under a debugger and breaking when it hangs? You can try it on something you write yourself so you can see the actual code.
  6. Assuming you've checked the obvious (does sable_platform.lib get emitted someplace you weren't expecting?) the next thing to do is turn on verbose output from LINK.EXE and go through what exactly it's doing with your DLLs.
  7. It's been a very long time since I used COM clipboard functionality, but if memory serves you need to make your data serializable to do inter-process clipboard ops that aren't just using the built-in formats.
  8. Making your formatting consistent is good. Just understand that everyone is going to do things differently, so it doesn't actually matter what you choose to do, so long as you are disciplined about doing it the same way throughout your code. There is no such thing as a universal formatting standard for code. If you want to format your code to be consistent, which is again a good thing, you should use a formatting tool like clang-format or Visual Studio's Format Document command (found under Edit menu -> Advanced). There's no need to do it by hand.
  9. Have you inspected the exception in a debugger to see where in code it originates, and what information it carries? Probably some useful hints there.
  10. What is wrong with my ray-sphere intersection?

    For some optional followup homework, I recommend studying DeMorgan's laws, the properties of negated inequalities, and how to use a debugger effectively. The first two are logical and mathematical hints as to what changed in your code to make it start working; the latter is a practical skill that has great benefits when writing code.
  11. What is the exact and complete text of the error you are seeing?
  12. So this is a classic example of the blurry line between game design and game AI. On the one hand, yes, you have a challenge presented here, in that the AI needs to operate under certain constraints - or at least perceived constraints. The flip side of course is that this isn't really about how to build an AI, it's about how to design a compelling opponent in the first place. Many AI decisions rest on game design foundations, as you're finding here. The trick is to solve the game design questions first and foremost, and then do whatever it takes to make the AI play the way you've designed it to. As far as cheating goes, it's rampant in almost every game from an AI perspective. Sometimes it just doesn't make sense to simulate ignorance. Then again, sometimes it does - and this is back to game design. Stealth games without simulated ignorance would just be shooters, for just one example. Ultimately you need to plan ahead from a perspective of "what should the gameplay feel like?" and work towards a suitable AI implementation from there.
  13. There can be no magic solution. You want arbitrary sized splines that are normalized. No math can predict how big you will make your splines; to normalize you must by definition know how big the spline is. The compromise is to draw boundaries ahead of time and force all characters in your font to adhere to predefined dimensions. If you know a glyph's size ahead of time you can draw its splines in normal space. But you can't have arbitrary glyph dimensions and also eliminate the need for explicit normalization steps.
  14. Why can't your editor just use normalized coordinates, too? After any change to the spline's control points, compute the correct normalization factor to return everything to the unit square, and apply it/redraw.
  15. C# Returning Buffer from C to C#

    Top answer here has some useful options to explore.