First of all, I'd just like to say that this has been the single most helpful book in getting me into the swing of true Object-Oriented Programming (after moving from VB) and has taught me EVERYTHING I could have possibly asked so far. I can't believe how inexpensive the book is in comparison to a lot of higher priced... yet crapper.. books there are out there.
Fanatical praise aside, I've started work on my first C++ game and am umming and erring about what to use for my Resource Management. Clearly an STL List is a bad idea because of the need for random access (for grabbing re-requested resource references and planting them back at the top of the list). So my thought is would using an STL map, or an STL map that maps the filenames to the corresponding entries in the STL list be a good idea? What are the downsides to this?
Are there data structures you can suggest I research into that will be useful in this situation?
Oh, and I decided to separate out the list into two lists, one which only gets dumped from if times get REALLY rough (containing files that are accessed all the time throughout the game [i.e. interface graphics]) and the other that contains the 'other stuff', things like character graphics or map data that isn't accessed so often and if need be can be dropped in favour of more recently requested resources. This is designed to speed up any traversing of the constantly changing list that need be done. Of course, if I implement a data structure with fast and available random access then this distinction may not be necessary.
Of course, this being my first venture into the wide world of memory management AND C++, I'd be glad to hear any feedback and suggestions people might have on the subject
Thanks.
Fanatical praise aside, I've started work on my first C++ game and am umming and erring about what to use for my Resource Management. Clearly an STL List is a bad idea because of the need for random access (for grabbing re-requested resource references and planting them back at the top of the list). So my thought is would using an STL map, or an STL map that maps the filenames to the corresponding entries in the STL list be a good idea? What are the downsides to this?
Are there data structures you can suggest I research into that will be useful in this situation?
Oh, and I decided to separate out the list into two lists, one which only gets dumped from if times get REALLY rough (containing files that are accessed all the time throughout the game [i.e. interface graphics]) and the other that contains the 'other stuff', things like character graphics or map data that isn't accessed so often and if need be can be dropped in favour of more recently requested resources. This is designed to speed up any traversing of the constantly changing list that need be done. Of course, if I implement a data structure with fast and available random access then this distinction may not be necessary.
Of course, this being my first venture into the wide world of memory management AND C++, I'd be glad to hear any feedback and suggestions people might have on the subject
Thanks.
The post was edited 1 time, last by Mingoo ().