Door Programmers help :)

I am curious as to what the prefered method of storing user information in door games.. I currently use a set array of records then store that information to a file for retrieval when someone enters the door. Is there a better way? Is an array a requirement to storing the records properly? Meaning if you want to sort data or quickly scan for data at a later time will not using an array limit that function? I just want to use the most effective method..and I'm sure there are veterans here who may have an idea. Thanks. BTW: I use VP 2.1

Comments

  • : I am curious as to what the prefered method of storing user information in door games.. I currently use a set array of records then store that information to a file for retrieval when someone enters the door. Is there a better way? Is an array a requirement to storing the records properly? Meaning if you want to sort data or quickly scan for data at a later time will not using an array limit that function? I just want to use the most effective method..and I'm sure there are veterans here who may have an idea. Thanks. BTW: I use VP 2.1
    :
    :
    I hope I'm not off the mark here, but those games are based on going thru one door which leads to another set of information to another, etc. Sounds like a good place to use a tree. I assume that you have the "paths" thru your doors already drawn out. Use your tree to represent those paths. That should obviate the need for searching. References for trees can be found in Knuth, Sedgewick, and lots of other places. HTH
  • : I am curious as to what the prefered method of storing user information in door games.. I currently use a set array of records then store that information to a file for retrieval when someone enters the door. Is there a better way? Is an array a requirement to storing the records properly? Meaning if you want to sort data or quickly scan for data at a later time will not using an array limit that function? I just want to use the most effective method..and I'm sure there are veterans here who may have an idea. Thanks. BTW: I use VP 2.1


    I definitely think its a bad idea to use a set limit. The best example is LORD. A lot of popular BBS's have to run multiple games because each one can only hold 150 players. And since so many IGMs are also hardcoded to only read 150 player records, its too late to fix LORD...

    Anyway, I dont think VPascal supports this, but other Win32 compilers (Delphi/FPC for sure) can support dynamic arrays.

    [code]
    var
    PlayerArray: Array of PlayerRecord;
    [/code]

    That would define the array. Then to change its size you use SetLength like:

    [code]
    SetLength(PlayerArray, 100);
    [/code]

    Your player array would now have 100 records. You can increase/decrease it as often as you want, whenever you want.

    Another alternative is to use objects. Again Im not sure if VPascal can do it, but if you create a class that inherits TPersistent, you can create a custom object with which you can easily load all the records, add or delete some, sort them, and save them again.

    As for your question about not using arrays, it is definitely possible. All you need to do is read in records as you need them. If you want to sort them, you can create a temporary array. Unless you really need to store all the players in memory for the whole session, its not really a good idea (makes it harder to be true-multinode that way)
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories