|
-
May 1st, 2001, 05:04 PM
#1
Thread Starter
Fanatic Member
storage of data
hi,
I'm writing a footy manager game and i wanted some help on how to store the data, as you can imagine there will be quite a lot(15 or so attributes for each player).
A team would be made up of a number of players(so a file or table for each team?)
I think I have 3 options. 1, a database(done in Access). 2, Store the data in random access files, and 3, store the data in flat text files.
Just wanted your advice on which one you would use and any hints on how best to implement it.
Thanks
Nick.
p.s. I was thinking of doing it using random access files.
-
May 1st, 2001, 08:01 PM
#2
Good Ol' Platypus
2. Random File Access!!
The best step inbetween BAD files and GOOD databases.
Why I suggest this method is you can implement the UDTs right in without seperating them:
Code:
Dim Players(5) as myUDT
Put #1, 1, Players(5)
And then you can retrieve them in the same way:
Code:
Dim Players(5) as myUDT
Get #1, 1, Players(5)
This is why I suggest Random file access.
All contents of the above post that aren't somebody elses are mine, not the property of some media corporation. 
(Just a heads-up)
-
May 1st, 2001, 08:17 PM
#3
transcendental analytic
Random Access is very limited if you compare to Binary Access, that's why a suggest the later.
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
-
May 2nd, 2001, 02:12 AM
#4
Retired VBF Adm1nistrator
I think you should use a flat file and open with binary access.
I would store the flatfile something like this :
david ginola,23,564,234,65,sajdi
ronaldo,34,543,645,23,jfsdj
robaldo,31,423,23,43,ewrjrj
Then for reading in values you'd just do something like :
Code:
Private Type playerType
Name As String
SomeInt1 As Integer
SomeInt2 As Integer
SomeInt3 As Integer
SomeInt4 As Integer
SomeString As String
End Type
Private Players() As playerType
Private Sub Form_Load()
Open "C:\players.dat" For Binary As #1
Dim strTemp As String
Dim strArray() As String
Dim strArray2() As String
Dim i As Long
ReDim Players(0)
strTemp = Input(LOF(1), 1)
strArray = Split(strTemp, vbCrLf)
For i = 0 To UBound(strArray)
strArray2() = Split(strArray(i), ",")
With Players(UBound(Players))
.Name = strArray2(0)
.SomeInt1 = strArray2(1)
.SomeInt2 = strArray2(2)
.SomeInt3 = strArray2(3)
.SomeInt4 = strArray2(4)
.SomeString = strArray2(5)
End With
ReDim Preserve Players(UBound(Players) + 1)
Next i
Close #1
End Sub
Last edited by plenderj; May 2nd, 2001 at 02:18 AM.
Microsoft MVP : Visual Developer - Visual Basic [2004-2005]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|