game hashtable

This is a discussion on game hashtable within the C++ Programming forums, part of the General Programming Boards category; Hello, I'm pretty new to c++. I have been using it for a little over 3 weeks. I programmed in ...

  1. #1
    Registered User
    Join Date
    Dec 2005
    Posts
    8

    game hashtable

    Hello, I'm pretty new to c++. I have been using it for a little over 3 weeks. I programmed in Visual Basic .net for a few years before that but now I'm trying to break away from microsoft dependance. Anyway to the point. I want to make a class that works like a hashtable with a string or character array for a key and a SDL_Surface for a value. The hard part is I would like it to store the data in 2 different places I would like it to keep Surfaces that are used alot in video memory but swap little and not used surfaces to system memory because most people have more system memory than video memory. I was thinking that the function to sort/swap the surfaces could be called from my game loop. Maybe I should have asked this on a gamming forum but I thought this was more of a data structure question. Anyway please help!

  2. #2
    Rabble Rouser Slacker's Avatar
    Join Date
    Dec 2005
    Posts
    116
    Off the top of my head, I would say that you can use a container class that meets your needs, but the standard containers don't include a hash table yet, and then write a custom allocator that does what you want. But, with such little experience using C++, that's not really a good solution. You're better off just using what you do know to approximate what you want to do.

    >The hard part is I would like it to store the data in 2 different places
    As long as you know how to differentiate between the data that's stored in video memory and the data that's stored in system memory, and how to do the actual storage of course, it shouldn't be too hard to write a specialized class that does what you want.

    >Maybe I should have asked this on a gamming forum but I thought this was more of a data structure question.
    It's probably more of a game question, so it couldn't hurt to ask there too. At least then you'll be talking to people who are doing the same things as you're trying to do since the forum is more specialized than this one. I don't write games.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. how do the game engine and the api interact?
    By Shadow12345 in forum Game Programming
    Replies: 9
    Last Post: 12-07-2010, 11:08 PM
  2. game engine advice?
    By stien in forum Game Programming
    Replies: 0
    Last Post: 01-23-2007, 02:46 PM
  3. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  4. My Maze Game --- A Few Questions
    By TechWins in forum Game Programming
    Replies: 18
    Last Post: 04-24-2002, 11:00 PM
  5. oh me oh my hash maps up the wazoo
    By DarkDays in forum C++ Programming
    Replies: 5
    Last Post: 11-30-2001, 11:54 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21