Python Forum
[PyGame] Handle giant 2D map
Thread Rating:
  • 1 Vote(s) - 2 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] Handle giant 2D map
#2
Conceptually, it's the same as either of these two cases:

(1) Imagine you have a nested (2D) list. Normally you'd access it like my_list[a][b]. But you could have a function, or better yet a class which offered a similar interface, my_class.get(a, b). Now imagine the contents of this list are always such that my_list[a][b] = a * b. There's really no need to store that, right? If the computation were more complex, it might be worth "caching" but conceptually, there's no need to pre-compute every value since you can compute it as-needed.

(2) Perhaps the computation isn't "pure" or merely expensive, such that you can't just compute it on the fly (or can't after the first time, or something). You can store the contents in a file on disk. In fact, this would be true of a video (easily >1GB) being viewed on a device with insufficient memory. You can't simply compute the value at a specific time, but you can look it up, and there can be ways to find the place in the file you want.
Reply


Messages In This Thread
Handle giant 2D map - by MrMahus - May-23-2018, 07:32 AM
RE: Handle giant 2D map - by micseydel - May-23-2018, 04:35 PM
RE: Handle giant 2D map - by MrMahus - May-23-2018, 05:10 PM
RE: Handle giant 2D map - by micseydel - May-23-2018, 08:19 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020