Event Based Regeneration

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
1 year 1 hour ago #6759 by WhiskyTest
WhiskyTest created the topic: Event Based Regeneration
Hello all

I've made a patch for event based point regeneration. It's based off Eric Green's original Circlemud one here:
www.circlemud.org/pub/CircleMUD/contrib/...s/utils/regen.README

What it does:
Changes Hitpoint, Mana and Move regeneration from happening once every 60 seconds to happening in real time.
For example if someone normally gains 60 hitpoints every tick, they will now receive 1 hitpoint every second.
This re-write makes use of Vatiken's Mud Events, which is awesome and you should definitely be using this all the time.

Once installed the key thing to remember is to use these new functions when making changes to hitpoints/mana/move:
alter_hit(ch, amount);
alter_move(ch, amount);
alter_mana(ch, amount);
"Amount" will be deducted from the characters points. For healing you send a negative amount.

File Attachment:

File Name: EventRegeneration.zip
File Size:3 KB
Attachments:

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
5 months 3 weeks ago - 5 months 3 weeks ago #7158 by WhiskyTest
WhiskyTest replied the topic: Event Based Regeneration

File Attachment:

File Name: event-rege...1-26.zip
File Size:5 KB
The originally submitted snippet has been crashing due to bugs which I am unable to figure out - for now.

So, I have attached a tested and working alternative, which is Eric Green's original snippet updated for use with tbaMUD (there was in fact very little to update!).

When I finally do figure out how to integrate this into mud_events I will update this post.
Attachments:
Last Edit: 5 months 3 weeks ago by WhiskyTest. Reason: Added MSDP handling into patch file

Please Log in or Create an account to join the conversation.

More
5 months 6 days ago - 5 months 6 days ago #7252 by Sascha
Sascha replied the topic: Event Based Regeneration
I have this in and running over at After the Breaking as of today. It compiled and seems to be working.

I did receive the following warning, though, in relation to the new regen.c file:

regen.c: In function 'points_event':
regen.c:90:8: warning: format not a string literal and no format arguments [-Wformat-security]
log(logbuf);


This is outside my wheelhouse, so if you have any feedback on that - or if I'm the first to report it and you plan to work on it - I'm all ears!

Dovie'andi se tovya sagain. After the Breaking MUD, now in beta testing...
Last Edit: 5 months 6 days ago by Sascha.

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
5 months 6 days ago #7253 by WhiskyTest
WhiskyTest replied the topic: Event Based Regeneration
This is a warning that is telling you the compiler cannot see exactly what string is going to be printed with the log() function. If you make an error creating the string it could cause unexpected things to happen.
For example if it sent "strings are fun to %s" as a string, the %s needs a value and would crash.

My compiler doesn't warn me about this so I've not seen it before.

I think you can eliminate the warning by changing the lines to :
  log( "SYSERR:  Unknown points event type %d", type);
If that works you can remove the sprintf line, and the char log[100] won't be needed either.

Please Log in or Create an account to join the conversation.

More
3 months 1 day ago #7606 by cunning
cunning replied the topic: Event Based Regeneration
Just wondering why you left this as a separate event, instead of incorporating it into dg_event.c and mud_event.c

When i did this a long long time ago, I went the same direction you did. It works great, but it would crash on specific free'ing of events. I do not remember what that was. I am going to look into this further. I am integrating it into JediMUD test port. It already has an advanced regen system in, and if i can get all 3 to gel. That would rock!

3 things are incorporate into mud_event/dg_event, JediMUD regen system, and the mobile regen system we have.

I really do like this.

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
2 months 4 weeks ago #7618 by WhiskyTest
WhiskyTest replied the topic: Event Based Regeneration
I initially made one using the built-in events but it was unstable and would crash due to events not freeing correctly. I rewrote the one above for tbamud and it is well tested.

I will be revisiting incorporating this into mud events this year just to get everything streamlined. Feel free to try the first attachment which attempted this and see if you can find why it's crashing :)

Please Log in or Create an account to join the conversation.

More
2 months 4 weeks ago #7619 by Fizban
Fizban replied the topic: Event Based Regeneration
Not sure this is to blame, but ATBMUD has been crashing a lot recently-ish and I know this was added there.

Please Log in or Create an account to join the conversation.

More
2 months 3 weeks ago #7623 by cunning
cunning replied the topic: Event Based Regeneration
I am adding this to JediMUD and it is going to get put through a ton of testing this weekend. I plan to try and integrate into mud_events and dg_events and i will deep dive the free issue Whiskytest mentioned.

Please Log in or Create an account to join the conversation.

More
2 months 2 weeks ago #7642 by cunning
cunning replied the topic: Event Based Regeneration
I had to stop, i had to many crashes using it. I had it almost all the way patched using the LISTS, but after reading several of Thomas's responses i gave up that path and tried just patching as is. That crashed way to much, and it has to do with how I have my current regen system in. I may give it another shot but i am late with another release.

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
3 weeks 3 days ago #7983 by WhiskyTest
WhiskyTest replied the topic: Event Based Regeneration
Take two (or ten..) is attached.
Tested on the latest tbaMUD 2018.1, no crashes so far.

It integrates with the existing mud_event system as originally intended.

Just make sure wherever points are changed you don't touch them directly, but use alter_hit(), alter_mana() etc.

File Attachment:

File Name: event-regen-2.zip
File Size:3 KB
Attachments:

Please Log in or Create an account to join the conversation.

More
3 weeks 1 day ago - 3 weeks 1 day ago #7992 by Sascha
Sascha replied the topic: Event Based Regeneration
Keeping in mind that I've got your first stab at this running in my game, is there meant to be an update to regen.c?

regen.o: In function `alter_mana':
/home/atbmud/atbmud2018/src/regen.c:165: multiple definition of `alter_mana'
limits.o:/home/atbmud/atbmud2018/src/limits.c:549: first defined here
regen.o: In function `alter_move':
/home/atbmud/atbmud2018/src/regen.c:198: multiple definition of `alter_move'
limits.o:/home/atbmud/atbmud2018/src/limits.c:567: first defined here
regen.o: In function `alter_hit':
/home/atbmud/atbmud2018/src/regen.c:107: multiple definition of `alter_hit'
limits.o:/home/atbmud/atbmud2018/src/limits.c:532: first defined here
regen.o: In function `check_regen_rates':
/home/atbmud/atbmud2018/src/regen.c:229: multiple definition of `check_regen_rates'
limits.o:/home/atbmud/atbmud2018/src/limits.c:585: first defined here
collect2: error: ld returned 1 exit status
make[1]: *** [../bin/circle] Error 1
make[1]: Leaving directory `/home/atbmud/atbmud2018/src'
make: *** [all] Error 2

Dovie'andi se tovya sagain. After the Breaking MUD, now in beta testing...
Last Edit: 3 weeks 1 day ago by Sascha.

Please Log in or Create an account to join the conversation.

  • WhiskyTest
  • WhiskyTest's Avatar Topic Author
  • Offline
  • Gold Boarder
  • Gold Boarder
More
3 weeks 21 hours ago - 3 weeks 21 hours ago #7996 by WhiskyTest
WhiskyTest replied the topic: Event Based Regeneration
Yep regen.c can be deleted completely as all those functions were moved to limits.c.

Actually I wouldn't advise putting this in to a live MUD just yet; further testing today has revealed that when a character quits the game, two warnings appear:

:: WARNING: Attempting to get content from iterator with NULL list.
:: WARNING: Attempting to remove iterator from NULL list.

The MUD doesn't crash - but there is something screwy with the event_cancel part of players leaving the game.
Will keep plodding away at this haha

Edit: these warnings only appear when more than one event is still queued on the player. A single event cancels fine without the warnings.
Last Edit: 3 weeks 21 hours ago by WhiskyTest. Reason: additional info

Please Log in or Create an account to join the conversation.

More
3 weeks 18 hours ago #7998 by Sascha
Sascha replied the topic: Event Based Regeneration
Interesting. That is also the error block that is displayed when someone uses Whirlwind.

I'll hold off on implementing this one then. Rats!

Dovie'andi se tovya sagain. After the Breaking MUD, now in beta testing...

Please Log in or Create an account to join the conversation.

Time to create page: 1.429 seconds