Register forum user name Search FAQ

Gammon Forum

Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the password reset link.
 Entire forum ➜ SMAUG ➜ SMAUG coding ➜ Player recognition

Player recognition

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Dace K   Canada  (169 posts)  Bio
Date Fri 07 Jan 2005 10:48 PM (UTC)
Message
Hey. Been toying with the idea of making player recognition - in other words, players would not see each other's names in room descs unless they had met and interacted with that player before.

For example, if Bob had met Sally, or seen a photograph of her, he would see:
(rdesc) Sally is here.
(say) Sally says 'blah'.

If not, he would see:
(rdesc) A blonde caucasian woman is here.
(say) A blonde caucasian woman says 'blah'.

Only problem is, the only way I can think of to do this would be to add a name to the bottom of the player's pfile every time they meet someone, then run a massive ifcheck every time a player's name is called, to see if substitution comes in or not. This'd be rather long, messy, and take up quite a bit of memory and CPU time =P.

So.. anyone out there have any ideas about how else this could be done? =)

ASJ Games - .Dimension 2, Resident Evil, and snippets - oh my!
http://asj.mudmagic.com

Drop by the area archives and find something for your mud. http://areaarchives.servegame.com
Top

Posted by David Haley   USA  (3,881 posts)  Bio
Date Reply #1 on Fri 07 Jan 2005 11:42 PM (UTC)
Message
It's not that bad to store a name per person the player knows. You can be much more clever however about how to store the data in memory.

You can use a (non-compact for simplicity) 'trie' for instance:
http://www.cs.mcgill.ca/~cs251/OldCourses/1997/topic7/
That site is good because it has pictures that help show you how these things work. Tries are very good at storing space, and also very, very fast - instead of having lookup time grow with number of names, lookup time is a direct linear function of the length of the word being looked up. Compact trees can save even more time.

Tries are a little complex though. If you want something more traditional, you can use a binary search tree, or a hash table. Of course, since you're in C I think, you'll have to implement these yourself unless you find an implementation somewhere. :)

Come to think of it, if you store the names as a trie, then you could even store a serialized form of the trie in the player file which would be quite compact indeed - definitely more so that storing an entry for every player.

FYI, if I were to do this, I'd use a trie and store it in the player file in a serialized form of the trie.

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
Top

Posted by Txzeenath   USA  (54 posts)  Bio
Date Reply #2 on Fri 29 Apr 2005 01:15 PM (UTC)
Message
Hmm i've been planning on doing this type of thing for my mud, hehe think i'll check out that link and watch how this topic goes :-p I'd love to be of help rather than a leach.. but storing of info isn't exactly my strong suit *looks at his 300,000 byte act_wiz.c*

Darkness comes along thy path, searching, wanting, calling wrath,
shadows awaken, release the light, one and only.. here to fight,
challenge the darkness, the shadows they call, hunting the living,
more and all. Roaring thunder, full of hate, a single bound, seals
your fate.

-Txzeenath

telnet://divineright.org:8088
Alumuble Arda -
*Player owned shops, clans, and housing
*Multiclass & Stat training
*Random mob name generation implemented and Overland mapping.
*Realistic equipment statistics
*Interactive enviroment(weather/sectors)
*Weapon sheaths(scabbards), Throwing weapons
*Automatic crash recovery, saving, and reporting without disconnecting
*Fully customizeable color, Automapper, "Smart" mobiles, Hiscore tables, and more!

Currently running AGE v1.9.6(Originated and modified from Smaug 1.4a)
Top

Posted by Meerclar   USA  (733 posts)  Bio
Date Reply #3 on Fri 29 Apr 2005 10:45 PM (UTC)
Message
Well, one option is to look at a codebase that already has such a feature and see how it's done there (DoT just happens to have this btw)

Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org
Top

Posted by Dralnu   USA  (277 posts)  Bio
Date Reply #4 on Sat 30 Apr 2005 12:21 AM (UTC)
Message
If you don't want to forse it to save all the names, give each player a 3-digit code, then set it to run a search. It will help minimize the space needed for the pfile.

When running the search, have it check the target player's code, and instead of going through all the code, run a search over just the first digit to help narrow the search, and maybe speeding it up slightly. Sectioning the pfile off with something similar to:

#Startdigit
1
123
124

ect.

Just an idea, hope it helps.
Top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


18,679 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.