Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
Couple bugs
Dec 12, 2017, 5:42 pm
By Remcon
Bug in disarm( )
Nov 12, 2017, 6:54 pm
By GatewaySysop
Bug in will_fall( )
Oct 23, 2017, 1:35 am
By GatewaySysop
Bug in do_zap( ), do_brandish( )
Oct 18, 2017, 1:52 pm
By GatewaySysop
Bug in get_exp_worth( )
Oct 10, 2017, 1:26 am
By GatewaySysop
LOP 1.45
Author: Remcon
Submitted by: Remcon
LOP Heroes Edition
Author: Vladaar
Submitted by: Vladaar
Heroes sound extras
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.3
Author: Vladaar
Submitted by: Vladaar
Memwatch
Author: Johan Lindh
Submitted by: Vladaar
Users Online
CommonCrawl, Yahoo!, DotBot

Members: 0
Guests: 12
Stats
Files
Topics
Posts
Members
Newest Member
477
3,705
19,232
608
LAntorcha
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SWR FUSS » SWR and Extended Bitvectors
Forum Rules | Mark all | Recent Posts

SWR and Extended Bitvectors
< Newer Topic :: Older Topic >

Pages:<< prev 1, 2 next >>
Post is unread #1 Sep 14, 2009, 1:47 pm
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

I've added extended bitvector support to a stock SWR1.3FUSS. I already converted room_flags and converted the area files to this format as well. I'm curious as to if anyone is interested in this? I didn't know if this would be something that could be made part of the SWR FUSS package or not.

Also, does anyone think its worth making area saving like that of SMAUG1.8FUSS? Just curious.
       
Post is unread #2 Sep 14, 2009, 5:58 pm
Go to the top of the page
Go to the bottom of the page

Banner
Magician
GroupMembers
Posts169
JoinedNov 29, 2005

I am, although I'd like to see it done to languages as well.

As for the area saving? Why not?
       
Post is unread #3 Sep 14, 2009, 8:38 pm
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

I was definitely considering languages. Currently I've done player/mob act flags and room flags. I figured next I would do languages, then exit_info.

I figure once I get it converted I'll start working on changing the area formats.
       
Post is unread #4 Sep 15, 2009, 5:40 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

I've already got my local copy of SWRFUSS saving areas in a key'd format, I just got distracted with some other stuff and forgot to finish it. As for extended bitvectors, All of the FUSS Bases compile as C++. If we're going to upgrade, I'd rather see std::bitset employed.
       
Post is unread #5 Sep 15, 2009, 10:19 am
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

Yeah, I don't know C++ so I'm pretty clueless in those regards.
       
Post is unread #6 Sep 15, 2009, 10:33 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Bitvector - Limited to 32.
Extended Bitvector - Limited to 128.
std::bitset - Limited to a number we'll never ever be able to reach for a Mud. SO in all respects it's limitless.

They also look extremely clean.

For example:
 xIS_SET( ch->affected_by, AFF_BLINDNESS );

Or
 ch->affected_by.test( AFF_BLINDNESS );
       
Post is unread #7 Sep 15, 2009, 4:51 pm
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

I definitely like the look of that. I only wish I knew how to convert them to that hahaha.
       
Post is unread #8 Sep 16, 2009, 12:58 am   Last edited Sep 16, 2009, 1:01 am by Andril
Go to the top of the page
Go to the bottom of the page

Andril
Magician
GroupMembers
Posts147
JoinedJun 9, 2009

I did that for room flags in mine and it's a fairly simple process. A bitset is, in an overly simplified way of speaking, an array of bools. And they come with some handy little built in functions for manipulating elements in them.

These are the changes I made to mud.h.
using std::bitset; <-- put this up at the top.
It's not really necessary but it means you can just do what I did in room_index_data, as shown below, as apposed to typing std::bitset everywhere.

In room_index_data
EXT_BV room_flags;
is now
bitset < MAX_ROOM_FLAGS > room_flags; <-- notice there's no std:: before bitset thanks to the using directive

I also made copies of the (x)IS_SET/IS_EMPTY/TOGGLE_BIT/CLEAR_BITS macros like so:
#define xIS_SETx( var, bit ) ( (var).test( (bit) ) )
#define xIS_EMPTYx(var) ( (var).any() )
#define xTOGGLE_BITx(var, bit) ( (var).flip( (bit) ) )
#define xCLEAR_BITSx(var) ( (var).reset() )
These are mostly for the sake of ease of converting everything else from bitvectors/ext_bv's over to the bitsets. A global search and replace of IS_SET and xIS_SET to xIS_SETx is much easier than trying to go in and replace all the calls to the old macros from (x)IS_SET( var, bit ) to var.test( bit ).

Then it's simply a matter of converting all the things that use bitvectors to bitsets, and that's mostly an issue with deciding how to save and load the stuff, at least for me. I ended up just saving room flags in the same spot they were already being saved at in area files, except it's a long string of a lot of 0's and a few 1's. Not exactly the prettiest of things. I also threw a function template, courtesy of Samson, at the bottom which allows me Would be much nicer if I converted to the key'd area file format but I was mostly interested in getting it working than making it look pretty then.

Damn, now I have to do that. I hope you people are proud of yourselves! :)

Anywho, check here to get a more in-depth idea of how bitsets work.

P.S.
Here's the topic I'd made when I needed an assist while doing the room flags conversion. You might find something in there of some use.
       
Post is unread #9 Sep 16, 2009, 8:18 am
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

If you're seriously pushing forward with this, it's all a rather trivial change until you get to affects. And then you run into the underlying problems that caused me to abandon Smaug/Diku as a base for my mud and begin writing a base from scratch. So. Be forewarned. I'll get around to doing this for the releases eventually.. Life's being difficult right now.
       
Post is unread #10 Sep 16, 2009, 2:21 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

What problem did you run into that required you to start from scratch???
       
Post is unread #11 Sep 16, 2009, 2:41 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

       
Post is unread #12 Sep 16, 2009, 3:13 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

Ah I remember that one. They are intertwined quite a bit, but I've managed to figure out most of it all with little problems so starting over just because of it alone isn't a good reason lol. Don't get me wrong I still have a from scratch mud I started long ago around lol, so not saying its not good to start a scratch one, just not for that reason alone.
       
Post is unread #13 Sep 16, 2009, 4:07 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Oh, it wasn't just affects that made me start from scratch. It was a culmination of things, and Affects were the proverbial straw, so to speak.
       
Post is unread #14 Sep 16, 2009, 4:19 pm
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,858
JoinedJul 26, 2005

I once considered changing over to the std::bitset for LoP, but all the attempts kept giving me errors so I finally just gave up on the idea lol. So if you (or someone else) knows the right steps to take by all means explain. I think I had problems with it knowing what std::bitset was lol. Then you run into problems with saving and loading the things.
       
Post is unread #15 Sep 16, 2009, 4:40 pm
Go to the top of the page
Go to the bottom of the page

Kayle
Off the Edge of the Map
GroupAdministrators
Posts1,195
JoinedMar 21, 2006

Well, I know how to do it, but I'm not really sure how to put it into words.. if that makes any sense...


I can do it, but I'm not so great at explaining it.
       
Post is unread #16 Sep 16, 2009, 5:14 pm
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

Oh I know. Everything seems easy except affects. And those are a pain. I personally don't like the way they're done anyways.
       
Post is unread #17 Sep 16, 2009, 7:51 pm
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

I like the idea of going to the bitset system, however it isn't something I'll be able to do myself. Not really good with stuff like that. Extended Bitvectors is something I've done so many times its like second nature though haha.
       
Post is unread #18 Sep 23, 2009, 3:30 am
Go to the top of the page
Go to the bottom of the page

Halcyon
Magician
GroupMembers
Posts187
JoinedApr 12, 2005

Kayle said:

Bitvector - Limited to 32.
Extended Bitvector - Limited to 128.
std::bitset - Limited to a number we'll never ever be able to reach for a Mud. SO in all respects it's limitless.


Extended Bitvectors are hardly limited to 128. That may be the limit they're set up to have but expanding it is child's play.
       
Post is unread #19 Sep 28, 2009, 11:46 am
Go to the top of the page
Go to the bottom of the page

Keirath
Magician
GroupMembers
Posts144
JoinedJan 24, 2008

What are the differences in memory usage between the three? Is it even noticeable? I'm horrible with memory management. Something I need to learn more about.
       
Post is unread #20 Sep 28, 2009, 12:12 pm
Go to the top of the page
Go to the bottom of the page

David Haley
Sorcerer
GroupMembers
Posts903
JoinedJan 29, 2007

The "smart" objects will usually use slightly more memory, but not enough to worry about unless you are allocating a huge number of bit sets -- where "huge" means "far more than you are likely to allocate for a MUD". (I suppose that if you were running in a particularly memory-constrained environment, you might care, but other things on your MUD will affect this far more than the bit sets.)
       
Pages:<< prev 1, 2 next >>