Top Mud Sites Forum

Top Mud Sites Forum (http://www.topmudsites.com/forums/index.php)
-   MUD Coding (http://www.topmudsites.com/forums/forumdisplay.php?f=9)
-   -   Your "greatest" code innovation... (http://www.topmudsites.com/forums/showthread.php?t=379)

Terloch 01-24-2003 09:32 AM

The coding forum, sans the couple of questions that pop up on something, is pretty slow of late, so I'll throw out a question for all the coders out there...

What is your greatest code innovation that you've added to the code you run and/or the mudding community (if you've published it? Is it something behind the scnene to make things run faster, or something the players all can use and rave about because it's cool and unique?

No posting of things like a class, I'm looking for specific single instances of things...

Terl

Yui Unifex 01-24-2003 02:23 PM

I've to the public domain =). The potential users of my codebases aren't your average mud coder though, as most sections of the code are overengineered and the entire system requires a thorough knowledge of C++ and related programming principles to understand. Its primary goal (aside from my own entertainment ;)) is to be of use to those that wish to see how certain code designs play out in a working implementation. So it's only really of any utility to people concerned with these design issues, i.e. those that are writing codebases themselves.

Certain ideas I've been working on through the codebase are template systems for modifying the format and content of strings in the game, generic database layers, inheritance-driven client/server architecture, dynamic loading of compiled code, a one-type system for objects (not different types for things like inanimates, mobs, pcs, areas, etc.), traditional and spacial area systems, and little things here and there to increase maintainability and robustness =).

Eternal 01-24-2003 04:36 PM

In coding for a privately-run Shadowrun MUD, I finally finished my greatest work about a year ago.  A simple perception code that checks against intelligence (using the Shadowrun system) whenever you look at someone.  It uses the "conceal" numbers from the books, and remembers what you can and cannot see (on a given individual) for an in-game day.

E.g. when a not-too-sharp person types 'look troll', they get:

The trolls description is here.
The troll is using:
<worn on body>A pleated, armored jacket
<worn on legs>A pair of leather pants
<worn on feet>A pair of army boots

This works even if the troll has hidden items under his jacket (the conceal code again).  Someone with better luck on their perception roll might see:

The trolls description is here.
The troll is using:
<worn on body>A pleated, armored jacket
<hidden>An Ares Predator II
<hidden>A hold-out pistol
<worn on legs>A pair of leather pants
<hidden>A NarcojectTM pistol
<worn on feet>A pair of army boots
<hidden>Many NarcojectTM darts

Thought it was pretty nifty... only took me about 2 weeks to work the bugs out, heh.

visko 01-28-2003 08:54 PM

Hey there,

My last thread showed a little bit of what I was doing, and I've now finished my "biggest accomplishment" to date...

It's a restructuring of OLC that should make builders much happier. Based on Ivan's OLC, it takes out the ability for immortals to add areas and assigns that to the implementor only, and then uses "segments", or logical segmenting of area files, to keep track of what zone is which.

This on the surface seems pretty pointless, but the added bonuses continue to pop up. Segments don't have predefined numbers of vnums to be used with them, so the builder can create anything they want and never have to worry about vnum holes (unused vnums within an area); the code takes care of looking up the last vnum used in the area, and the room/obj/mob is automatically assigned a number which correllates to the segment being added to.

Not only that, but in a one-area MUD with logical segmenting of the vnums, you can reset anything anywhere, so there's no more need to copy over the values of that cool sword or beefy ogre you saw in someone else's area; just reset it, and go.

I'm continuing to pursue this restructuring, looking for ways to make it better, and I'll be releasing my code base as a whole in probably 6 months give or take, and I'll be happy to give out a patch to the mud community at that point.

-Visko

Teelf 01-28-2003 09:48 PM

I coded a datastructure which is released to the public domain.

A spheretree is a version of an using spheres instead of rectangles. A spheretree is a data structure used for handling spatial data. For example, storing objects in a 3D coordinate system.  R-tree's are especially suited for dynamic insertion/deletion as well as for point data. And R-Tree's are well suited for MUD's in general if the MUD uses any type of "real" spatial representation (such as a 2d/3d coordinate system or grided room system).

I encourage any MUD wanting a roomless system to take a look!

JilesDM 01-29-2003 12:28 AM

Just out of curiosity, why did you make a "spheretree" system? I can't think of a reason not to use R-trees because you need to use the rectilinear bounding box of the given polygon in order to do the initial culling efficiently. With a sphere-based system, you need to calculate a vector normal for every single test, which, I would think, would bog you down considerably.

Teelf 01-29-2003 01:01 AM

Because spheres are more simple than rectangles.  You can give a rectangle a bouding sphere and cull off of that vice the bounding box.

I'm not sure what you mean.  Which normal are you refering to?

JilesDM 01-29-2003 01:48 AM


Teelf 01-29-2003 02:19 AM

Determining if a point intersects a sphere requires only one check.

[code] bool Sphere;;Intersects(const Vector& point)
{
float flSqrDist = SqrDistance(_vecCenter, point);
return (flSqrDist < (_flRad*_flRad));
}[/quote]

With SqrDistance returning the squared distance from the sphere's center to the point in question. And _flRad is the sphere's radius.

No square roots and only 1 check versus 6 for a rectangle.  Spheres are computationally cheaper than rectangles in almost any use.

NOTE: In case people are thinking this is about graphics, it's not.  This is all very applicable to text MUDs.

JilesDM 01-29-2003 02:38 AM

Yes, but you're forgetting what SqrDistance() does. It does n subtractions, n multiplications, and finally n-1 additions, as opposed to simply 2n comparisons, where n is the dimensionality of the given space.

fredrik 01-29-2003 08:13 AM


xanes 02-22-2003 09:22 PM


halkeye 02-23-2003 07:32 PM

I think some of my greatist innovations for my old mud was when i got sorta semi-annoyed at players and became a sadisitic coder..

So i started to make things like stds and breaking of bones, which impared movement as well as abilitiy to do skills and such.

yea..

angelbob 02-26-2003 07:58 PM

I'm the author of the for DGD. So that's probably my greatest contribution to MUDding. Within that, probably the UNQ save/load system including DTDs. It's kinda like XML, but different.


All times are GMT -4. The time now is 09:53 AM.

Powered by vBulletin® Version 3.6.7
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright Top Mud Sites.com 2022