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, 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 ➜ MUDs ➜ General ➜ BetterMUD or SimpleMUD under Linux

BetterMUD or SimpleMUD under Linux

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


Posted by Thorbenn   (25 posts)  Bio
Date Thu 18 Aug 2011 01:46 PM (UTC)
Message
Hi,

I wanted to know if anyone has managed to get one of the two MUDs from the Book Mud Game Programming to compile under Linux. I tried getting gcc 2.95.3 and 2.96 to install under Ubuntu 11.04 and under Open Suse 11.4 but this doesn't work. I wanted to know if anyone remembers a Linux distribution with integrated gcc where compiling of one of the muds still worked? Or if its possible to get a gcc version to work with code::blocks ide or dev-cpp. The Question is there always how :-) . I got it to run under Visual C++ author edition but with this i wouldn't be allowed to run it for others then me to connect to.
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #1 on Thu 18 Aug 2011 08:58 PM (UTC)
Message
My recollection is that it used to compile, before the g++ compiler was tightened up.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Thorbenn   (25 posts)  Bio
Date Reply #2 on Sat 20 Aug 2011 01:45 PM (UTC)
Message
Hi Nick,

ok so which version would still work? 3.3 is probably to late allready. I am trying to get an older copy 2.95 to install but this is also a bit of a thorn since it won't make right on new ubuntus.
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #3 on Sat 20 Aug 2011 10:47 PM (UTC)
Message
I don't know, the book is quite old. To be honest, although the book has a lot of useful information about programming MUD servers, you are probably better off with a codebase like SmaugFUSS (which is actively maintained).

I did some posts a while back about how to add Lua scripting to it, so you could use that if you want to have more powerful scripting than mob progs.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Thorbenn   (25 posts)  Bio
Date Reply #4 on Tue 23 Aug 2011 02:31 PM (UTC)

Amended on Tue 23 Aug 2011 08:58 PM (UTC) by Nick Gammon

Message
okay i must as well give it up to compile it with gcc and stick to vc++6. One last question though . I have been sitting here wondering how to do this one. I added a function PvP to the game but right now i can only attack the first player that is in the room. How do i get it that i can pick who i want to attack in the room. I know it will be easy and fast answered but right now i can't find how.


void Game::PVP(const string& p_player) {
Player& e = *m_player;
   room r = e.CurrentRoom();
   sint64 now = Game::GetTimer().GetMS();   
   std::list<player>::iterator itr = r->Players().begin();
   Player& p = **itr;

    int damage;
    if( e.Weapon() == 0 )
    {
        damage = BasicLib::RandomInt( 1, 3 );
        e.NextAttackTime() = now + seconds( 1 );
    }
    else
    {
        damage = BasicLib::RandomInt( e.Weapon()->Min(), e.Weapon()->Max() );
        e.NextAttackTime() = now + seconds( e.Weapon()->Speed() );
    }
    if( BasicLib::RandomInt( 0, 99 ) >= e.GetAttr(ACCURACY) - p.GetAttr( DODGING ) )
    {
        Game::SendRoom(newline + yellow + e.Name() + " slashes at " + p.Name() + 
                        " but misses!", e.CurrentRoom() );
        return;
    }
    damage += e.GetAttr(STRIKEDAMAGE);
    damage -= p.GetAttr( DAMAGEABSORB );
    if( damage < 1 )
        damage = 1;
    p.AddHitpoints( -damage );
    Game::SendRoom(newline + red + e.Name() + " hits " + p.Name() + " and inflicts " + 
                    tostring( damage ) + " damage!", e.CurrentRoom() );
    if( p.HitPoints() <= 0 )
        PlayerKilled( p.ID() );
}

Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #5 on Tue 23 Aug 2011 09:06 PM (UTC)
Message
You need to iterate through the list of players.

This just gives the first player in the room list:


   std::list<player>::iterator itr = r->Players().begin();


I note you are not even testing if you have any players, which is a bug.

Here is the part of this forum about STL:

http://www.gammon.com.au/forum/?bbtopic_id=111

Something like this (untested) should do it:


std::list<player>::iterator itr;

for (itr = r->Players().begin(); itr != r->Players().end(); itr++)
  {
  Player& p = **itr;
  
  if (p.Name == "Nick")     // or whatever test
    break;

  }  // end of for loop   

if (itr == r->Players().end())
  {
  // error: wanted player not found
  return; 
  }

Player& p = **itr;

// attack player p


- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Thorbenn   (25 posts)  Bio
Date Reply #6 on Wed 24 Aug 2011 08:43 AM (UTC)

Amended on Wed 24 Aug 2011 01:08 PM (UTC) by Thorbenn

Message
thanks for the fast reply.I didn't even realize that was missing. One qestion inside the for loop or how it is called in english it should get the players name that you want to attack.

if (p.Name == "Nick") // or whatever test
break;

how could i read out the name from the players file or from the room to get who i want to attack. now i could only attack the player nick. I am new to mud game programming just on the side for information :)
Top

Posted by Nick Gammon   Australia  (23,070 posts)  Bio   Forum Administrator
Date Reply #7 on Wed 24 Aug 2011 11:30 PM (UTC)
Message
Er, I don't know how, exactly. How would you want to do it? For example if you type "attack Thorbenn" then presumably that is the name to compare against.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Thorbenn   (25 posts)  Bio
Date Reply #8 on Thu 25 Aug 2011 10:11 AM (UTC)

Amended on Sat 27 Aug 2011 07:43 AM (UTC) by Thorbenn

Message
exactly if i typ in attack thorbenn that if he is in that room that he gets attacked.

does anyone else maybe have an idea how i can get the data of the specific player i want to attack. right now i could only attack the player nick or if i change it a bit the first player in the room. And he would also only be able to attack himself
Top

Posted by Prim   (6 posts)  Bio
Date Reply #9 on Mon 05 Sep 2011 08:17 AM (UTC)

Amended on Mon 05 Sep 2011 08:31 AM (UTC) by Prim

Message
Fews days ago, I complied them both under Ubuntu 11.04.
I dont know the version of g++ and python, they just in in Ubuntu already.

I just used g++ and make compile them. Not with IDE.
Do u need any help of modif the code and makefile?

Now I am trying to write a python version of BetterMUD.

Maybe u could send a mail about the problem when u complie the code..But not the PVP~I just more like the design of BetterMUD.

my email: 121012#qq.com
Top

Posted by Dr_who   (5 posts)  Bio
Date Reply #10 on Sat 10 Sep 2011 12:10 AM (UTC)
Message
There is a supposedly working copy of Bettermud found here:
https://briandamaged.org/blog/?p=412
Top

Posted by Thorbenn   (25 posts)  Bio
Date Reply #11 on Sun 25 Sep 2011 09:22 AM (UTC)
Message
Hi Prim,

what i get is long errors of files missing which i guess are the libraries and synthax errors. but when i compile it with vc++ 6 it works fine without any errors. did you have to change anything on the code to make it compile under ubuntu or just like it was from the book?

About the pvp anyone an idea? After 3 weeks of not working on any of it i still have to find a way.
Top

Posted by Istarian   (7 posts)  Bio
Date Reply #12 on Thu 29 Sep 2011 01:12 AM (UTC)

Amended on Thu 29 Sep 2011 01:22 AM (UTC) by Istarian

Message
You tried the supposedly working copy, right? I just tried getting it today for kicks on a mud hosting account on a guy's server. It has Python 2.6 and gcc 4.4.5 I think. I got through the 'make libs' and 'make bettermud' stages, but the 'make link' bit didn't work.

There's a bunch of lines of "... relocation # has invalid symbol index #" and then the following:


...

/usr/lib/gcc/x86_64-linux-gnu/4.4.5/../../../../lib/crt1.o:In
function `_start':
(.text+0x20): undefined reference to `main'
collect2: ld returned 1 exit status
make: *** [link] error 1
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.


35,269 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.