[Pogamut-list] List With All NavPoints of The Map

Jakub Gemrot jakub.gemrot at gmail.com
Wed Sep 10 08:58:45 CEST 2008


Hello cazub,

> yah "this.memory.knownNavPoints();" works for me, i think it returns an ArrayList but that always includes playerstarts, weapons and all that,
> so i guess you'd have to parse the unreal id.

Okey - so if I understand correctly you want every NavPoint that *IS
NOT SPECIAL* ... if so, you have to parse unreal id, because every
item IS navpoint as well as every player start - it's the nature of
the UT2004. Can't help you there ... but we should include this into
next major version of Pogamut thanks.

> might have to write your own "contains" or compare function to parse the UnrealID string. Not too hard to do though because the format for the message is always .  , an example would be
> DM-Albatros.PathNode35   or
> DM-Albatros.InventorySpot4  or
> DM-Albatros.PlayerStart1
>
> anybody got a better idea? I hope so cuz this one works but its slow :P

No problem with sluggishness here ;-) ... just override
postPrepareAgent() method in your agent class and preprocess all
navpoints beforehand into map Map<Integer, NavPointType>, the key is
Integer ID of the NavPoint, value is enum NavPointType{ PlayerStart,
InventorySpot, PathNode; } (you have to create that) so do something
like this:

public postPrepareAgent() {
for(NavPoint np : this.memory.knownNavPoints() ) {
NavPointType type = parseNavPointType(np.UnrealID);
navPointTypeMap.put(np.ID, type);
}
}

Where parseNavPointType(UnrealID) is your method that parses the
UnrealID of the NavPoint and determine it's type.

Cheers, Jakub!

On Tue, Sep 9, 2008 at 12:36 AM, cazub
<pogamut-forum at artemis.ms.mff.cuni.cz> wrote:
> Re: List With All NavPoints of The Map
> yah "this.memory.knownNavPoints();" works for me, i think it returns an ArrayList but that always includes playerstarts, weapons and all that,
> so i guess you'd have to parse the unreal id.
>
> NavPoints all say "pathnode" and then the number in the unreal id. Weapons will say like   "InventorySpot" then a number. Theres also player starts and JumpSpots
> So if my map is DM-Albatross i'd do something like
>
> //init an arraylist with all navpoints
> ArrayList myAllNavs = this.memory.knownNavPoints();
> // init new arraylist to hold pathnode only navpoints
> ArrayList justNavPoints = new ArrayList();
> int size = myAllNavs.size();
> String tmpStr = "";
>
> //now cycle through all navpoints and if they contain the phrase //"PathNode"
> // add that navpoint to my justNavPoints list.
> for(int i = 0; i < size; i++){
>  tmpStr = myAllNavs.get(i).getUnrealID();
>  if(tmpStr.contains("PathNode")){
>    justNavPoints.add(myAllNavs.get(i));
>  }
> }
>
>
> might have to write your own "contains" or compare function to parse the UnrealID string. Not too hard to do though because the format for the message is always .  , an example would be
> DM-Albatros.PathNode35   or
> DM-Albatros.InventorySpot4  or
> DM-Albatros.PlayerStart1
>
> anybody got a better idea? I hope so cuz this one works but its slow :P
>
> ----
>
> Reply Link: <https://artemis.ms.mff.cuni.cz/pogamut/tiki-view_forum_thread.php?forumId=6&comments_reply_threadId=223&comments_parentId=78&post_reply=1#form>
>
>
> _______________________________________________
> Pogamut-list mailing list
> Pogamut-list at artemis.ms.mff.cuni.cz
> https://artemis.ms.mff.cuni.cz/mailman/listinfo/pogamut-list
>



More information about the Pogamut-list mailing list