New answers tagged

0

I'd try to avoid using any form of event dispatch within an ECS. From the looks of it you're trying to change state based on some kind of input. I assume that block of code where you track input is inside a system. So instead of dispatching an event why not just update the requisite components directly from that system. Systems can process multiple types ...


0

Found an easy way of doing it, after having troubles with getting smooth movement under milk's suggestion. Here's the source, (python / jython): s == the mob, and territory == its rectangular "home" area. The +1's and +2's I added to some corners to make it look better as it was a bit "snappy". fullBounds = s.getFullBounds() rightBounds = s.getRightBounds()...


1

You want to patrol between different locations, so you could just create a list of locations to visit in order (so you would have two locations for a move back and forth behavior). Once your actor has visited each location she can start over and return to the first location (or you could visit the locations in reverse order, or stop, or whatever). For ...


3

Checkers? I don't know where you're drawing the line for a 'prohibitively large' data set, but a quick and naive consideration (read: definitely not even optimal) can store a board state in a maximum of 264 bits, and most will be far shorter. (Don't store info for captured/removed tokens.) Your tree will be pretty big but storage requirements are pretty ...


0

I think that experimenting with different values for your parameters should fix the issue. Specifically the zero threshhold and deceleration radius. If your deceleration radius is too short the dynamic body won't have enough time to slow down to a speed within the zero threshhold and will overshoot the target. Try playing with the demo that's provided with ...


2

Risk has too many potential moves and too many potential outcomes per move to have a Chess-like AI be effective. You don't need to consider every possible move, and you don't need to do look-ahead. I would suggest you get some playtesters, or at least one or two smart gamers to help. If you're really just taking the Risk rules, or some sub-set of them, then ...


1

It's trivial enough to determine actions via a fast formula (including bitwise ops) or a LUT (lookup table which could be a dense array, sparse array or hashmap), given the available info coming in via AI senses. Combine with FSM and you'll have a simpler, quicker, more debuggable system. I don't think you really need inference, here! You could instead ...


0

The dot product has two nice properties for collision avoidance. The dot product is closely related to the cosine of the angle between two vectors. The dot product of a unit vector A and a second vector B of any non-zero length, the result is the length of vector A projected in the direction of vector B. So as you can see in the image; if the angle is ...


-1

You must to divide your whole world into parts, and check is each of them is close/further from your position. It gives you priorities how frequently you should update your map part. Because there are some algorithms which allow to optimise such updates.


0

If you go for this connections approach your heuristic will be made up of two parts. First you find the closest connection point to the target level and apply classic Manhattan distance from your current location to this stairs/elevator. Next you check the distance on the target level from the connection point to the actual target, again just Manhattan. You ...


0

A tutorial for "Enemy Sight" exists in Unity's documentation, here Basically, it uses Raycasts to detect the presence of other objects within a certain radius. This is a simple but effective approach that will tell your creatures where everything is and also what it is. The other approach (one that I have used in the past) is to create / obtain a cone mesh....



Top 50 recent answers are included