Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 17 Jul 2002
Offline Last Active Yesterday, 08:02 PM

#5288227 MSVC 2015 constexpr and static assertion

Posted by ApochPiQ on 22 April 2016 - 07:23 PM

Some possibly useful stuff: http://stackoverflow.com/questions/1980012/boost-static-assert-without-boost

Just throwing it out there. Not sure if it actually suits your purposes. The problem is that constexpr is, particularly in C++11, pretty crippled. The standards committee has stated that they plan on slowly adding to it over time.

#5288025 How to randomize a string variable

Posted by ApochPiQ on 21 April 2016 - 01:06 PM

For numbers Random,
You could also use GUID.

A GUID is not usable directly as an index into a list of strings, which is what the OP asked for.

#5288024 What is the best algorthim to create (withdraw) as defence ?

Posted by ApochPiQ on 21 April 2016 - 01:03 PM

The original paper on steering behaviors (available here: http://www.red3d.com/cwr/steer/) names many types of steering. The one I should have called out is "Evade" rather than "Separation" but the idea is the same.

Have a look over the paper and the different types of behavior, it should be easy to add one to your system that results in target evasion, based on the examples provided in that link.

#5287907 What is the best algorthim to create (withdraw) as defence ?

Posted by ApochPiQ on 21 April 2016 - 12:54 AM

You can just use a different steering behavior, such as "separation", to get the effect you describe.


If you want more complex environments with obstacles and such, you will probably want to start exploring pathfinding, but for a simple demo just steering should be OK.

#5287523 towards a faster A*

Posted by ApochPiQ on 18 April 2016 - 02:29 PM

You're not talking about vast data sets here nor are you talking about having extremely complex cost functions. A vanilla A* implementation done correctly is more than fast enough to handle your case.

Again, you're optimizing prematurely and wasting time picking algorithms without any guidance from actual data. You should just implement the simplest thing that could possibly work, and analyze it to understand how your situation behaves.

Everything else is flying blind.

#5287072 towards a faster A*

Posted by ApochPiQ on 15 April 2016 - 12:50 PM

This is a great exercise in how not to write fast, clean code.

Start with the bare-bones dead-simple A* implementation. Then profile it in actual usage with real data from your game to discover where it is slow and where things could be optimized.

Optimize only those areas, then rinse/repeat until it's suitably fast.

#5286761 Template-related compiler bug or... ?

Posted by ApochPiQ on 13 April 2016 - 04:07 PM

Having done some implementation of templates for a compiler before (not in C++, thankfully) I can offer some speculative insight into why this is done this way.

Basically, consider the options. When trying to deduce a template substitution, you need to start with the set of all possible types, and whittle it down from there. If every ambiguous or problematic substitution into a template generated a warning (aka error), you'd drown in noise just trying to write a trivial template.

Why? Because there are always possible substitutions that don't make sense. Silently ignoring them is actually the best possible course of action, because it avoids spamming the programmer with needless noise that can't help them anyways.

You just happened to get caught in the crossfire here. You have an ambiguous or otherwise problematic deduction, and the compiler can - nay, should - silently ignore the substitutions that fail here. The end result is a cryptic barf.

There is a very, very thin argument to be made for remembering the problematic substitutions and printing them only in case of an actual barf. However, this is a bad idea because it will generate a ton of false-positives that you (the programmer) would need to sift through to find the actual cause of the problem.

#5286358 Advice on spaceship combat AI (3D)

Posted by ApochPiQ on 11 April 2016 - 01:49 PM

So your basic setup looks pretty similar to the autonomous flavor. You have a steering system, a collision avoidance system which feeds into steering, and a handful of basic modules for maneuvers and such that also feed into steering.

The difference is that instead of each ship deciding for itself what maneuver to make, or when to shoot, or whatnot, you centralize that logic into the director.

Basically think of it as a single AI orchestrating the entire combat process. Some ships will still behave as if they were autonomous and "alone", but in reality under the hood, everyone is placed into choreographed movement patterns.

I guess the best illustration is with an example. Suppose you have a formation of 5 fighters going up against one corvette. Instead of each ship in the formation trying to independently remain in formation, decide to attack in synchrony, and so on, you have the director steer the formation overall, make strafing runs against the corvette, etc. Meanwhile the corvette will maneuver to get as many guns facing the fighters as it can. All this is handled by a single chunk of code instead of distributed across six total ships worth of AI.

The results are dramatic if done correctly. Instead of having ships occasionally make dumb decisions like evasive maneuvers that break formation and cause them to hit a friendly ship, you can coordinate the evasion so that all the ships evade even though only one was taking fire, and so on. The results look markedly more natural and cooperative.

You're really writing the same AI, just placing it in charge of multiple ships at once instead of just a single craft per AI instance, if that helps.

#5286218 A*, A Star: impassable nodes can just go on the closed list?

Posted by ApochPiQ on 10 April 2016 - 06:55 PM

Not necessarily.



An impassable route can never be a legitimate return from A*. A route with a stupid cost can be. Unless your agents are rejecting paths based on their cost outside of A*, you will eventually get an agent trying to travel an impassable route.

#5286216 Advice on spaceship combat AI (3D)

Posted by ApochPiQ on 10 April 2016 - 06:52 PM

Based on my experience writing large swaths of combat AI in X2 and X3, and my broader experience building the foundational technology that went into X:Rebirth, I'd make a single, pointed recommendation: don't do it with autonomous agent-based AI.


My ideal solution would be to have a "combat director" which creates little "bubbles" of action whenever an engagement begins. Within the bubble, all movement, maneuvering, formation flying, and even weapons firing would be controlled by the director.


Space combat is not fun when it is realistic. I spent a few years trying to make realistic combat entertaining, and failed. There will either be a ton of edge cases that are easy to exploit (X2, X3) or it'll be way too easy (or hard) depending on the player's skill level.


Good space combat games should feel cinematic and epic. It's far easier to get a cool-looking chase/evade sequence by top-level control over the space, than it is to get that to happen emergently from autonomous agents.


What your ships do out of combat is up to you; I'd recommend a behavior tree or utility-based reasoner. But in combat: definitely centralize control and you get a huge toolbox full of toys like "make this guy explode in front of the player so he sees it" and "wait to disintegrate this formation of ships until the player is watching." Even if you don't base anything on player attention, getting a coordinated, cinematic fight is so much easier when you don't have to hope all the AIs decide to do something cool at the same time.

#5285525 I am beginning to hate the IT and gaming industry (Part 2)

Posted by ApochPiQ on 06 April 2016 - 08:35 PM

Why are you asking us? We have no information about your career other than what you have provided in these threads.


You should reach out to contacts at your former positions and ask them - peers and supervisors alike. I second the idea of bringing up your periodic reviews as well.



If this is a consistent pattern and not just a couple of stray occurrences, it should become apparent very quickly what the motivations have been for your shortened terms of employment. You might also consider pursuing true permanent full-time positions whenever possible, since temp contracting is inherently subject to, well, being temporary.

#5285474 [ANSWERED] Questions about VPN for server hosting

Posted by ApochPiQ on 06 April 2016 - 01:36 PM

I believe you're referring to a Virtual Private Server or Virtual Machine, not a Virtual Private Network which is a different beast altogether.

Based on that assumption:

1. I'm not sure what the question is, but at a guess: you will probably have control over the firewalls on the machine, and any port is usually open by default (subject to firewall rules) on VPS services. So no, I don't think you'd need any port forwarding.

2. I don't think Steam cares where you host as long as it's reliable. Steam does not include hosting services for you, though, if that's what you're asking.

3. Many kinds, mostly security related. It has nothing to do with a VPS though, just the standard dangers of hosting a machine on the internet. Do your research and you'll be fine. One other minor hiccup is that some virtualization services give you very bursty CPU speeds and disk I/O, so if you are performance intensive on the server, look out for this. It sounds like you should be safe though.

4. "Server" is indeed an overloaded word. It can refer to hardware, software, or the combination of both. Usually you will rent or buy a hardware server and place your own software server (aka services) on that machine.

#5285319 I am beginning to hate the IT and gaming industry (Part 2)

Posted by ApochPiQ on 05 April 2016 - 12:47 PM

Once more, this is not meant to be a sob story nor I big long story of how I gave up on gaming.  If I don't tell anyone, my attitude isn't going to change, so I'm telling you guys since you've generally been good to me over the years.  I've only chosen not to work at a gaming company, that's all.  I guess this type of thread isn't very productive.

What are you trying to accomplish here, anyways? Nobody seems to be guessing correctly.

If you're doing this to change your attitude, you need one fundamental piece of advice:

Start by being truly open to changing your attitude.

Because this thread (much like the last one) reads as "Here's my complaints, now here's all the reasons why you guys are wrong and I should continue being bitter, abrasive, borderline toxic, and unpleasant about it all."

If you want to stop being perceived as bitter, abrasive, borderline toxic, and unpleasant, maybe you should stop complaining about things and then refusing to consider all the input that is offered.

Ultimately none of us can change your attitude, and unless you start coming across as someone who wants to be pleasant, nobody is going to sink much effort into your situation.

Of course, I probably guessed wrong as to what you're even here for, given your bizarre reticence to actually explain yourself.

#5285314 Local hash

Posted by ApochPiQ on 05 April 2016 - 12:27 PM

It would be very helpful if you could clearly and completely describe the problem you're trying to solve, and what you've tried so far.

As it stands I have no clue what you are attempting to accomplish.

#5285312 parallel precomputations

Posted by ApochPiQ on 05 April 2016 - 12:23 PM

Even if you run A* a million times, you're doing something Very Wrong if it takes an hour.

Solve the algorithmic level design first, but also make sure you do some basic optimization profiling on the code, because it seems to me (intuitively) that you have major speed gain opportunities lurking in there.