scemino / engge

Open source remake of Thimbleweed Park's engine
https://scemino.github.io/
MIT License
148 stars 15 forks source link

Read ggpack in memory and avoid use of seekg #272

Closed afxgroup closed 2 years ago

afxgroup commented 2 years ago

Would be possible in your opinion to read entire pack in memory and then use something like memcopy instead of using seekg o read entries? Should be faster than seeking the file and make game loader faster?

scemino commented 2 years ago

Hi @afxgroup, yes it is possible to read all the pack and keep it memory, but I wouldn't recommend it. Why ? because 1 ggpack is about 500 MB, if you have 2 or 3 packs (with the extension), you would have more than 1 GB of data in memory. Even if it's possible to make it work on a desktop PC, on a mobile phone or on an embedded hardware, it's not recommended. If your main issue here is the slowness of the game startup, I would suggest to use a profiler and check where all the time is spent during the startup. I know this is something I need to do one day, but today my goal is to add the missing features and be faithful to the original game. BTW I accept pull request, so if you're interested in optimizing the startup, you're welcome.