16

See the image I provided in my previous answer: If you imagine that node 1 is 'Evade Enemy' and node 2 is 'Chase Enemy', you'll see that even though in the second iteration (when everything is green except for '2' and 'B' is when the second iteration starts), 'Evade Enemy' still gets checked first. Only when 'Evade Enemy' fails, because there are no enemies ...


6

Add an intermediate layer. You have some kind of PlatformInput that manages all the different input methods and generates low-level events like KeyUp, KeyDown, etc. Another layer then processes these messages into logic events, like MoveUp, Jump, etc. It can do this by receiving the inputs, mapping keys to logic events, and doing only the most basic ...


5

If you want a behavioral psychology answer, then here's one - if the player isn't sure if he'll win the next game, he's more likely to try one more game. If he lost, he thinks "Maybe this I'll be lucky". If he won, he thinks "Ooooh that was awesome, one more". You actually need a 50/50 win/loss ratio to keep the players engaged. The effect is basically the ...


5

Based on your description it appears key[LEFT] = false; and key[RIGHT] = false; are never reached. The if-condition for that piece of code reads if(ev.type == ALLEGRO_KEY_UP), however the key down handling code's condition looks like this: if(ev.type == ALLEGRO_EVENT_KEY_DOWN). Without knowing any Allegro, I suggest you use ALLEGRO_EVENT_KEY_UP in the key ...


5

It wouldn't really make sense. Behavior trees have their conditionals at the leaf nodes. Those conditionals determine if the traversal will continue to the other leaf nodes in that parent, or move back up to the other parent nodes. You seem to be talking more about decision trees, where it's expected to have logic in the parent nodes. You can learn more ...


4

The answer you reference assumes tasks that are interruptible. As with nearly all things game development, you can always break the mould to make it work for you. It's certainly possible to make a non-interruptible flag, and set it on the tree when you're running animations and other non-interruptible tasks. When the non-interruptible flag is set, the tree ...


4

You can do this by forcing your A* heuristic to be inadmissible. An admissible heuristic is any heuristic which is strictly less than the true shortest path length. An example of an admissible heuristic is the euclidean distance to the target. Admissible heuristics guarantee the optimal solution. So how do you garauntee a sub-optimal solution? You make ...


4

Firslt remember that a decision tree is not the same as a state machine. You have listed three 'states' but they are not exactly 'states', they are compositions of other actions. Because of this, I will call them 'nodes'. In the 'idle' and 'walk' nodes, make the logic poll for something to flee from after every fixed time period or step. If there is ...


3

For reference: I found a thread where somebody wants to adapt FSM behaviour into an BT as well, that contains some hints and a simple example in the first posts of how to do it. But I don't think you want to use it for things like this statue. Like you see in your given example and the graph you draw to show it: It is extremly simple to design interactions ...


3

Here are my thoughts: Movement: you can do with path finding,if you find it hard to implement as an algorithm start with simple logic (while move if hit wall do...), and after that try to create a simple algorithm to make it more efficient. The A* algorithm seems to be the best for path finding. If that's too hard use "zombie movements" (if target.x>me.x ...


3

Behavior Trees are a great way to structure your behavior, but they can suffer from excessive "checking", as you point out. By design, a BT will jump to another branch in the tree if a higher priority behavior becomes available, so the implementation needs a way to check if that's the case. The easiest and safest way to do it is by polling. The BT will ...


3

I've never written a trainer myself, but I would guess that they operate by editing specific locations in the game's memory. Access to the game's address space can be gained by DLL injection or by using a debugger-style API like WriteProcessMemory. To alter specific aspects of the running game (health, points, resources etc.) you have to figure out exactly ...


2

I currently have a hard time seeing how I would however best make the connection between an BT Action in that tree and the actual coding in my application. Should I build up some sort of map between the action names used in the BT files and a function pointer to the actual logic implementation? What is the usual approach to solve that? Forget about function ...


2

One option is as Nathan's comment, just identify when and where the values need to be cleaned up and do it manually there. If you implement callback on the edges of a FSM rather than just the nodes, meaning chunks of code that are run on transition, then you can have a specific implementation of an edge from any of the Tree states to Idle allowing the idle ...


2

In my experience, navigation should not be handled explicitly in the behavior tree. BTs are great at stateless reactive behavior, while navigation is inherently stateful: you find your path, than you follow it, check whether you should replan... If you need to handle jumps, elevators etc. thnigs get crazy and are difficult to handle in a BT. In all games I ...


1

Your red path follows a pretty simple decision metric. At each intersection, first evaluate which paths can reach the goal, and eliminate any that can't - this stops the algorithm from getting stuck in dead ends. Next, evaluate which paths lead "toward" the goal (ie. the dot product of the path direction with a vector pointing to the goal is greater than ...


1

I think that you should keep each individual "state" separate. For instance, if you have an enemy that will chase after the player if it sees the player, it will start following and running. If you had an enemy that only tails the player, it will start following, but not running. The code might look like this in pseudocode: class enemy{ private: bool ...


1

You do already return a reference to the behaviour with the getBehaviour method. You can store the reference in a variable and work with it. Personally, I wouldn't return the components from the other methods. Something like the following if a local variable is enough: YourBehaviour behaviour = actor.getBehaviour(BehaviourType); behaviour.method(); ...


1

Found an answer here. I thought a behaviour tree should start at the last running node to start computation time but that lead to the problem stated in the article. Treating Running States One common question when implementing a Behavior Tree is that: what to do in the next tick after a node returned a running state? There are two answer to it: starting the ...


1

Interrupt masks (sets) and ordering resolution by priority. Some general rules: any unhandled interrupts abort actions interrupts are handled in the order of most important to last important while they're handled, the current and less important interrupts are temporarily disabled disabling interrupts means preventing them from entering the interrupt set (...


1

The ScrollTo behaviour only moves the camera to the centre of your object. The Zoom Level of a layout can be changed via the Set Layout Scale System parameter. Example: Image is a screenshot of Camera Zoom Tutorial | "Construct 2"


1

I read about this algorithm a few years back for finding groups of units: http://lab.polygonal.de/?p=120 It's called recursive dimensional clustering and also appears in game programming gems 2, and was written by Steve Rabin from Nintendo. There are probably other algorithms but I personally haven't come across any formally described. In a nutshell, how ...


1

What if implementing the HSM with a stack of states for each entity you have in the game? public final class StateStack { private List<State> states = new List<State>(); public void PushState(State newState) { states.Add(newState); } public State PopState() { State topmostState = null; if (states.Count &...


1

Feed back the action return state I'm not quite clear on what you mean here, but I see this as fairly simple. The action returns are going to come back at some point -- on some game loop tick, during the action execution phase. You can do these as either method returns, as gamestate changes, or as both (method returns from action methods writing into global ...


1

A win rate of 50% is the only number a matchmaking system can possibly aim for. As an example, if the system were set up to create matches in which players have an estimated 60% chance of winning, then from the pigeonhole principle, it follows that there must be a probability of at least 20% of the match ending with both teams victorious. League of Legends, ...


1

There are other, more powerful factors than just "reward". In the case of competive multiplayer games such as LoL the most important one is the social component, you will likely have friends who play LoL too, and that alone will make the player much more likely to continue playing even if they are fed up with it. Another is the overcoming of challenge, and ...


1

Yes, a rules engine can be used for complex AI, at least to some extent. Unfortunately, game AI rules engines are apparently rather rare. Most of my Google searches on the subject turned up results unrelated to games or just questions regarding using it in games (including this question). I only found a few games described as using rules engines. One of ...


1

While it is, of course, possible to implement animations within an AI architecture, it would be a poor methodology for a number of reasons. One such reason would be an agent that chooses to walk but cannot for some reason. Another reason would be needless complexity (many decisions would have to implement an exact-copy of an animation node because they ...


1

You could make a two-dimensional grid made of Array of IElement type. I imagine String or int would be enough for an element's name/id (e.g. "Diamond" or "Chest"), but your request for the game being easily upgradeable implies elements may have some state or even a functionality. The IElement would be an interface with following methods: 1. canSwap ( ...


1

I think BDD is appropriate in every in environment. As others mentioned you are developing software and as a result you should test it. I do like bdd for some of the random semantics mentioned like test names as sentences. I also like grouping certain tests together while still being able to test 1 class. To combat other messages here I'd like to point out ...


Only top voted, non community-wiki answers of a minimum length are eligible