powerup plugin 0.01 alpha

Questions, comments, and news on the server side plug-ins and it's API
Post Reply
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

powerup plugin 0.01 alpha

Post by The Vaxorcist »

That's right the alpha of 0.01... aka pre-pre-pre-alpha

This little beauty will change server variables every so often, ie making everyone able to run really fast (and promptly get autokicked for it :wink: ), shoot fast, jump high, etc. More details on a previous thread.

I'm only distributing the source right now. It is too small for me to bother making a windows binary (though I might... eventually), and if you have linux, well you should be building it anyway.

I should mention that the idea for the plugin was Spazzy Mcgee's, who also wrote the applescript version.

Configuring it is a dog right now. you can change the timing of the powerups by tweaking the constants constants.h, make clean, and make, but anything more, and you will have to be a C++ programmer (sorta). (and yes, It will have it's own config file, once again, eventually.)

Here it is.

PS: WHAT?!!?? I have to use gzip to compress it. Stupid forum.
Attachments
powerup.tar.gz
This doesn't contain any binaries. Sorry.
(3.11 KiB) Downloaded 302 times
Last edited by The Vaxorcist on Wed Oct 12, 2005 6:52 pm, edited 1 time in total.
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

Code: Select all

mofo@linux:~/powerup> su
Password:
linux:/home/mofo/powerup # make
g++ -fPIC -I../../include -g   -c -o powerup.o powerup.cpp
powerup.cpp:7:21: bzfsAPI.h: No such file or directory
In file included from powerup.cpp:8:
poweruptracker.h:6:21: bzfsAPI.h: No such file or directory
In file included from powerup.cpp:8:
poweruptracker.h:11: error: syntax error before `{' token
poweruptracker.h:14: error: destructors must be member functions
poweruptracker.h:14: error: virtual outside class declaration
poweruptracker.h:16: error: `bz_EventData' was not declared in this scope
poweruptracker.h:16: error: `data' was not declared in this scope
poweruptracker.h:16: error: virtual outside class declaration
poweruptracker.h:16: error: variable or field `process' declared void
poweruptracker.h:18: error: syntax error before `protected'
poweruptracker.h:21: error: syntax error before `}' token
powerup.cpp:14: error: syntax error before `;' token
powerup.cpp:18: error: syntax error before `int'
powerup.cpp:21: error: `bz_eTickEvent' was not declared in this scope
powerup.cpp:21: error: `tracker' was not declared in this scope
powerup.cpp:21: error: ISO C++ forbids declaration of `bz_registerEvent' with
   no type
powerup.cpp:21: error: initializer list being treated as compound expression
powerup.cpp:22: error: ISO C++ forbids declaration of `bz_debugMessage' with no
   type
powerup.cpp:22: error: initializer list being treated as compound expression
powerup.cpp:22: error: invalid conversion from `const char*' to `int'
powerup.cpp:23: error: syntax error before `return'
powerup.cpp:26: error: syntax error before `int'
powerup.cpp:29: error: ISO C++ forbids declaration of `bz_debugMessage' with no
   type
powerup.cpp:29: error: redefinition of `int bz_debugMessage'
powerup.cpp:22: error: `int bz_debugMessage' previously defined here
powerup.cpp:29: error: initializer list being treated as compound expression
powerup.cpp:29: error: invalid conversion from `const char*' to `int'
powerup.cpp:30: error: syntax error before `return'
make: *** [powerup.o] Error 1
linux:/home/mofo/powerup # make clean
rm *.o
rm: cannot remove `*.o': No such file or directory
make: [clean] Error 1 (ignored)
rm *.so
rm: cannot remove `*.so': No such file or directory
make: [clean] Error 1 (ignored)
linux:/home/mofo/powerup #        
Fix that - and I dare ya to draft us a sample config file to show us a demo of its capabilities.
...This has been a recording.
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

Post by The Vaxorcist »

I_died_once wrote:Fix that - and I dare ya to draft us a sample config file to show us a demo of its capabilities.
Oops, I forgot to mention that you have to unpack it into the plugins directory in the bzflag source.
so you have:

Code: Select all

cd ~/bzflag-2.0.4.20050930/plugins
tar -xzf ~/powerup.tar.gz
cd powerup
(your text editor here) constants.h
make
cp powerup.so (wherever you want)
Or, you might be able to copy bzfsAPI.h into the powerup folder.

constants.h is the only way to configure the plugin -- it's well commented.

And, WHY are you building it as root? Serious security flaw. If I messed with my makefile, I could junk your system.
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

OK, I got the plugin to compile.

Loaded fine. The first time it went to do its thing, it crapped out on me. Here is a backtrace I did, as I did a core dump for ya.

Running today's CVS, the powerup plugin, as well as all the other factors tha *is* Planet MoFo.

I like it a little already, as it does something like what Iplan on having bzfscron do if'n it ever gets updated.

Here's the backtrace, I'll post a valgrind dump next if it crashes again.

Code: Select all

linux:/home/death # gdb --core=core
GNU gdb 6.3
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i586-suse-linux".
Core was generated by `./bzfs -conf redvsblue.conf'.
Program terminated with signal 11, Segmentation fault.
#0  0x68742065 in ?? ()
(gdb) file /home/death/bzflag/bin/bzfs
Reading symbols from /home/death/bzflag/bin/bzfs...done.
Using host libthread_db library "/lib/tls/libthread_db.so.1".
(gdb) bt
#0  0x68742065 in ?? ()
#1  0x65732065 in ?? ()
#2  0x72657672 in ?? ()
#3  0x6e776f20 in ?? ()
#4  0x002e7265 in ?? ()
#5  0x0000003c in ?? ()
Previous frame inner to this frame (corrupt stack?)
(gdb)    
...This has been a recording.
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

Post by The Vaxorcist »

I had that problem too, but I got it to work by removing the -loadplugin from the config file and putting it on the command line (I'll work on fixing this)

Code: Select all

bzfs -conf /path/to/foo/bar -loadplugin /path/to plugin
I'm on this problem now.

This, however, may not be the same problem you're having.
EDIT: Never mind, I don't think this is the right solution
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

Everything runs fine, up until your plugin changes the sky to green, and switched into "high jump mode" or "high speed mode" - which is when it crashed the server.

Backtraces tells me I got a corrupt stack.

Let me know what other (if any) reporting methods you want me to use to tell you how it crashes in the future? Can you make use of valgrind dumps?
...This has been a recording.
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

Post by The Vaxorcist »

Sorry, I fixed the problem (some last minute code I added was buggy), I am testing it and will post it ASAP (in about 1 minute)
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

Post by The Vaxorcist »

Fixed, (I think).
I'll be out of town for 4 days, so I will not be able to fix bugs until then.
Attachments
powerup.tar.gz
Same thing, with bugfix
(3.36 KiB) Downloaded 301 times
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

Make this configureable viz a config file please. Also - add in some shotspeed power ups, and mabe a per weapon power up. Also, how about different colors?

Trying to get the power ups to last long is a pain and I'm not sure I got it down. Post a breakdown of how to edit that .h file.

Nice plugin. Very popular.
...This has been a recording.
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

Post by The Vaxorcist »

Here is a breakdown of constants.h

Code: Select all

#ifndef CONSTANTS_H
#define CONSTANTS_H
Just a bunch of geek stuff. don't mess with it and you'll be fine

Code: Select all

const int POWERUP_PERIOD            = 5    *   60;
POWERUP_PERIOD is in seconds, but most people would like to have the delay between powerups in minutes. 5 times (the *) 60 seconds = a whole lot of seconds. change the five to whatever you want.

Code: Select all

const int POWERUP_PERIOD_VARIANCE   = 30; 
the same units and everything. in the example it is 30 seconds (you could replace it with 4 * 60 or whatever). think of this as sort of an error margin. this is how randomly you want powerups to happen. so,

if you set POWERUP_PERIOD to say, 10 (ten seconds may be too short for you, just an example.) and POWERUP_PERIOD_VARIANCE to 5 then:

powerups will happen every ten seconds give or take 5 seconds. anywhere from 5 seconds to 15 seconds, but averaging every ten.

Code: Select all

const int POWERUP_DURATION          = 15;
const int POWERUP_DURATION_VARIANCE = 10;
Here we get to your problem.

This says you will get a powerup that lasts 15 seconds give or take 10.

a more practicle values would be say, one minute (60) give or take however many seconds.

Code: Select all

#endif
more geek stuff. play with it and you will be badly scarred for the rest of your life. :D

everything after the // (on the same line) is ignored.
leave the semicolon where it is. put all your values before it.

here is a more modified constants.h for an example.

Code: Select all

/*****************************************************************************
 constants.h
 This section should be heavily commented, if you need help, feel free to PM me
 if you need to change the types and amounts for the different powerups, you
 may need to
  a)
     learn C++
  b)
     PM the heck out of me so I either change it or get around to implementing
     it through config files
 
 Have fun! ;)
*******************************************************************************/
#ifndef CONSTANTS_H
#define CONSTANTS_H

const int POWERUP_PERIOD            = 2     *   60 * 60;  // two hours
const int POWERUP_PERIOD_VARIANCE   = 60 * 60;           // one hour

const int POWERUP_DURATION          = 5 * 60;           // five minutes
const int POWERUP_DURATION_VARIANCE = 60;          // give or take one minute

#endif

you will be pleased to know that i will eventually write a config file framework (and it has been bumped up in priority) the bad news it that i'm a lazy bum with more important things to work on (like different triggers for powerups).

About the colors: you can currently have more than one powerup on at the the same time. you can see this by setting POWERUP_DURATION to less then POWERUP_PERIOD. you will get a green powerup, and then after a while, you may get a yellow powerup (or is it orange), and so on.
Why? because if you have mass slaughter (ie geno + base camping) as a trigger (my next project) AND there is a timed powerup that happens at the same time, you get twice the fun (and it lasts longer too).

Anyhow, thanks for your interest, and I will always be here to help people out.

Mainly of course so they don't blow my planet up. :wink:
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

Let's say I wanted five minutes (give or take thirty seconds) of quiet, then I want to cycle through all the different levels/colors the plugin provides, each level lasting about a minute (give or take ten seconds) until it goes all the way through, then another five minutes of quiet, then another grand cycle...

How would I code that in the constants.h file?
...This has been a recording.
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

Post by The Vaxorcist »

note that this won't actually cycle through them, but the timing is right.

Code: Select all

#ifndef CONSTANTS_H
#define CONSTANTS_H

const int POWERUP_PERIOD            = (5 * 60) + (4 * 60);
// this make the time between powerups 5 minutes,
// I add 4 minutes because the powerup will last 4 minutes. It doesn't wait for the 
//first one to finish before starting to time the next one

const int POWERUP_PERIOD_VARIANCE   = 30;

const int POWERUP_DURATION          = 4 * 60;
const int POWERUP_DURATION_VARIANCE = 40;

#endif 
There are 5 levels, but these have no bearing on how the powerups act. A green powerup just means that you only have one plugin on. A yellow means that you have 2 powerups on at the same time. etc. it does not change the way they work
Unfortunately, there is no way to have them cycle around as per request. The best I could do with the current code is have the powerups keep stacking up until everyone got kicked for going supersonic.

a demonstration:

Code: Select all

#ifndef CONSTANTS_H
#define CONSTANTS_H

const int POWERUP_PERIOD            = 5;
const int POWERUP_PERIOD_VARIANCE   = 4;

const int POWERUP_DURATION          = 7;
const int POWERUP_DURATION_VARIANCE = 2;

#endif 
get your self a server up and just sit there and shoot a bot or something and you will see what I mean.

This will probably make more sense when I release my next version. If you can allow events like flag captures to trigger powerups, then if the people who are playing are really good and capture flags, like 4 times in 5 minutes, then they could get 4 powerups and zoom around the map.

If you're wondering, everything that is in the constants.h file is all that you can put in it. It just sets values that the code uses.
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

Gah...

So how far off are we to another release?
...This has been a recording.
User avatar
The Vaxorcist
Private First Class
Private First Class
Posts: 134
Joined: Wed Mar 23, 2005 10:28 am
Location: Santa Rosa, CA

Post by The Vaxorcist »

Probably several days.

I'm working on parsing a config file now.
Image
Where's Darwin when you need him?

Lagger@Everywhere
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

a demonstration:

Code:

#ifndef CONSTANTS_H
#define CONSTANTS_H

const int POWERUP_PERIOD = 5;
const int POWERUP_PERIOD_VARIANCE = 4;

const int POWERUP_DURATION = 7;
const int POWERUP_DURATION_VARIANCE = 2;

#endif



get your self a server up and just sit there and shoot a bot or something and you will see what I mean.
*eek* Holy exceptional! *eek*

You can't slow that down to last about a minute on each pass?
...This has been a recording.
User avatar
Hannibal
Private First Class
Private First Class
Posts: 1073
Joined: Mon May 02, 2005 10:27 pm
Contact:

Post by Hannibal »

ahh, so this is the one that got the powerups going on mofo. and the colors should be changed. right now theyre all stage green...cool vax.
Games don't make people violent, lag does.
ImageImage
User avatar
I_Died_Once
Special Forces
Special Forces
Posts: 635
Joined: Sun Nov 28, 2004 5:27 pm
Location: The Dark Side
Contact:

Post by I_Died_Once »

I agree, Phalanx.

Right now, the power ups "stack" - meaning that it will take more than one powerup to happen at one time to get a color other than green.

I would like to see the colors be random. Like, say blue is the weakest powerup, then green, yellow being the middle, orange, then red, being the most powerful color... and instad of letting the power ups stack - have the colors be random... and blue & green be the most common powerup, and red & orange only happening rarely.

I like to time stuff to happen once every minute, maybe every two/three minutes to keep the ever shortening attention span of my players.
...This has been a recording.
Post Reply