Sign in to follow this  

MMO Arrays (Blitz 3D)

This topic is 3626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm having a little trouble with the arrays for an MMO. I can't think of a way to create the array for, say, 2,000 players with the abiliity to individually customize their characters w/out changing every character in the game (For players = 1 to 2000) and w/ out using millions of lines of code to create the individually customizeable characters. Any ideas? I thought that I might have to go with a Type but I'm lost there too. I know I'm a noob but be patient with me plz.

Share this post


Link to post
Share on other sites
If you have hash tables, then I suggest putting each player in its own structure/object, and giving each player an ID. The hash table then maps from ID to object, and you modify that object.

If you don't have hash tables, but you have linked lists and arrays, you can build a hash table on your own.

If you don't have structs/objects, then you can create one array per attribute (name, color, class, whatnot). Then, give each player an ID that is simply the index into this array. You must allow some slots in the array to be empty when players disconnect, and then re-use those empty slots when new players connect, so that the ID of existing players doesn't change.

However, given that you need help with these basic data structures, I suggest you try writing something simpler than an MMO -- or that you use an existing creation toolkit, such as RealmCrafter (which is aimed at newbies).

Share this post


Link to post
Share on other sites
Blitz3D/TCP Programmer. Blitz3D is not an OOP but has types, kind of like objects, this is the best way to do it.




Global ID%

Type Player

Field ID%
Field Name$
Field Level%
Field Race$
Field Class$
Field X#
Field Y#
Field Z#

End Type

P.Player = New Player
P\ID% = NewID()
P\Name$ = "Bob"
P\Level% = 70
P\Class$ = "Human" ;May want to change to integer
P\Race$ = "Warrior" ;May want to change to integer
P\X# = 0
P\Y# = 0
P\Z# = 0

LookID% = 1

For P.Player = Each Player

If P\ID% = LookID%

Print "Name: " + P\Name$
Print "Level: " + P\Level%
Print "Class: " + P\Class$
Print "Race: " + P\Race$
Print "X: " + P\X#
Print "Y: " + P\Y#
Print "Z: " + P\Z#

End If

Next

WaitKey
End

Function NewID()

ID% = ID% + 1

Return ID%

End Function






Hope that helped... I dont know your level of programmer experience, but the code above is fairly simple blitz code.

Share this post


Link to post
Share on other sites

This topic is 3626 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this