IRC logs of Libera.Chat #BZFlag for Thursday, 2024-02-22

*** yuitimothy is now away: I've done some soul-searching and I still can't find it.01:11
*** Zehra <Zehra!~Yukari@user/yukari> has joined #bzflag01:30
*** FastLizard4 is back01:46
*** FastLizard4 is now away: AWAY from keyboard02:10
*** FastLizard4 is back02:42
*** yuitimothy is back02:47
*** FastLizard4 is now away: AWAY from keyboard04:33
*** FastLizard4 is back04:40
*** _I_Died_Once <_I_Died_Once!~I_Died_On@c-73-184-170-223.hsd1.ga.comcast.net> has quit IRC (Ping timeout: 260 seconds)04:45
*** Zehra <Zehra!~Yukari@user/yukari> has quit IRC (Quit: Leaving)05:33
*** FastLizard4 is now away: AWAY from keyboard06:12
*** FastLizard4 is back08:09
*** FastLizard4 is now away: AWAY from keyboard08:21
*** FastLizard4 is back08:57
*** FastLizard4 is now away: AWAY from keyboard10:30
*** FastLizard4 is back11:22
*** Sgeo <Sgeo!~Sgeo@user/sgeo> has quit IRC (Read error: Connection reset by peer)11:22
*** Juest <Juest!~Juest@user/Juest> has quit IRC (Ping timeout: 268 seconds)11:57
*** Juest <Juest!~Juest@user/Juest> has joined #bzflag12:21
*** FastLizard4 is now away: AWAY from keyboard12:21
*** _I_Died_Once <_I_Died_Once!~I_Died_On@c-73-184-170-223.hsd1.ga.comcast.net> has joined #bzflag12:33
*** I_Died_Once <I_Died_Once!~I_Died_On@c-73-184-170-223.hsd1.ga.comcast.net> has joined #bzflag12:35
*** _I_Died_Once <_I_Died_Once!~I_Died_On@c-73-184-170-223.hsd1.ga.comcast.net> has quit IRC (Ping timeout: 264 seconds)12:38
*** FastLizard4 is now away: GONE - Screen Detached and Disconnected from IRC (I'm probably asleep, at work, or doing something in real life)12:47
*** bz-next <bz-next!~bz-next@user/bz-next> has quit IRC (Quit: Leaving)14:38
*** bz-next <bz-next!~bz-next@user/bz-next> has joined #bzflag16:49
bz-nextone general thing I've noticed while fiddling with cached resource fetching: the system seems to only really support textures in the current codebase. There's a "resource getter" with cURLManager, but it doesn't integrate with the cache. It is nominally used by the client, but not for anything as far as I can tell. It is used to download to the media directory, which is odd to me considering that a cache exists17:02
bz-nextI'd rather there be a CachedResource or something that wraps cURLManager and eventually have Downloads use that, since all the cache management logic is in Downloads rn17:03
bz-nextReally, imo, Downloads should be TextureDownloader or something, since I don't think having a central class to handle all downloads is a good pattern if the app becomes more dynamic and needs to occasionally fetch stuff from places. It ties resource fetching to initialization of global state, and that's a bit brittle17:06
bz-nextIf there's just a generic CachedResource, then anything that needs to fetch stuff can just use the cache, a request will be fired off if needed, and you can just check to see if it's ready and grab the data. If you want to manage a bunch of downloads then you can just manage a collection of CachedResources. If you want to pop a UI element with some remote data in it, then the UI element can just spawn its own CachedResource and fetch the data that way 17:10
bz-nextwithout relying on some global manager being done17:10
blast007where is the code that would download resources to the media directory?17:15
blast007the media directory isn't going to be writable in 99.9% of cases, since that's the data/ directory17:16
bz-nextcURLManager ResourceGetter instantiated in playing.cxx as resourceDownloader, line 1938-ish, on MsgFetchResources it builds a path to the media directory and adds stuff to fetch17:17
bz-nextmaybe a defunct remote resource fetching idea?17:17
bz-nextfrom the code it looks like it was intended to be used for custom sounds. But it doesn't use the cache17:23
*** Juest <Juest!~Juest@user/Juest> has quit IRC ()17:29
blast007maybe that's why it would crash clients :P17:33
blast007custom sounds, that is17:33
bz-nextlol oh no17:33
bz-nextyeah reading through the code for all that, it is full of dangers. Like, what if the sound tries to play before the resource is done downloading, even if it is able to write it out?17:35
blast007BZFlag Codebase: Full of Dangers Edition17:35
bz-nextIt'd be a massive refactor to solve that kinda issue in general I think. You'd need an abstract resource class of some sort, that understands if it's being sourced from a file or a URL and engages the cache manager if so. Since bugs come about from not manually checking the cache manager for isCacheFileType() when loading... anything17:40
bz-nextit's probably easiest to just add the cache check logic into the various things that use game resources, like sounds, in the same style as what's done with the texture manager17:42
bz-nextisCacheFileType(filepath) then getLocalName(filepath) if so. Even that relies on the downloads being ready for access, which is unfortunate, but what can you do, really17:43
bz-nextReally, considering that all these managers are singletons, the big bad download manager should just be global and able to be queried to see if it's done its work. Maybe? Or maybe just accepting that some init has to be done before you can trust any later code to work17:45
bz-nextcurrently downloads are handled between joinInternetGame and joinInternetGame2 or something like that, so it's just in lockstep with initializing the connection to the server17:46
bz-nextthat could be fine so long as everything that needs to be downloaded for the map / game connection actually happens in the download manager and isn't done by some other mechanism17:47
blast007I did want to revamp the game joining process.  I wanted their to be better feedback between the client and server about what is happening, and also be able to specify resources to download beyond just textures.17:47
bz-nextI think generalizing the Downloads class a bit and plugging it into MsgFetchResources would be 80% of the work to make that possible17:48
blast007At one point I had looked at fixing up the custom sounds handling, but the scope of things I needed to change kept growing :P17:49
bz-nextyeah... if resource fetches are specified via specific server messages, when do they even happen? Does all client code then need to check if the resource is available yet?17:49
bz-nextGiven the current structure of things, resource fetch stuff should be specified along with the initial connection, or baked into the map file or something17:50
bz-nextHaving it not in sync with loading the world is just... overly ambitious given how the code expects stuff to be there when it needs it17:50
blast007bz_sentFetchResMessage is an API function that a plugin would call to tell a client to download something17:51
blast007and it's probably one of those things that was only ever tested from someone's home directory, so it didn't have issues writing to the data/ directory17:51
bz-nextlol yeah17:52
bz-nextthat makes a lot of sense17:52
bz-nextI think the big question is: should resources manage their own "isReady" state? Or should all code that uses resources fail gracefully (with retry) if the file isn't available? But then what happens if it never downloads at all, does it try to open the file and fail every time?17:55
blast007https://github.com/valyala/ybc  "This library implements fast in-process blob cache with persistence support."17:55
blast007there's probably other similar libraries as well17:56
bz-nextI think the cache itself works OK but a problem is that the cached objects aren't really cached objects. They're just strings that are re-written to point to files in the cache directory17:56
bz-nextSo any asynchronicity issues aren't really handled17:57
blast007yeah17:57
blast007if resources had to be fetched as part of the join process, there would be fewer issues17:57
bz-nextI think async is too ambitious to support, yeah, exactly17:57
blast007that was what I was trying to do in a previous attempt at fixing the custom sounds17:58
bz-nextCan a plugin tell a client stuff during the connection process?17:58
blast007a plugin could register custom resources during the Init()17:58
blast007and then we'd just have to decide how to handle a plugin being loaded later via /loadplugin17:59
bz-nextlol just prevent it17:59
blast007easy fix for that would just be to remove /[un]loadplugin17:59
bz-nextat some point bzfs just becomes unix, as all complex enough systems do18:00
blast007https://static.bzexcess.com/bzflag_design_diagram.jpg18:01
bz-nextlmao18:01
bz-nextclearly that's UML18:02
bz-nextI do think the idea of loading a shared object at runtime as a plugin and letting it be loaded and unloaded is already an impressive level of playing with fire18:03
bz-nextat least for a small program like bzfs18:03
blast007especially because on Linux (and macOS?) we're not preventing a plugin from calling internal bzfs functions/methods18:03
blast007(and yes, some plugins DO that)18:04
blast007I had tried enabling the gcc visibility flags before, but that didn't seem to have any effect18:04
bz-nextyou can't prevent the people from getting what they want18:05
blast007sure I can :)18:05
blast007*removes plugin system*18:05
bz-nextimo plugins would ideally be lua or python or something and the API in that case would be pretty airtight, and it'd be easier to write them18:06
bz-nextbut given that there's a critical mass of essential plugins, probably, the .so plugin thing will never go away18:06
blast007we had lua in 2.99.x, but it was a custom fork of Lua that change some floats to doubles or something like that18:06
bz-nextwhat makes me sad about C++ plugins is not only the difficulty of building them for plugin makers, but also how hard string manipulation is, given that it's usually the bulk of what they want to do18:07
blast007tupone has worked on a Python implementation, and we also at one point had a python plugin for our C++ plugin API that could load Python code as plugins.18:07
bz-next"quick lemme unload and reload the pythonplugin.so since something went weird, one sec"18:08
blast007I don't recall how that one even worked.  I never tried it.18:08
blast007one part of Lua I hate is that the arrays are 1-based instead of 0-based18:09
bz-nextfrom what I've seen of Lua I don't like it at all but I do think it'd be more accessible at least. I do like python18:09
bz-nextand lua has luajit which is nice18:09
bz-nextI do think that plugins are so essential rn to the game that disrupting the plugin ecosystem would be disasterous though18:11
bz-nextso pluginception is probably the way to support something accessible, lol18:11
blast007plenty of other scripting languages to pick from too: http://www.squirrel-lang.org/   https://www.angelcode.com/angelscript/  https://chaiscript.com/  https://wren.io/18:16
bz-nextI unironically think BASIC wouldn't be so bad18:19
blast007but specifically TI-BASIC from the TRS-80 ROM18:19
bz-nextyes you gotta pick your flavor18:20
blast007https://static.bzexcess.com/this_is_the_script_that_never_ends.mp418:21
bz-nextthink of all the apps that could be ported into plugins!18:22
blast007bzfs -loadbasicplugin gorilla.bas18:22
blast007https://www.howtogeek.com/779956/gorilla.bas-how-to-play-the-secret-ms-dos-game-from-your-childhood/   good times18:24
blast007pretty sure I first ran that on a system with monochrome graphics, so I didn't know it had color until later18:24
*** Sgeo <Sgeo!~Sgeo@user/sgeo> has joined #bzflag18:39
bz-nextlol this debug output:18:50
bz-nextAccept: */*18:50
bz-nextIf-Modified-Since: Thu, 01 Feb 4461534 12:34:56 GMT18:50
bz-nextin a few million years it'll work...18:50
blast007what request generated that?18:57
*** Juest <Juest!~Juest@user/Juest> has joined #bzflag18:59
bz-nextI was trying to use cache manager to check for a new file, from scratch18:59
bz-nextand accidentally sent an uninitialized time into cURLManager18:59
blast007ah, I was gonna say, sounded like it grabbed some random memory :)19:00
bz-nextI can load some html into an imgui window now on demand, so that's most of the work done for a map archive19:00
bz-nextjust need to integrate some yaml parser or something and make a map index19:01
blast007JSON might be better for the data19:01
bz-nextyeah perhaps. also the advantage that I've used json before, and never used yaml...19:01
blast007YAML is better as a hand-written configuration or data file19:02
bz-nextbut yeah you could probably use this code to load and cache RmlUI stuff in the future19:02
bz-nextYou just make CachedResource("url string"), then call resource.fetch(), resource.is[Complete/InProgress/Error]() and getData()19:04
bz-nextso it's a lot easier to fetch stuff19:04
bz-nextAnd you can just be lazy and embed a CachedResource anywhere in the code19:05
bz-nextand CacheManager supports https now :)19:06
blast007looks like BZFlag since 2.4.10 will follow redirects (and since 2.4.4 we supported HTTPS with cURL), so I suppose I could forward the http:// URLs on images.bzflag.org to https://19:16
bz-nextcurrently I'm just having the texture downloader rewrite http URLs to https on emscripten only19:17
*** Juest <Juest!~Juest@user/Juest> has quit IRC (Ping timeout: 252 seconds)19:17
*** Juest <Juest!~Juest@user/Juest> has joined #bzflag19:25
bz-nextthe ifdef HAVE_STD__ISNAN that redefines the string "isnan" to "std::isnan" and results in a bunch of errors for "std::std::isnan" depending on the order you include files...19:52
bz-nextimo it's got to go19:53
bz-nextwith requiring a newer C++ standard it probably guarantees these things exist anyway19:54
blast007yeah, we only check that in autoconf systems, so it's probably some holdover from compiliers on IRIX or Solaris, or other old gcc instances20:04
blast007cleanup for that probably wouldn't happen in 2.4 though20:06
bz-nexthttps://i.imgur.com/QnrMq5P.png this is probably good enough for a map archive, at least for now20:56
bz-nextIt reads JSON and it'll just fetch the map on click20:57
bz-nextbut it is hilariously ugly, so probably gonna try to clean it up a bit more21:00
blast007"hilariously ugly"  so it fits right in with ImGui?21:38
* blast007 ducks21:38
bz-nextlmao21:49
bz-nexthonestly yes21:49
bz-nextthe code is equally ugly, just slinging weird callbacks around21:50
bz-nextbecause who cares... it's an imgui widget :)21:51
bz-nextbut I did show a couple friends the UI, and the response is always that it's mildly confusing, I guess that's imgui for you21:52
bz-nextdevelopers: "WOW a GUI!!! that's so much better than nothing!" regular people: "what even am I supposed to do"21:53
bz-nextwell, you see, you click load and then browse to the file, then click open, then open the editor under the view menu, then click "update 3d view" duh21:55
bz-nextat some point it's just easier to write a manual than it is to figure out a UI that people will actually find intuitive...21:58
bz-nextWell you can now try it in browser at https://bz-next.github.io/mapviewer4/mapviewer.html22:21
bz-nextonce more maps are added I'll probably have to make the archive browser thing a bit nicer, but for now it works22:21
*** FastLizard4 is back22:28
BulletCatcherI approve of "Full of Dangers" as the release name for 2.4.28.23:46
blast007lol23:48
bz-nextit's actually a great name23:52
blast007yeah23:55

Generated by irclog2html.py 2.17.3 by Marius Gedminas - find it at https://mg.pov.lt/irclog2html/!