Server Help Forum Index Server Help
Community forums for Subgame, ASSS, and bots
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   StatisticsStatistics   RegisterRegister 
 ProfileProfile   Login to check your private messagesLogin to check your private messages   LoginLogin (SSL) 

Server Help | ASSS Wiki (0) | Shanky.com
hs_util

 
Post new topic   Reply to topic Printable version
 View previous topic  Sius (TCP Biller) Post :: Post <c> Spree by Smong  View next topic  
Author Message
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed May 21, 2008 10:50 am    Post subject: hs_util Reply to topic Reply with quote

I'm releasing the newest version of the Hyperspace utility modules. These modules don't depend on the hscore, and can be useful to most ASSS zones.

There are four independent (exception: see the note for kill) components to this library:

  • Formula: This module will parse formulas from strings, such as "4*3.2+8^2" and "$jackpot/max($teamsize,5)". The primary usefulness is embedding formulas into configuration files. Variables can be specified when evaluating the formula. Also included is a formula_cmd module that gives players access to a ?formula command that they can use as a simple calculator.

    Available unary (one argument) functions:
    Code: Show/Hide
    abs, acos, acosh, asin, asinh, atan, atanh, ceil, cos, cosh
    exp, floor, log, log10, log2, round, sin, sinh, sqrt, tan
    tanh, trunc


    Available binary (two argument) functions:
    Code: Show/Hide
    atan2, hypot, max, min, mod, remainder


  • Menu: This module will generate the formatted menus seen in many hyperspace commands. It allows tables with optional column headers, text areas with wrapped text, menu titles, and automatic width matching between sections. The included ?menuformat command allows a player to switch their formatter. Two formatters are included: hs and simple. Other formatters can be modeled on these two with (hopefully) minimal effort.

    The "hs" formatter:
    Code: Show/Hide
    +-----------------+
    | Menu Formatters |
    +-----------+-----+---+
    | Formatter | Default |
    +-----------+---------+
    | hs        |       * |
    | simple    |         |
    +-----------+---------+


    The "simple" formatter:
    Code: Show/Hide
    Menu Formatters
    -----------------
    Formatter|Default
    -----------------
    hs       |      *
    simple   |       


  • Selfpos: This module sends "self position packets" for the purposes of warping, setting bounties, setting status bits, and firing weapons. This module will try to match the outgoing packet's time stamp to the player's lag to reduce the effect of the "offset bug". It also does all the necessary administrative tasks, such as incrementing weapon packet counts. It also uses the game module to only send the packets to the players that would normally get them, to reduce the outgoing packet count. A selfpos_cmd module is included for testing purposes.
  • Kill: This module will kill players with a *thor, optionally sending the blast to surrounding players or teammates. It supports the generation of fake killers (e.g. <engine failure> in Hyperspace). It also supports killing using existing players. All of the fake player overhead is handled transparently, such as removing fakes in an empty arena so it can be destroyed. NOTE that kill depends on selfpos to kill players in safeties. A kill_cmd module is included for testing the loading and unloading of fake killers.


These modules are online in Hyperspace, but have not been rigorously tested. There may be a few bugs in them, so please post any problems you encounter. The selfpos module is missing some features advertised in the .h file (coalescing of bounty/status packets, and timestamp deltas), but if you need any of them let me know and I'll make completing them a top priority.

Building:
The included makefile should handle all the building for anyone using the regular ASSS make system. If you don't have bison and flex (needed to build some .c files from the formula grammar), put the parser.c, parser.h, lexer.c files from hs_util_noflexbison.zip into the hs_util/ directory, and the makefile won't try to build them.

If you're not using the ASSS make system, the only thing you need to worry about is passing -DUSE_AKD_LAG to the compiler if you're using HZ's akd_lag module. Otherwise, just add all the .c files you can find, and add hs_util to the include directories for your own modules.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me




Revision 1153

hs_util_noflexbison.zip - 28.98 KB
File downloaded or viewed 215 time(s)

Revision 1153

hs_util.zip - 21.86 KB
File downloaded or viewed 226 time(s)
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
D1st0rt
Miss Directed Wannabe


Age:36
Gender:Gender:Male
Joined: Aug 31 2003
Posts: 2247
Location: Blacksburg, VA
Offline

PostPosted: Thu May 22, 2008 8:48 pm    Post subject: Reply to topic Reply with quote

If you're not using the asss.asss.hs monotone branch, you'll need to apply (minimally) this patch
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Initrd.gz
Seasoned Helper


Joined: Sep 18 2008
Posts: 134
Location: Over there --->
Offline

PostPosted: Tue Jul 28, 2009 6:53 pm    Post subject: Reply to topic Reply with quote

Hey, sorry for bump, but do you mind re-uploading that patch? Seems to redirect to asss 1.5.0, and that doesn't really help because my security.so module doesn't work with asss 1.5.0, and it doesn't come with one.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Tue Jul 28, 2009 10:25 pm    Post subject: Reply to topic Reply with quote

I seem to recall the issue being a missing energy field in the player position structure. Unfortunately, that commit got combined with a bunch of other ones when the switch to mercurial was made, but here are the important bits:

Code: Show/Hide
diff -r 443387f9c075 -r 005e019b97c8 src/include/player.h
--- a/src/include/player.h   Fri Nov 09 04:16:56 2007 -0800
+++ b/src/include/player.h   Mon Apr 06 00:44:18 2009 -0700
@@ -155,6 +155,7 @@
   int rotation;    /**< rotation value (0-63) */
   unsigned bounty; /**< current bounty */
   unsigned status; /**< status bitfield */
+   int energy;      /**< current energy */
};

/* pyconst: define int, "STATUS_*" */


Code: Show/Hide

diff -r 443387f9c075 -r 005e019b97c8 src/core/game.c
--- a/src/core/game.c   Fri Nov 09 04:16:56 2007 -0800
+++ b/src/core/game.c   Mon Apr 06 00:44:18 2009 -0700
@@ -518,6 +518,7 @@
      p->position.rotation = pos->rotation;
      p->position.bounty = pos->bounty;
      p->position.status = pos->status;
+      p->position.energy = pos->energy;
   }

   if (p->flags.sent_ppk == 0 && !isfake)
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Initrd.gz
Seasoned Helper


Joined: Sep 18 2008
Posts: 134
Location: Over there --->
Offline

PostPosted: Wed Jul 29, 2009 12:45 pm    Post subject: Reply to topic Reply with quote

Thanks. Mind also doing it for HSCore as well?

Also:
Code: Show/Hide
asss@*******:~/asss-1.4.4/src$ patch -p1 < patch1.diff
can't find file to patch at input line 4
Perhaps you used the wrong -p or --strip option?
The text leading up to this was:
--------------------------
|diff -r 443387f9c075 -r 005e019b97c8 src/include/player.h
|--- a/src/include/player.h   Fri Nov 09 04:16:56 2007 -0800
|+++ b/src/include/player.h   Mon Apr 06 00:44:18 2009 -0700
--------------------------
File to patch:
Am I using the wrong command?
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Wed Jul 29, 2009 6:26 pm    Post subject: Reply to topic Reply with quote

It's probably easier to apply those patches manually, since they're one line each. Just search the files for the correct place to put in the line starting with the +. Probably near line 155 in player.h and 518 in game.c.

What did you mean about HSCore?
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Initrd.gz
Seasoned Helper


Joined: Sep 18 2008
Posts: 134
Location: Over there --->
Offline

PostPosted: Thu Jul 30, 2009 1:48 pm    Post subject: Reply to topic Reply with quote

Quote:
To get spawner to compile, you'll need the modification to game.c/game.h in 5bbdeb509511dd9efbf5872ebf656bb3e0a7615b of the branch asss.asss.hs. Or if you don't want/need items to affect energy viewing, you can just comment out the offending sections in the spawner.


That part.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Thu Jul 30, 2009 9:36 pm    Post subject: Reply to topic Reply with quote

http://bitbucket.org/grelminar/asss/changeset/541cf34f5c4e/
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
KrynetiX
Seasoned Helper


Gender:Gender:Male
Joined: Jan 06 2003
Posts: 137
Location: Poconos
Offline

PostPosted: Fri Dec 18, 2009 3:55 am    Post subject: Reply to topic Reply with quote

again, where's the delete post button? should be able to delete your own
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website
Onuzim
Newbie


Joined: Apr 18 2014
Posts: 1
Offline

PostPosted: Fri Apr 18, 2014 8:14 pm    Post subject: Reply to topic Reply with quote

I won't ask about Windows compiling. I've tried. On linux(Ubuntu 14.04), I arrive at an error when compiling hs_util lexer.

Code: Show/Hide

gcc -std=gnu99 -pipe -I. -Iinclude -I/home/anon/Desktop/asss-1.5.0rc1/build  -Ihscore -Ihs_util -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall   -Wno-unused -c -o /home/anon/Desktop/asss-1.5.0rc1/build/lexer.o /home/anon/Desktop/asss-1.5.0rc1/build/lexer.c
In file included from hs_util/lexer.l:3:0:
/home/anon/Desktop/asss-1.5.0rc1/build/parser.h:89:14: error: unknown type name ?ParseObject?
int yyparse (ParseObject *parse_object, yyscan_t *scanner);
              ^
make: *** [/home/anon/Desktop/asss-1.5.0rc1/build/lexer.o] Error 1
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sat Apr 19, 2014 2:03 pm    Post subject: Reply to topic Reply with quote

It's been years since I've done anything on that. Unfortunately I don't have any system setup where I can compile it, so I can't just send you the autogenerated files.

Anyway, I looked through the sources, and it looks like all you'll need to do is open up lexer.c and move the #include "ast.h" higher up in the file so it's above the #include "parser.h". You could also add #include "ast.h" into parser.h.

Once that's done you may want to make the files read-only so your changes don't get blasted away.

I wish I had a more permanent solution for you, but I've forgotten what little I ever knew about flex and bison.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sat Apr 19, 2014 2:04 pm    Post subject: Reply to topic Reply with quote

Onuzim wrote:
I won't ask about Windows compiling.


The only tricky part on windows is getting flex and bison installed. If you're not going to be doing any development, you could just take the output files from your ubuntu machine (after making the above changes) and compile them on windows.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
CypherJF
I gargle nitroglycerin


Gender:Gender:Male
Joined: Aug 14 2003
Posts: 2582
Location: USA
Offline

PostPosted: Sun Apr 20, 2014 12:49 am    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
[..]



The only tricky part on windows is getting flex and bison installed. If you're not going to be doing any development, you could just take the output files from your ubuntu machine (after making the above changes) and compile them on windows.


I've been trying to get asss to recompile on windows but haven't had any luck - even went back to the 1.4.4 release that I once compiled hs_money (?) with the funky "all HS fines to go to cypherjf" mod to it. No such luck. Let alone 1.5.x. Was there new dependencies added since then that would really cause that much of an issue with building on windows? Grel had the windeps flow pretty much going, I feared the day that you (et al) wouldn't be able to provide security.dll for new releases. :/
_________________
Performance is often the art of cheating carefully. - James Gosling
Back to top
View users profile Send private message Add User to Ignore List
Dr Brain
Flip-flopping like a wind surfer


Age:38
Gender:Gender:Male
Joined: Dec 01 2002
Posts: 3502
Location: Hyperspace
Offline

PostPosted: Sun Apr 20, 2014 7:22 am    Post subject: Reply to topic Reply with quote

This thread is about hs_util. If you're having problems with asss make a new thread and we can try to work through them. I'll be gone most of this week though.
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> ASSS Custom Projects All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum
View online users | View Statistics | View Ignored List


Software by php BB © php BB Group
Server Load: 417 page(s) served in previous 5 minutes.

phpBB Created this page in 0.440147 seconds : 41 queries executed (90.1%): GZIP compression disabled