IRC log for #bzflag on 20180219

00:41.39*** join/#bzflag galileo_ (~QUJAAAAAA@d216-108-171-73.nt.northwestel.net)
01:19.20*** join/#bzflag infobot (ibot@rikers.org)
01:19.20*** topic/#bzflag is https://BZFlag.org || http://ohloh.net/p/bzflag || https://bzflag.org/help || Channel Logs: http://infobot.rikers.org/%23bzflag/ || 2.4.12 released! https://forums.bzflag.org/viewtopic.php?f=62&t=19720
01:19.20*** mode/#bzflag [+v infobot] by ChanServ
01:49.48*** join/#bzflag nadir (uid134094@gateway/web/irccloud.com/x-vbqehjmxadgjqwyc)
02:49.45*** join/#bzflag BZnotify (BZnotify@gateway/service/github.com/x-wrhzqtkzgtoilsst)
02:49.45BZnotify[13bzflag] 15blast007 pushed 1 new commit to 06master: 02https://git.io/vA8HP
02:49.45BZnotify13bzflag/06master 14ab67f4d 15Scott Wichser: Removed unused function.
02:49.45*** part/#bzflag BZnotify (BZnotify@gateway/service/github.com/x-wrhzqtkzgtoilsst)
04:16.19allejoin bzfs, what classifies a shot being "ended" with regards to the bz_eShotEndedEvent
04:24.04JeffMWhen it does not kill
04:26.18allejoso that'd include when a shot hits an object in a world with  no rico?
04:41.53JeffMYeah
04:45.03allejoneat. i've got something to hunt down now as to why this is not working
04:47.14allejoalso, since you're around jeffm. any idea why did it per player here instead of using the internal world shot counter? https://github.com/BZFlag-Dev/bzflag/blob/2.4/src/bzfs/bzfsAPI.cxx#L1765
04:47.30allejoI found this commit, https://github.com/BZFlag-Dev/bzflag/commit/d0ee6c80d23e45d1d7c7549c679f70358fc23feb
04:48.11allejoand by the world shot counter I mean on line 1743
04:48.17JeffMThe client sends them too
04:48.24JeffMI’m not on a computer
04:50.01allejoah no worries then, i'll do some more digging. i keep getting 0 for all the world weapon shots and they keep taking priority over still existing shots
04:51.38JeffMThe id handling of world weapons is kinda BS
04:52.30allejo"kinda" is putting it lightly :p
04:53.01JeffMYeah, id manage them yourself
04:53.19JeffMI think you have 200 ids to play with
04:53.42allejowas just trying to avoid that to avoid possible conflicts with multiple plugins
04:54.03JeffMBest to
04:54.18JeffMFix the server to handle them right
04:57.49allejogot any ideas on how to best handle them? my first thought is a map of shotID => ownerID and just add/remove as shots end
04:59.12allejoalso, any idea if you know if weapon IDs are mixed in with regular shot IDs
04:59.43JeffMShot ids are per player
04:59.51JeffMThe server is a special player
05:00.24JeffMEveryone has a shot 1, 2, 3 etc...
05:01.24JeffMHave the server track the life time of world shots and look for death messages and end shots from players.
05:03.41JeffMA unique shot is ownerID and a shotID
05:03.57allejonoted
05:04.32JeffMSo your map is only for shots from the server player id
05:04.51JeffMBut you need to mange the life times too
05:05.07JeffMThat’ll pull some code from the client into the server
05:05.56allejoare lifetimes currently handled server side, client side or both?
05:06.18JeffMJust client
05:06.23allejopfft
05:06.27JeffMA client is responsible for its own shots
05:07.19JeffMThe client may think it’s responsible for server shots too
05:07.42allejohow are world weapons handled right now?
05:07.55JeffMI’d have to look
05:08.33JeffMCheck the server to see if it sends our its own end shots
05:09.53allejoso i can understand how shots are handled. the server relies on clients to tell it when shots have ended, right? i'm assuming deaths send that info. but how do shots ending without hitting something or hitting a non-rico object work?
05:10.50JeffMThat’s what the end shot message is for
05:11.03JeffMA shot is ended by death or endshot
05:12.13JeffMThe server also generally does t care about shots
05:12.22JeffMIt doesn’t track them
05:12.50JeffMThe only one that needs to know a shit ended is all the clients
05:13.39JeffMShot ended
05:14.34allejoright. so do clients only keep track of their own shots? e.g. "i shot this shot. it has 2 seconds to live. ... ok it's done. everyone remove that shot"
05:16.48JeffMYeah
05:18.15JeffMIt’s all very client centric
05:19.37allejomkay, now I gotta figure out where current world weapon shots are being tracked. clients too?
05:20.24JeffMYeah
05:20.43JeffMThey are kind of a hack, and I don’t remember how they were implemented
05:20.59JeffMThe server does not do full shot tracking
05:24.48allejothis has been really insightful, makes me dislike things now... but at least i have a general idea of what I should be looking for
05:24.52allejothanks jeff :D
05:30.36JeffMSure
05:31.39JeffMThe non rico case is the hard one for the server to track, it doesn’t do shot paths
05:32.50allejoyea
05:33.27allejomy original thought for using the shot end event was in combination for world weapons, but if those are improved that'd remove my need for watching shots ending
06:01.32JeffMReally the shot logic from the client should be added to the server too
12:09.25*** join/#bzflag nadir (uid134094@gateway/web/irccloud.com/x-saginatalmttjllm)
17:03.44JeffMallejo: there is some weaksauce shot ID management for world weapons built into the server, with getNewWorldShotID
17:04.01JeffMand shotUsedInList
17:05.31JeffMif you call bz_fireWorldWep with a shot ID of 0, it should try and find one that has a high likelyhood of being unused
17:07.06JeffMyou've also got shot manager.
17:07.07JeffMhttps://github.com/BZFlag-Dev/bzflag/blob/2.4/src/bzfs/ShotManager.h
17:07.11JeffMtotaly forgot I wrote that
17:40.55allejoyea, but when getNewWorldShotID(void) is called, that API fxn doesn't return the shot ID. the new API fxn allows a pointer, but that uses an overloaded getNewWorldShotID() which returns an entirely different shot ID, from my testing. only 0
18:06.00JeffMyeah, you'd have to call the one that takes a player and send in BZ_SERVER to get the actual shot ID out.
18:08.00JeffMbz_fireWorldWep("SB", 10, BZ_SERVER, _pos, 0, 0, 10, &myShotID, 0, eRogueTeam);
18:08.57JeffMso the one that takes an int* is really the only useful one.
18:10.44JeffMare you trying to hang extra data off the shot?
18:20.29allejonope, just trying to get the shotID from the int* one
18:20.58allejoso I could keep it in the plugin's memory
18:22.09allejobut the overloaded getNewWorldShotID(player) version always returns 0 for me, from what I was testing it last night. but didn't dig too far into it
18:25.57blast007I'm adding the player's locale to the MsgEnter.  Do we want to keep around the redneck and klingon locales?
18:27.43blast007I should probably replaced the fixed-sized strings of MsgEnter with std::strings, too... then it'd be less of an issue having to pad the locale length to account for "en-US-redneck".  :P
18:36.39BulletCatcherWe shouldn't assume that std::string objects are binary-compatible between clients and servers.
18:38.23blast007I'm not adding a new method of sending std::strings across the network.  It'd use the one we already have.
18:38.31BulletCatcherk
18:39.14blast007https://github.com/BZFlag-Dev/bzflag/blob/2.4/src/net/Pack.cxx#L136
18:42.27blast007<+JeffM> blast007: did you know there are 6 different ways that strings are packed in BZFLag?
18:42.37blast007https://docs.google.com/document/d/151M1NGDo6ubqr6WY6Vo_vARAS7bopSCWb_TOAoK9hLw/edit#heading=h.j5trnqspg36s
18:43.54JeffMyeah, there are a lot of them :)
18:45.07JeffMallejo: you should be calling the getNewWorldShotID that takes a player
18:45.15BulletCatcherKlingon is kg as French is fr so no extra effort is needed there, but en_US_l33t and en_US_redneck would indeed need extra space.
18:45.16BulletCatcherTo miminize padding in fixed-length messages we could either drop l33t and redneck entirely, or support them in the client but not the server.
18:45.48JeffMit should only return 0 if the shot list was empty
18:46.10blast007"or support them in the client but not the server"  how?
18:47.55JeffMallejo: debug into shot manager, and make sure that LiveShots is gettgin an entry for the server player.
18:47.58blast007for now I'm padding it to 16 characters (or 15 plus a NUL), but after it works I'll switch the packet to use nboPackStdString
18:48.16JeffMthat may be why it's alwasy reutrning 0, it may not be keeping the shot list around when it should.
18:49.43JeffMor just add this to the start of the function   https://usercontent.irccloud-cdn.com/file/sigA51Cl/image.png
18:50.28JeffMbut my guess is ShotManager.LiveShotsForPlayer(player); is alaways returnign an empty list for server player.
19:04.18allejoneat, will try that out when I get a chance :D
20:10.41*** join/#bzflag nadir (uid134094@gateway/web/irccloud.com/x-qfteukwubkikmkix)
20:57.55JeffMallejo: I was slightly wrong about shot manager, it doesn't keep shot lists per player, there is one global shot list, it assigns a global ID to every shot.
20:59.14blast007the other fun thing is that shot messages (both starting and ending) are UDP, which mostly matters for GM, since clients kill off other shots based on their lifetime
20:59.20allejoso there's no mapping as to who owns the shot, it's always the "server"?
20:59.35JeffMno no, the global shot list keeps the owners too
20:59.59blast007for GM, the end shot message to end the shot (if it doesn't hit anyone or anything) is sent by the shooter
20:59.59JeffMit's a list of shot objects
21:00.11JeffMhas the owner ID, the local ShotID and the global shot ID
21:00.30JeffMand a flight logic pointer
21:00.51JeffMshot manager keeps 2 lists
21:00.56JeffMShotListLiveShots;
21:00.56JeffMShotListRecentlyDeadShots;
21:01.13JeffMblast007: yeah owners end there own shots
21:01.24JeffMI was trying to see if I could move that server side in my server
21:01.28JeffMand ignore client endshots
21:01.38JeffMand not break proto
21:01.45blast007:)
21:01.51JeffMI think it can be done
21:02.08blast007I'm fine with breaking proto if it makes it easier
21:02.20JeffMthe proto isn't the hard part
21:02.49JeffMthe proto break would just be to save bandwith
21:02.57blast007k
21:03.05JeffMthe server HAS all the info it needs.
21:04.23blast007is dealing with latency part of the difficulty with some of these kind of changes?
21:04.48JeffMno, getting the server to have the collision logic
21:05.07JeffMit's actualy better to handle some of it on the server, because the latency can be lower
21:05.24JeffMonly have to get to the server, not get to the other clients too and then maybe back.
21:05.31allejofor the shot manager, the globa; shot ID is a unique ID across all shots on the server (dead or alive), I'm assuming, right? what's the local shot ID?
21:05.44JeffMallejo: all shots for all players
21:05.51blast007just as long as we're not repeating the 2.99.x lag comp situation that gave high lag an advantage :)
21:05.54JeffMevery shot gets a unique unsigned long
21:06.10JeffMblast007: no, worst case is it's the same as current code.
21:06.21JeffMallejo: the local shot ID is what the client knows the shot as.
21:06.39JeffMthe client keeps an array for every player
21:06.49JeffMwith local shot IDs of 0 to max shots
21:07.25JeffMso on the client, if you have MS = 2, you can't shoot a shot untill one expiores
21:07.35JeffMthere is no place to store a third shot
21:07.58JeffMthe server is trying to let shots exist outside that limit
21:08.10JeffMit's the first part of the shot rewrite.
21:08.58allejoso local shot ID would be 0 or 1? whereas the global shot id could be some really obscure number?
21:10.52JeffM0 to whatever -ms Is set to
21:10.57JeffMbut yeah
21:11.04JeffMthe global IDs keep going untill they wrap around.
21:11.23JeffMthe idea was to make it simpler for plugins to track shots by giving them a single unique number.
21:11.33JeffMinstead of a pair that gets reused.
21:12.05allejoright. that single unique number would ideal to use, if only I had access to it :p
21:12.14JeffMI think you do
21:12.41JeffMuint32_t bz_getShotGUID (int fromPlayer, int shotID);
21:12.54JeffMonce you get the server shots to give back valid local IDs
21:13.26JeffMyou can also hang values off of shots, BZF_API uint32_t bz_getShotMetaData (int fromPlayer, int shotID, const char* name);
21:13.26JeffMBZF_API void bz_setShotMetaData (int fromPlayer, int shotID, const char* name, uint32_t value);
21:13.26JeffMBZF_API bool bz_shotHasMetaData (int fromPlayer, int shotID, const char* name);
21:13.46allejoright, just need to make sure the server gives back that unique number (which currently returns 0, issue discussed earlier)
21:13.57JeffMyeah,
21:14.08JeffMbut looking into the code, it should be working
21:14.21JeffMhow far appart are you calling your world weapon shots?
21:14.31JeffMis it possible there is only one alive at a time?
21:14.39allejoa few seconds apart
21:14.49JeffMwhat is the life time of each shot?
21:14.57JeffMless then the delay between shots?
21:15.10allejothe shots hadn't ended yet. basically as soon as i added another shot, the previous one was removed
21:15.21JeffMok
21:15.27allejodisregarding the lifetime or collisions
21:15.55JeffMthe fire command does add the shot to shot manager, so it should be in the list
21:16.07JeffMsomething may be removing it early for some reason.
21:16.33allejothe fire command where the server picks an ID works just fine. the fire command with the int* point is the one that removes shots early
21:16.53allejobut the former doesn't give access to that shot ID, hence the reason the int* was added
21:17.12JeffMI mean the CORE fire command, not in the API
21:17.13JeffMfireWorldWepReal
21:17.22allejoohhh
21:17.32JeffMeverybody goes into that
21:17.36JeffMthis isn't a GM right?
21:18.02allejonope, not GM
21:18.20JeffMfireWorldWepReal calls ShotManager.AddShot(firingInfo,player);
21:18.26JeffMthat adds the shot to the live shots
21:18.38JeffMwhat are you passing in for a lifetime?
21:19.57allejoiirc, _reloadTime
21:20.06JeffMok, so not 0
21:20.13allejocorrect
21:20.58JeffMyeah they should stay in live shots till ended.
21:21.40JeffMso I'd debug it and see what the conents of LiveShots is on the second call to fire.
21:23.45JeffMgive me your call to the API fire and I can see if I can replicate it
21:25.57JeffMwow, is USE_TR1 even needed?
21:27.46allejomy current call is using the API fxn without the int*. I don't have my attempt to use int* on my atm
21:27.55JeffMahh ok
21:28.44JeffMthe one with out the int will hide the actual shot ID.
21:29.37allejoyup
21:29.43JeffMwhat the FUDGE, did I try to do events in C++?
21:30.05JeffMprobalby should add an API callback for world weapon fires too
21:30.10JeffMso that there can be notifications.
21:30.20allejobz_eWorldWeaponFired event?
21:30.38allejoi.e. create one
21:30.45JeffMchecks to see when that is actualy called
21:31.15JeffMor does that not exist yet?
21:31.21allejodoes not exist atm
21:31.27JeffMahh yeah, make that :)
21:31.30allejobut should be trivial to add
21:31.39JeffMthen have it give the local and global shot iDs
21:31.48JeffMthen who cares what shot funciton is called.
21:32.05BulletCatcherTR1 support was added in 2013 for the Apple LLVM command-line compiler.  It should be safe to remove it now.
21:32.14allejoadds it to his to-do list
21:34.15JeffMbool bz_fireWorldWep ( const char* flagType, float lifetime, int fromPlayer, float *pos, float tilt, float direction, int shotID, float dt, bz_eTeamType shotTeam )
21:34.15JeffM<PROTECTED>
21:34.56JeffMI'm also not so sure about making the caller specify lifetime and speed and stuff
21:35.16allejoyea, bzfs should handle shot IDs. that'd avoid this whole problem we're currently having :p
21:35.18JeffMthe server should be able to get all that from bzdb so that the shots are consistent with player shots.
21:36.46allejoI wonder, is there a way in BZ to send a deprecation notice at compile time?
21:37.22JeffMsure
21:37.26JeffM#defs
21:38.45JeffM#define bz_fireWorldWep #error bz_fireWorldWep is deprecated, use bz_fireServerShot instead
21:39.34JeffMthen add these 2 functions
21:39.37JeffMBZF_API bool bz_GetLookAtVector(float origin[3], float vector[3]);
21:39.37JeffMBZF_API int bz_fireServerShot(int targetPlayerID, float origin[3], float vector[3], float dt, bz_eTeamType color = eRogueTeam);
21:40.41JeffMactualy, BZF_API int bz_fireServerShot(const char* shotType, float origin[3], float vector[3], bz_eTeamType color = eRogueTeam, int target = -1);
21:40.54JeffMand make it check for GM internaly
21:41.31JeffMand make it return the uint32_t ID
21:42.25allejoso instead of the int return time, it'd be uint32_t, which then would allow plugins to assign a "proxy" owner of the shot if desired
21:42.31allejos/time/type/
21:42.53allejoor whatever information wants to be tied to that shot
21:43.11JeffMI'd have this be the API for server shots.
21:43.13JeffMhttps://usercontent.irccloud-cdn.com/file/A2jKe2w3/image.png
21:43.38JeffMthe game screws up if you try to add shots for players, IRC so don't even let them set the player.
21:43.48allejowhat would getLookAtVector() do?
21:44.05JeffMoh crap that's missing an arg :)
21:44.11allejoyea the game does screw up when you set it for players. something I was planning on changing so it'd always do server as the owner
21:44.36JeffMBZF_API bool bz_GetLookAtVector(const float origin[3], const float target[3], float vector[3]);
21:44.53JeffMit takes an origin, and a target point and computes the vector for the shot to get there.
21:45.06JeffMuse that instead of tilt and direction.
21:45.19allejoI wasamy thinking was allow the API call to set a "proxy owner" but always send it as the server. on death events, assign the owner of the shot to the "proxy owner"
21:45.23JeffMSSPs will need it :)
21:45.43JeffMthe shot meta data is for that
21:46.02allejoso make plugins store that info instead of the server?
21:47.29allejowhen would bz_getLookAtVector() be used? and what's the use of the bool?
21:47.40JeffMhttps://usercontent.irccloud-cdn.com/file/rieDBqEp/image.png
21:47.55JeffMthe bool returns true if the vector computed was valid
21:48.10JeffMif the target point is the same as the origin, no vector can be computed ;)
21:48.27JeffMand you'd use it when you wanted to aim at something :)
21:48.54allejowould vector need to be a pointer? or is that something you have to calculate?
21:49.06JeffMand no, the server would store that info as part of the arbitary data stored with any shot
21:49.30JeffMthe vector is a pointer to where the funciton puts what it' computes.
21:49.33allejowell yea, the server is the authoritative source but it'd be on the plugin to set that data, right?
21:49.36JeffMarrays are pointers.
21:49.43JeffMyes, plugin sets the data
21:49.58JeffMbecause the server deosn't know it's a player shot, because it's a server shot
21:50.10JeffMit's up to you to do what you want with it
21:50.15allejomakes sense
21:50.28JeffMif you want to make the server keep the player with the shot, then fix the game to just allow arbitary player shots
21:50.38JeffMthat was the goal of the shot list and GUId
21:50.47JeffMbut that needs a proto break
21:51.09allejoone small fix at a time!
21:51.15JeffMyeah
21:51.47allejoso what would be getLookAtVector()'s body? the client's calculation code for shot paths?
21:51.48JeffMthe idea was to have the client allocate a temporary shot ID for all local shots, send them to the server, server allocates a global shot ID, and then sends it back
21:52.05JeffMclient also gets the temp shotID, so it replaces the temp ID with the global ID and then it's all good.
21:52.24JeffMit would be fine getting shots with GIDs for itself and no local ID.
21:52.50JeffM<PROTECTED>
21:53.22JeffMhttp://www.euclideanspace.com/maths/algebra/vectors/lookat/index.htm
21:53.28JeffMit involves maths
21:53.44JeffMit's easiest when you have quaternions.
21:55.53JeffMlibBZFlag has a matrix version in BZFlag.LinearMath.Matrix4F
21:56.32JeffMhttps://www.irccloud.com/pastebin/v9p2yUla/
21:58.09JeffMyou could also make a  utility funciton that took 2 angles and computes a vector
21:58.18JeffMfor legacy compatibility
22:01.46allejohmm I'd have to take a look at the GM logic to see if I can get a better idea of its purpose
22:02.03allejokind of hard to imagine atm
22:09.31JeffMdo you know what a vector is?
22:09.34JeffMa unit vector I mean
22:10.18JeffMoh wait, I'm overthinking it, it doesn't even need the rotation part
22:10.22JeffMit's way simpler :)
22:10.44JeffMNormalize((target - origin)
22:36.11allejocan't say I'm familiar with it
22:41.40JeffMyou didn't have to take linear algebra?
22:41.57JeffMwell a vector is a thing that points in a direction
22:42.05JeffMit's made of 3 floats
22:48.33allejoa long time ago and not enough practice to recall :(
22:49.05JeffMso it's a way to basicly point in 3d space
22:49.11JeffMit's what all the shots need
22:49.23JeffM"when I move, what direciton do I move in".
22:50.10JeffMa vector of 1,0,0 means that it's moving in the X+ direction
22:50.33JeffM0,0,-1 means down in Z-
22:59.05JeffMso if you want a shot to go from point A to point B, you need to aim it along some vector
23:07.48allejoohhh that sounds so handy
23:08.09JeffMyeah, the functions right now only take 2 angles.
23:08.20JeffMbut internaly those angles get turned into a directon vector
23:08.36JeffMmay as well make the shoot function take the vector, then you can do a lot more
23:09.35allejoah, so instead of having things being separate arguments like tilt, direction, etc. it'd just be in one of these vectors?
23:16.20JeffMyeah
23:16.42JeffMit's easy to turn 2 angles into a vector, it's not very eash to find out the 2 angles to aim at a point :)
23:20.07allejoso bz_getLookAtVector() would calculate that vector and stuff it into 'vector'?
23:26.32JeffMyeah
23:28.34allejothe core fire weapon takes all that info as separate arguments, so would that be changed or would the API functions convert that?
23:30.27JeffMI'd simplify it as much as possible
23:30.47JeffMit's also called by the map based world weapons, so you may need to keep some args there, or change the code that calls it
23:31.15JeffMin my server I was going to make the map world weapons call the normal API using a module
23:31.19JeffMso the "core" was just the api
23:35.14allejowhat do you mean "simplify it as much as possible?"
23:35.28JeffMtake out lifetime and stuff
23:35.38JeffMhow much of that is exposed to the map?
23:36.02allejoi'd have to check
23:38.33allejojudging by the wiki for the weapon object, seems like only tilt (and rotation which would likely be direction)
23:38.54allejoi'd look into it further when the changes are actually made
23:44.55JeffMthen yeah, I'd make the core function figure out the lifetime and stuff
23:48.44*** join/#bzflag eeinsteein (uid282735@gateway/web/irccloud.com/x-kfldpwkdqsigzxjg)

Generated by irclog2html.pl Modified by Tim Riker to work with infobot.