03 Mar, wifidi wrote in the 1st comment:
Votes: 0
Here's MurkMUD++'s game_loop pseudocoded in XML.

<!–This is XML-formatted pseudo-code of MurkMUD++'s game loop–>
<game_loop>
<!–input–>
<show_string>
page pause
next page
refresh
scroll back
</show_string>
<interpret> <!–commands or socials–>
<command>
<cmd_table>
do_north //common movement
do_east
do_south
do_west
do_up
do_down
do_buy //common other
do_cast
do_exits
do_get
do_inventory
do_kill
do_look
do_order
do_rest
do_sleep
do_stand
do_tell
do_wear
do_wizhelp
do_areas //informational
do_bug
do_commands
do_compare
do_consider
do_credits
do_equipment
do_examine
do_help
do_idea
do_report
do_pagelen
do_score
do_slist
do_socials
do_time
do_typo
do_weather
do_who
do_wizlist
do_auto //configuration
do_autoexit
do_autoloot
do_autosac
do_blank
do_brief
do_channels
do_combine
do_config
do_description
do_password
do_prompt
do_title
do_wimpy
do_answer //communication
do_auction
do_chat
do_chat (".")
do_emote
do_emote (",")
do_gtell
do_gtell (";")
do_music
do_note
do_question
do_reply
do_say
do_say ("'")
do_shout
do_yell
do_gag
do_gag ("ignore")
do_brandish //object manipulation
do_close
do_drink
do_drop
do_eat
do_fill
do_give
do_wear
do_list
do_lock
do_open
do_pick
do_put
do_quaff
do_recite
do_remove
do_sell
do_get
do_sacrifice
do_unlock
do_value
do_wear
do_zap
do_backstab //combat
do_backstab ("bs")
do_disarm
do_flee
do_kick
do_murde
do_murder
do_rescue
do_follow //miscellaneous
do_group
do_hide
do_practice
do_qui
do_quit
do_recall
do_recall ("/")
do_rent
do_save
do_sleep
do_sneak
do_spells
do_split
do_steal
do_train
do_visible
do_wake
do_where
do_advance //immortal
do_trust
do_allow
do_ban
do_deny
do_disconnect
do_freeze
do_hotboo
do_hotboot
do_shutdow
do_shutdown
do_users
do_wizify
do_wizlock
do_force
do_mload
do_mset
do_noemote
do_notell
do_oload
do_oset
do_owhere
do_pardon
do_peace
do_purge
do_restore
do_rset
do_silence
do_sla
do_slay
do_sset
do_transfer
do_mpstat
do_at
do_bamfin
do_bamfout
do_echo
do_goto
do_holylight
do_memory
do_mfind
do_mstat
do_mwhere
do_ofind
do_ostat
do_recho
do_return
do_rstat
do_slookup
do_switch
do_immtalk
do_immtalk (":")
do_mpasound //MOBprogram
do_mpjunk
do_mpecho
do_mpechoat
do_mpechoaround
do_mpkill
do_mpmload
do_mpoload
do_mppurge
do_mpgoto
do_mpat
do_mptransfer
do_mpforce
</cmd_table>
</command>
<social>
check_social
</social>
<charInProperPosition yes = "dispatch_command" />
</interpret>
<nanny>
CON_GET_NAME
CON_GET_OLD_PASSWORD
CON_CONFIRM_NEW_NAME
CON_GET_NEW_PASSWORD
CON_CONFIRM_NEW_PASSWORD
CON_GET_NEW_SEX
CON_GET_NEW_CLASS
CON_READ_MOTD (message of the day)
</nanny>
<!–autonomous game motion–>
<update_handler>
<area_update>
send a message to players that the area reset
check age and reset
</area_update>
<violence_update>
<multi_hit>
<one_hit>
is target there and alive?
what type of damage message (pound, slice, etc.)
<THAC0vAC>
<hit>
<npc>
from lev/2 to level * 1.5
+50% if armed
</npc>
<pc>
armed = low to high of wielded weapon
unarmed = 1d4
</pc>
<bonuses>
damroll
enhanced damage (+0-66%)
double damage on sleeping target
backstab (double damage + ch lev/8)
</bonuses>
if dam less than 1, dam is 1
</hit>
<miss>
damage 0 message
</miss>
</THAC0vAC>
<damage>
limit 1000
what if stunned, charmed or invis
sanctuary halves the damage
prot from evil 1/4's the damage
if damage is less than 0 damage = 0
if npc disarm check
if npc trip check
<check_parry>
npc chance lesser of 60 or level x 2
pc chance 0-50% + lev difference as % points
</check_parry>
<check_dodge>
same calc as parry
</check_dodge>
<dam_message>
miss…*** ANNIHILATES ***!
</dam_message>
</damage>
</one_hit>
</multi_hit>
</violence_update>
<mobile_update>
skip if a pc, in no room at all or charmed
<spec_fun>
<spec_breath>
any
acid
fire
frost
gas
lightning
</spec_breath>
<spec_cast>
<adept>
armor
bless
cure blindness
cure light
cure poison
refresh
</adept>
<cleric>
blindness
cause serious
earthquake
cause critical
dispel evil
curse
change sex
flamestrike
harm
dispel magic
</cleric>
<judge>
high explosive
</judge>
<mage>
blindness
chill touch
weaken
teleport
colour spray
change sex
energy drain
fireball
acid blast
</mage>
<undead>
curse
weaken
chill touch
blindness
poison
energy drain
harm
teleport
gate
</undead>
</spec_cast>
<spec_mob>
<executioner>
attack thieves and killers
create two cityguards
</executioner>
<fido>
devours corpses
</fido>
<guard>
attack theives, killers or sufficiently evil characters
</guard>
<janitor>
picks up trash
</janitor>
<mayor>
opens and closes Midguaard with comments along the way
</mayor>
<poison>
bites and poisons
</poison>
<thief>
steals gold
</thief>
</spec_mob>
</spec_fun>
skip if asleep or busy
randomly trigger MOBprogram
<mob_prog>
<in_file> <!–read prg's in .are files–>
mprog_read_programs
</in_file>
mprog_read_file <!–read a .prg file–>
</mob_prog>
scavenge
wander
flee
</mobile_update>
<weather_update>
send new weather to players
</weather_update>
<char_update>
hit
mana
mov
light/dark source use
idle chars go to limbo
less drunk
less full
more thirsty
affects wear off
poison damage
autosave and autoquit
</char_update>
<obj_update>
timers/deterioration
</obj_update>
<aggr_update>
attack the pc or equally from among pc's
</aggr_update>
<extract_dead_characters />
</update_handler>
<!–output–>
<process_output>
write_to_descriptor
</process_output>
</game_loop>

I plan to include details of the commands to then really be able to see what's running. Indenting was good enough for me, but then I thought if I send the file the formatting might not hold, or what if I accidentally mess it up.

Something I notice is that only from having been a text MUDer was I able to know what some of the code means, for example, show_string is the "page pause" selections like next and scroll back when there's more text to see.

Coding for text MUDs might not fit on a resume yet it sure prepared me for class!

–Wifidi
0.0/1