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
Help Ani With His Duel Module

 
Post new topic   Reply to topic Printable version
 View previous topic  ASSS fighting bots module Post :: Post Smongs Spree doesnt compile for windows  View next topic  
Author Message
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:37
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Fri Feb 29, 2008 1:14 pm    Post subject: Help Ani With His Duel Module Reply to topic Reply with quote

I'm trying to write a duel module for AS3 again. I haven't done a ton of actually handling the duels, which I think is gonna be hard since I'll have to check for things like lagouts, warp outs, shipchanges, and keeping up with multiple possibilities for rulesets, but that's not what I'm worried about yet.

Here's my actual problem. The module needs to be aware of the existence of duel boxes. But since not everyone uses the same map, I need to have a way to read where the boxes are. And not everyone is going to have the same number of duel boxes. So I figured the best way to store duel boxes would be to have a struct DuelBox and store the coordinates in there. I'll need at least 4 coordinates, upper left corner X and Y, lower right corner X and Y. Then I can read in a list of coordinates from a .conf file when the module is attached, and store them in a linked list of DuelBoxes.

But I don't know how to read an indiscriminant amount of data from a .conf file. I mean, I can have something like:

[DuelBoxes]
UpperLeftX = 432
UpperLeftY = 392
LowerRightX = 239
LowerRightX=299

, but that's only one box. I don't know how I'd use the config module to read in anything but pre-determined keys. I suppose I could just read the .conf file myself through a file reader, but I would much rather be able to just read from arena settings, if that's possible. I'm sure anyone else who did anything to the module would prefer that as well. Besides, it might even be possible to read settings that are in the same format as MERV uses for its duel plugins, so that users wouldn't even have to change the settings files for it to work with AS3... that would be nice, if it's possible.

So does anyone have a solution to this problem? I think I've explained everything. It's also just occured to me that it might be possible to use regions for this. That would also let me easily support duel boxes that weren't box shaped, I think. But I don't know much about regions... last time I did something with regions, I think I remember it not being fast enough to work well for everything. For example, I would be worried about someone leaving the region for only a split second and it not getting counted. I really don't remember if that was the problem I had with regions, or not. Anyway, if any of you have any suggestions of what to do or things to look at, I would appreciate it.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


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

PostPosted: Fri Feb 29, 2008 2:27 pm    Post subject: Reply to topic Reply with quote

What's wrong with regions?

If you absolutely must use the config do something like:

[Duel]
Boxes = 4
Box0 = ...
Box1 = ...
Box2 = ...
Box3 = ...


pseudo code:

Read boxcount
for (boxcount)
{
sprintf(buffer, "Box%dProperty", i)
property = cfg->get("Duel", buffer)
}
_________________
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
Animate Dreams
Gotta buy them all!
(Consumer whore)


Age:37
Gender:Gender:Male
Joined: May 01 2004
Posts: 821
Location: Middle Tennessee
Offline

PostPosted: Fri Feb 29, 2008 9:35 pm    Post subject: Reply to topic Reply with quote

I imagine nothing is wrong with regions other than what I mentioned(Like I said, I think I remember having issues with the response time when dealing with regions), except that I don't know much about them. I can learn, but since I only thought about them while creating this topic, I didn't exactly have time. Anyway, I was wondering if it was possible(er, should that be "were"? it doesn't seem like it would, but it also seems like it would fall under "condition contrary to fact") to do something like you're doing with sprintf, but I didn't even know how to word it. But you have "Box0 = "... can you just write all 4 coords on one line and read them that way? I was thinking about that, too.

Anyway, I guess I'll look into regions, since you seem to be hinting that it would be the best way.
Back to top
View users profile Send private message Add User to Ignore List Send email Visit posters website AIM Address MSN Messenger
Dr Brain
Flip-flopping like a wind surfer


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

PostPosted: Fri Feb 29, 2008 11:09 pm    Post subject: Reply to topic Reply with quote

You'd have the same response problems with a rectangle based system. Packets only come in every so often.

What's wrong with the following?
Box0X1 = ...
Box0Y1 = ...
Box0X2 = ...
Box0Y2 = ...
Back to top
View users profile Send private message Add User to Ignore List AIM Address Yahoo Messenger MSN Messenger
Smong
Server Help Squatter


Joined: 1043048991
Posts: 0x91E
Offline

PostPosted: Sun Mar 02, 2008 11:17 am    Post subject: Reply to topic Reply with quote

Animate Dreams wrote:
can you just write all 4 coords on one line and read them that way?
You can shove all the coords into one setting and read it using sscanf:
Code: Show/Hide
sscanf(s, "%d , %d , %d , %d", &x1, &y1, &x2, &y2);
The extra spaces between everything accounts for 0 or more characters of white space.
_________________
ss news
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 Questions 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: 26 page(s) served in previous 5 minutes.

phpBB Created this page in 0.534579 seconds : 29 queries executed (84.8%): GZIP compression disabled