Conversation
lib/entice/logic/movement.ex
Outdated
| |> Map.put(Position, new_pos) | ||
| |> Map.put(Movement, new_movement) | ||
| end) | ||
| {:ok, %MapInstance{map: map, players: _}} = Entity.fetch_attribute(entity, MapInstance) |
There was a problem hiding this comment.
Does the player have a map-instance attribute? I thought it was for maps only...
There was a problem hiding this comment.
I added it to be able to notify the player's map's agents but I'll remove it now that we're gonna use :entity_change instead.
lib/entice/logic/ai/seek.ex
Outdated
| do: {:ok, entity |> put_attribute(%Seek{aggro_distance: aggro_distance, escape_distance: escape_distance})} | ||
|
|
||
| def init(entity, _args), | ||
| def init(entity, _args), |
There was a problem hiding this comment.
whitespace change - kittens gonna die! :'(
lib/entice/logic/movement.ex
Outdated
| def terminate(_reason, entity), | ||
| do: {:ok, entity |> remove_attribute(Movement)} | ||
|
|
||
| defp start_update_trigger_timer(message, time) do |
There was a problem hiding this comment.
Is there a need for this check? Otherwise just simply always use Process.send_after for simplicity
There was a problem hiding this comment.
I don't know. I copied it from here 20aa29d#diff-366987ce92dde211ad3e5f552c55e0d4R148 and assumed there was some kind of problem with send_after(message, 0). Although looking at it again it seems it might have just been to return nil so the calling function could interpret it as a timer ref so I'll replace it as you said.
There was a problem hiding this comment.
In the other case we needed either the nil or the timer to cancel the timer appropriately - here we don't do anything with it, so we can just use the send_after I think :)
lib/entice/logic/movement.ex
Outdated
| the client, but for simplicities sake we used velocity as a name. | ||
| """ | ||
| defstruct goal: %Coord{}, plane: 1, move_type: 9, velocity: 1.0 | ||
| defstruct goal: %Coord{}, plane: 1, move_type: 9, velocity: 1.0, update_self: false, update_delay: 1 |
There was a problem hiding this comment.
I was thinking maybe we can shorten this a bit - for starters, I guess the update interval is static and can be compile with @update_interval 1 (also note the naming... delay sounds like waiting for something, which we don't do)
Second, I think 1ms for the interval is too short, considering that all NPCs are doing it and there will spam the whole map with position updates. I think for clients we have something like a position update every 50ms or so.
Next, maybe we can find a better name for update_self? Something that tells us that this behaviour is automatically recalculating its state?
There was a problem hiding this comment.
How about auto_move_update ?
|
@EtienneDesticourt any updates on this? |
|
Nope, no time to work on it lately. You can merge if you're good with the current state, the seeking logic is there even though the pathing AI isn't. We could add that in a separate branch. |
Pretty much done, just need to figure out how to pass eid from movement to seek.