#loading multiple textures from url

1 messages · Page 1 of 1 (latest)

vagrant barn
#

my game connects to my api, it creates over 500+ items in the game with data obtained from the api. each item has an image and i fetch the image from the cdn but doing this for over 500 items will take time and the item covers will look empty until its done downloading. and you can't request over 250 urls in godot for some reason so i want to do it similar on how you would do it on html.

i wanna do it like how you would have over 500 img in your body and their src would be loaded by the browser. i wish there was a way to set a texture's path to an url so that it downloads itself.

i tried waaayyy too many ways, but i cant do it.. some items with same image are also duplicated so there must be a caching the assets based on url, kinda like you call func name set_asset(url, node) and it checks if url was saved before, if it was, uses the local path it was saved to or downloads the url and saves to the local path and sets the node.texture by that path.

if theres anyone who's interested in this or made something similar, please help..

#

loading multiple textures from url

vagrant barn
#

anyone ?

fair heron
#

there is an option for requests called "use threads" which could speed up the requests. Maybe you'll find your answer in the forum online. Maybe try it with HTTPClient (this could probably help you but idk) (sorrry for not being that helpful. It's just very complicated I think. That's maybe why no one answered you yet. Good luck)

vagrant barn
#

so i'd have to make threads that do http requests for every 800 item?

summer igloo
#

Are all the images showing on screen at once? If not you could either use a pagnation approach where you show 50 at a time per page or stream them in, cache then stream the rest as needed

vagrant barn
#

yeah they're all showing at once

#

i mean, in a carousel, you scroll down to go through them

#

i think this is just hard to implement in godot

summer igloo
#

Im thinking about it in web dev terms, even when making a website you would'nt load 800 images from a cdn

#

since its a carousel youre showing 1-10 images at the screen at once right? set an ID for each image and load them in batches. ie: when viewing 10 it should show 5-15. 5-15 should be cached from previous requests and 15-30 should be loaded next.

vagrant barn
#

in a div you would throw 500 cards with their img src attached

#

and the browser would load them with no problem

summer igloo
#

depends on the frameworks you'd use. some implement lazy loading automatically

vagrant barn
#

but i'll look into this

vagrant barn
#

if texturerect was accepting urls it would actually be soo much better

summer igloo
#

If you are insistent on this method and dont want to implement any batching you can thank the stars godot is open source

vagrant barn
#

website ?? what..

#

i dont think you get what i meant