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
<C> Lockon

 
Post new topic   Reply to topic Printable version
 View previous topic  <py> optparser Post :: Post <C> MultiNews (1.4.4)  View next topic  
Author Message
Initrd.gz
Seasoned Helper


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

PostPosted: Tue Feb 24, 2009 7:49 pm    Post subject: <C> Lockon Reply to topic Reply with quote

Lockon: A highly configurable turret module, similar to HS's pointdefense.

NOTE: In testing, upload will come after

Here's a complete list of things you can do with it:
    Create a turret that attaches to you.
    Set it to aim at enemies, aim in your direction, or disable it.
    Make it shoot bombs, guns, thors, repels, bursts, and mines.
    Easy to configure.
    Includes an interface that allows you to add turrets, remove turrets, or make them fire where.
    You can talk to your turret. Ask it a Yes/no question
    A turret can have an optional ammo count, and a reload period when the ammo reaches zero.


It is based on HS's pointdefense.


Last edited by Initrd.gz on Mon Mar 02, 2009 7:56 pm, edited 3 times in total
Back to top
View users profile Send private message Add User to Ignore List AIM Address
tcsoccerman
Server Help Squatter


Age:31
Gender:Gender:Male
Joined: Jan 15 2007
Posts: 694
Location: Atlantis
Offline

PostPosted: Tue Feb 24, 2009 8:11 pm    Post subject: Reply to topic Reply with quote

Nice work, should prove useful.
Back to top
View users profile Send private message Add User to Ignore List Send email AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Tue Feb 24, 2009 10:50 pm    Post subject: Reply to topic Reply with quote

Quote:
I have not compiled/tested this yet


... wut?
_________________
(Insert a bunch of dead links here)
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: Wed Feb 25, 2009 7:33 am    Post subject: Reply to topic Reply with quote

Looking through the code I can see it won't compile.

It also looks like you don't handle attaching properly. If you attach to someone that's attached, then later they detach, you'll still be attached to the first player. That's the reason I told you not to use point defense as a reference.
_________________
Hyperspace Owner

Smong> so long as 99% deaths feel lame it will always be hyperspace to me
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Wed Feb 25, 2009 10:59 am    Post subject: Reply to topic Reply with quote

That's also why any code should be compiled and tested, even if you're sure it works tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
Initrd.gz
Seasoned Helper


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

PostPosted: Wed Feb 25, 2009 5:26 pm    Post subject: Reply to topic Reply with quote

Ok, I am sorry. I should have compiled and tested it. I just posted it when I was done with it. I will look over it again and post it when it is done. I apologize again.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Cheese
Wow Cheese is so helpful!


Joined: Mar 18 2007
Posts: 1017
Offline

PostPosted: Wed Feb 25, 2009 7:00 pm    Post subject: Reply to topic Reply with quote

imagine if you bought an untested car...

dealer> look its our new car, we threw some parts in a bucket, but noone has tried to drive it yet! Starting at $11,000!
_________________
SSC Distension Owner
SSCU Trench Wars Developer
Back to top
View users profile Send private message Add User to Ignore List Visit posters website AIM Address
Initrd.gz
Seasoned Helper


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

PostPosted: Thu Feb 26, 2009 7:01 pm    Post subject: Reply to topic Reply with quote

Looks like all the syntax errors are gone. I'm ignoring the "Dereferencing void * pointers" errors.

Dr. Brain, I am not sure what you mean by attaching.
Do you mean:
Player A is the fake.
Player B is the owner.
Player C is someone else.

Player B is attached to C, and A attaches to B, so it attaches to C.
Are you saying when B detaches from C, A is still attached? Because it looks like it should detach. icon_confused.gif
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 Feb 26, 2009 10:47 pm    Post subject: Reply to topic Reply with quote

Initrd.gz wrote:
the "Dereferencing void * pointers" errors.


That sounds bad. Cast pointers to the correct type before you deref them.

Initrd.gz wrote:
Player B is attached to C, and A attaches to B, so it attaches to C.
Are you saying when B detaches from C, A is still attached? Because it looks like it should detach. icon_confused.gif


I didn't see any code to do that, but it should be simple enough to test if it works properly.
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: Fri Feb 27, 2009 2:15 pm    Post subject: Reply to topic Reply with quote

Dr Brain wrote:
That sounds bad. Cast pointers to the correct type before you deref them.
Ah, so you mean instead of:
Code: Show/Hide
link->data->attribute

I should use:
Code: Show/Hide
Turret *turret = (Turret *) link->data;
turret->attribute


Ok, I'll change that...

Edit: I also get this warning when I try to compile:
Quote:
0 E:\...\lockon.c [Warning] `nul.gcda' is not a gcov data file


I am following the instructions for compiling with Dev-C++

Edit2: Changing the type works. The turret now compiles into a DLL
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Samapico
No, these DO NOT look like penises, ok?


Joined: May 08 2003
Posts: 1252
Offline

PostPosted: Sun Mar 01, 2009 1:13 am    Post subject: Reply to topic Reply with quote

You could also simply do:

(Turret *) (link->data) ->attribute;

Though if you need to access several attributes in the next lines, it's definitely more efficient to create a pointer to link->data first
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 Mar 01, 2009 9:27 am    Post subject: Reply to topic Reply with quote

Samapico wrote:
it's definitely more efficient to create a pointer to link->data first


Any modern compiler will produce the same code regardless of which way you do it. So always pick the style that is easier to read and understand.
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: Sun Mar 01, 2009 3:46 pm    Post subject: Reply to topic Reply with quote

Ok, as I said, the module compiles into a DLL. However, for some reason, I cannot compile it on Linux with gcc.

Here's the command I am using, and I bet it is wrong:
Code: Show/Hide
gcc lockon.c -o lockon.so -I./include -I./

The compiler complains about stuff such as LLAlloc and even atan2 not being defined. For some reason it is not including the files.

(I just had an Idea while typing this, I'm going to compile util.c with it like Dev-C++ does)

Edit: Still doesnt work. Output:
Code: Show/Hide
$ gcc lockon.c ./main/util.c -o lockon.so -I./include -I./ -Wall
lockon.c: In function ?get_best_target?:
lockon.c:197: warning: statement with no effect
lockon.c: In function ?turret_kickoff?:
lockon.c:480: warning: suggest parentheses around assignment used as truth value
lockon.c: In function ?MM_lockon?:
lockon.c:900: warning: control reaches end of non-void function
lockon.c: At top level:
lockon.c:787: warning: ?interface? defined but not used
/usr/lib/gcc/i486-linux-gnu/4.2.4/../../../../lib/crt1.o: In function `_start':
(.text+0x18): undefined reference to `main'
/tmp/ccPNvLFR.o: In function `fireangle':
lockon.c:(.text+0x413): undefined reference to `atan2'
/tmp/cc1H9JJR.o: In function `MPRemove':
util.c:(.text+0x1d27): undefined reference to `__pthread_register_cancel'
util.c:(.text+0x1d74): undefined reference to `__pthread_unregister_cancel'
collect2: ld returned 1 exit status
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: Sun Mar 01, 2009 6:22 pm    Post subject: Reply to topic Reply with quote

Don't run gcc yourself on linux. Make a new directory in the asss src and put a .mk file in it, along with your source. The format for the .mk can be copied from the turf directory (it's pretty straight forward). Once you've done that:

Code: Show/Hide
make deps
make
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: Sun Mar 01, 2009 9:21 pm    Post subject: Reply to topic Reply with quote

For some reason I cannot compile ASSS:
-quote removed-

Edit: Installed a few packages and that part compiles, and I installed libdbd-mysql, but it seems the mysql isnt compiling:
Quote:
gcc -std=gnu99 -pipe -I. -Iinclude -I../build -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall -I/opt/db-4.0.14/include -fPIC \
-DNODQ -DNOTREAP -DNOSTRINGCHUNK -DNOMPQUEUE -DNOMMAP \
-o ../build/dbtool ../build/statcodes.o main/util.c main/dbtool.c -L/opt/db-4.0.14/lib -Wl,-rpath,/opt/db-4.0.14/lib -ldb-4
main/dbtool.c: In function ?print_quoted?:
main/dbtool.c:177: warning: pointer targets in passing argument 1 of ?strchr? differ in signedness
main/dbtool.c:178: warning: pointer targets in passing argument 1 of ?fputs? differ in signedness
main/dbtool.c: In function ?stats_print_stats?:
main/dbtool.c:445: warning: pointer targets in passing argument 1 of ?print_quoted? differ in signedness
gcc -std=gnu99 -pipe -I. -Iinclude -I../build -D_REENTRANT -D_GNU_SOURCE -fPIC -g -Wall -I/opt/mysql/include -c -o ../build/mysql.o database/mysql.c
database/mysql.c:17:19: error: mysql.h: No such file or directory
database/mysql.c:44: error: expected ?=?, ?,?, ?;?, ?asm? or ?__attribute__? before ?*? token
database/mysql.c: In function ?do_query?:
database/mysql.c:55: warning: implicit declaration of function ?mysql_real_query?
database/mysql.c:55: error: ?mydb? undeclared (first use in this function)
database/mysql.c:55: error: (Each undeclared identifier is reported only once
database/mysql.c:55: error: for each function it appears in.)
database/mysql.c:60: warning: implicit declaration of function ?mysql_error?
database/mysql.c:60: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:62: warning: implicit declaration of function ?mysql_errno?
database/mysql.c:66: warning: implicit declaration of function ?mysql_field_count?
database/mysql.c:74: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:74: error: ?res? undeclared (first use in this function)
database/mysql.c:74: warning: implicit declaration of function ?mysql_store_result?
database/mysql.c:79: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:89: warning: implicit declaration of function ?mysql_free_result?
database/mysql.c: In function ?close_db?:
database/mysql.c:97: warning: implicit declaration of function ?mysql_close?
database/mysql.c:97: error: ?MYSQL? undeclared (first use in this function)
database/mysql.c:97: error: expected expression before ?)? token
database/mysql.c: In function ?work_thread?:
database/mysql.c:105: error: ?mydb? undeclared (first use in this function)
database/mysql.c:105: warning: implicit declaration of function ?mysql_init?
database/mysql.c:109: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:120: warning: implicit declaration of function ?mysql_real_connect?
database/mysql.c:120: error: ?CLIENT_COMPRESS? undeclared (first use in this function)
database/mysql.c:120: warning: comparison between pointer and integer
database/mysql.c:122: warning: format ?%s? expects type ?char *?, but argument 3 has type ?int?
database/mysql.c:138: warning: implicit declaration of function ?mysql_ping?
database/mysql.c: In function ?Query?:
database/mysql.c:217: warning: implicit declaration of function ?mysql_escape_string?
database/mysql.c: In function ?GetRowCount?:
database/mysql.c:241: warning: implicit declaration of function ?mysql_num_rows?
database/mysql.c:241: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:241: error: expected expression before ?)? token
database/mysql.c: In function ?GetFieldCount?:
database/mysql.c:246: warning: implicit declaration of function ?mysql_num_fields?
database/mysql.c:246: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:246: error: expected expression before ?)? token
database/mysql.c: In function ?GetRow?:
database/mysql.c:251: warning: implicit declaration of function ?mysql_fetch_row?
database/mysql.c:251: error: ?MYSQL_RES? undeclared (first use in this function)
database/mysql.c:251: error: expected expression before ?)? token
database/mysql.c: In function ?GetField?:
database/mysql.c:256: error: ?MYSQL_ROW? undeclared (first use in this function)
database/mysql.c:256: error: expected ?)? before ?row?
database/mysql.c:257: warning: control reaches end of non-void function
database/mysql.c: In function ?GetLastInsertId?:
database/mysql.c:261: warning: implicit declaration of function ?mysql_insert_id?
database/mysql.c:261: error: ?mydb? undeclared (first use in this function)
make: *** [../build/mysql.o] Error 1


Last edited by Initrd.gz on Sun Mar 01, 2009 10:28 pm, edited 1 time in total
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: Sun Mar 01, 2009 9:43 pm    Post subject: Reply to topic Reply with quote

Don't compile the mysql parts then. Set
Code: Show/Hide
have_mysql := no

in system.mk.
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: Mon Mar 02, 2009 7:55 pm    Post subject: Reply to topic Reply with quote

K, thanks.

Gonna test once I move my server ( which requires me getting a static IP address... )
Back to top
View users profile Send private message Add User to Ignore List AIM Address
Initrd.gz
Seasoned Helper


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

PostPosted: Mon May 25, 2009 10:20 pm    Post subject: Reply to topic Reply with quote

Finally fixed it so that it will compile, but I have a problem.

The module compiles, inserts, and attaches, but when I try to use the ?simpleturret command, the server crashes. Source attached.




Nonfunctional Lockon Source Code

lockon.zip - 7.15 KB
File downloaded or viewed 51 time(s)
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 May 26, 2009 6:42 am    Post subject: Reply to topic Reply with quote

If you're running on linux, the server should make a .bt file (backtrace) for every server crash. Take a look inside it. You may need to install gdb to get actual data.
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: 638 page(s) served in previous 5 minutes.

phpBB Created this page in 0.474322 seconds : 46 queries executed (90.3%): GZIP compression disabled