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
Trigger module

 
Post new topic   Reply to topic Printable version
 View previous topic  ASSS Bot Core Post :: Post `PTHREAD_MUTEX_RECURSIVE' undeclared.  View next topic  
Author Message
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Wed Jun 25, 2003 5:15 pm    Post subject: Trigger module Reply to topic Reply with quote

I had some spare time today so I knocked this together.

Code: Show/Hide
[Trigger]
Area0=x_tile,y_tile,width,height
  ;The next would be Area1=...
  ;Asss will keep processing in consecutive order until it reaches 99
  ; or there is a gap, fx: Area0, Area1, Area3
Dest0=x,y,w,h
  ;Players are warped to a random location within this area
  ;If there are walls within the area players will might get
  ; warped somewhere unexpected

;The following is optional (warp_basic backwards compatibility)
Message0=You've been Triggered(tm)!
  ;Default is blank/no message
Prize0=0
  ;0 is no prize
  ;Negative gun prizes only work if InitialGuns is lower than
  ; current gun level, same with bombs.
Ship0=-1
  ;Negative is no change
  ; 0 is Warbird, 8 is Spectate
Bong0=-1
  ;Negative is no sound
Team0=-1
  ;If given, trigger only effects this team
  ;Negative is all frequencies


The warp_basic module only has warping (to reduce server load), while trigger_advanced has the prizes and stuff.

It's not completely finished yet, I intend to add lvz toggling (triggered smoke in a realism zone) and brick laying. With the brick layer you could lay traps and stuff (Viet Cong zone?), also people could spawn and shoot out of a box, while enemies can't shoot/fly into the area (or even the dynamic map thing some people have been talking about).

Anyway, the source is included so feel free to play around with it and please post your updates/suggestions (or linux binaries) here.

Edit: Old version deleted.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sat Jun 28, 2003 11:53 am    Post subject: version 2 Reply to topic Reply with quote

I've recompiled the binaries for 1.0rc1 and added lvz support to trigger_advanced. Memory is handled more efficiently, so you can attach the modules to as many arenas as you like.
Old stuff. wrote:
Ship0=0
;Negative is no change
; 0 is Warbird, 8 is Spectate

New stuff. wrote:
Ship0=0
;0 is no change
; 1 is Warbird, 9 is Spectate
Lvz0=0
;0 is no lvz, negative is switch off




windows binary, docs and source

triggers.zip - 17.15 KB
File downloaded or viewed 67 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Sat Jun 28, 2003 1:35 pm    Post subject: Reply to topic Reply with quote

Thats something that bothers me still. Why didn't Jeff just make the spec ship always be 0, instead of keeping it the highest number?

When i made my own bot core (which did fail, too unstable at times, didn't have time to re-write it), i liked the idea of specs being 0, ships being numbers. But when your working with the server, which keeps everything like the packets, i'm unsure if you should switch it around. Most of the sysops of zones will think like the client (1-8 = ships), but the programmers will think like the server (0-7 = ships).

By the way, you going to try to make this as advanced as like it is with Starcraft/Warcraft? To include other triggers, such as deaths, flags, etc?

Could i recommend you using a linked list, so you can have unlimited triggers? Plus, it keeps memory sizes smaller when you only use like 2 triggers.
Back to top
View users profile Send private message Add User to Ignore List Send email
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Jun 29, 2003 12:44 pm    Post subject: Reply to topic Reply with quote

Unlimited triggers is possible (100 per arena ATM), but it checks every 80ms for player positions so I don't think you would get away with no lag (unless you have a really fast computer, but that's cheating).

I've never played Starcraft/Warcraft so I wouldn't know about their triggers. I think triggers on flags really deserves its own flag gametype. Triggers on deaths would require extra code so they only occur after the respawn delay. What I would really like is a non-repeating trigger that doesn't require a warp.

I would imagine less than half the allocated space for each trigger is being used. I thought using a struct with all the trigger's data would make it easy to add new actions and to cleanup afterwards.

If you can explain your linked list method a bit more I will probably add it in at some point. Maybe a callback would be better so that people can easily add their own actions?
typedef void (*TriggerFunc)(Player *p, int trigger);
Back to top
View users profile Send private message Add User to Ignore List Visit posters website MSN Messenger
Mine GO BOOM
Hunch Hunch
What What
Hunch Hunch<br>What What


Age:40
Gender:Gender:Male
Joined: Aug 01 2002
Posts: 3614
Location: Las Vegas
Offline

PostPosted: Sun Jun 29, 2003 5:56 pm    Post subject: Reply to topic Reply with quote

Correct me if i'm wrong, but i believe most collision detection systems in games work by splitting walls into groups, so it would be like a sparse array. So instead of checking every trigger for every position, you would do a bit of work before hand. Say you divide the map into a 10x10 block, and when loading arrays, you load them into linked lists inside each block. So that way, whenever you need to check a person's triggers, you can first do a simple check to see if that one block out of the 100 has any data in it. If so, can check those (or make another sparse array under that to check) to see if any of them match. Better than having 100 triggers all over the map, and check them vs every player every 80 ms. I believe the current method for storing map tiles is setup like this, can take a look at that.

As for linked lists, its pretty simple, since Grelminar set it up already inside the util.c for anyone to use. Most of the modules use them heavily to store data, take a look around it for some good examples.
Back to top
View users profile Send private message Add User to Ignore List Send email
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Tue Oct 14, 2003 1:18 pm    Post subject: Reply to topic Reply with quote

I've been working on a better version of my trigger module, but it's not doing what it should do. My test code is supposed to say in the chat the name of the sector you are in (assigned from .conf).

I can enter the arena with the module attached, then when I type stuff or try to change ship it appears in the server console, but nothing happens in game. After a little while ctm says disconnected (no data). Can someone please look at the code and try to figure it out?

I would consider using the already existing region code in ASSS, but I am unsure of it's real purpose (soccer goals?) and of the file format.




source and sample map/triggers.conf

sector_names.zip - 7.3 KB
File downloaded or viewed 51 time(s)
Back to top
View users profile Send private message Add User to Ignore List Visit posters website 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: 674 page(s) served in previous 5 minutes.

phpBB Created this page in 0.468824 seconds : 33 queries executed (92.6%): GZIP compression disabled