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
twcore issues.
Goto page 1, 2  Next
 
Post new topic   Reply to topic Printable version
 View previous topic  LVZ toggling with mervbot Post :: Post Player Position packet weapons question  View next topic  
Author Message
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Thu Apr 14, 2005 2:56 pm    Post subject: twcore issues. Reply to topic Reply with quote

Hey guys. I've got the latest twcore distro, and I'm having a serious issue that I can't figure out....

I'm rather new to Java, so bear with me on my obvious newbishness.

Here's the problem... I can have a bot log in, accept and respond to PM's and whatever else I want it to do... but... It's losing the death messages. Sometimes the kill tracking works, most of the time it doesn't. Seems to be completely random...

I've put tracers in the code where I can, and it seems like the death messages just disappear. I've got reliable kills turned on, but to no avail.

I'm using j2sdk1.4.2_07. What am I missing? Why isn't this working? It doesn't seem to lose PM's or any other type of message... just the kill messages. It's very frustrating. new_let_it_all_out.gif

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Thu Apr 14, 2005 3:16 pm    Post subject: Reply to topic Reply with quote

I just tried j2sdk1.4.2_08 with no success either.

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Apr 14, 2005 4:13 pm    Post subject: Reply to topic Reply with quote

Check the settings for Routing:DeathDistance. This the maximum distance away from the location of a death that a packet will even get queued. Even with this set very large, I still get missing death packets with PowerBot.
_________________
4,691 irradiated haggis!
Back to top
View users profile Send private message Add User to Ignore List
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Thu Apr 14, 2005 4:28 pm    Post subject: Reply to topic Reply with quote

Dude. You rule. biggrin.gif

I set it to 16384 and now receive the kill messages in the bot every time!

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
D1st0rt
Miss Directed Wannabe


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

PostPosted: Thu Apr 14, 2005 7:40 pm    Post subject: Reply to topic Reply with quote

Ew, thats a bit of overkill IMO. Instead, what I would do is turn on reliable kills so that the bot is the only one that gets all the death packets. Most players don't need all of them when they're 16000 pixels away. This can be achieved using a call to
Code: Show/Hide
m_botAction.setReliableKills(1);

What this does is send a chat message containing "*relkills 1" which according to shanky.com, "If sent # of 1, you will always get reliable kills."
_________________

Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Apr 14, 2005 8:12 pm    Post subject: Reply to topic Reply with quote

Doesn't work. All that does is makes the kills the server DOES send reliable. It still only sends based on the arena setting. Also, even with reliable kills AND a maxed setting, they can still be dropped.
Back to top
View users profile Send private message Add User to Ignore List
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Thu Apr 14, 2005 8:39 pm    Post subject: Reply to topic Reply with quote

As I said in the original post... reliable kills IS enabled. But still doesn't receive them if outside the range specified...

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
Chambahs
Guest


Offline

PostPosted: Thu Apr 14, 2005 9:36 pm    Post subject: Reply to topic Reply with quote

ekted owns you all, good luck with the bot wired

(off topic) just wondering ekted, what zone do you play? tongue.gif
Back to top
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Thu Apr 14, 2005 9:52 pm    Post subject: Reply to topic Reply with quote

Powerball
Back to top
View users profile Send private message Add User to Ignore List
Cerium
Server Help Squatter


Age:42
Gender:Gender:Male
Joined: Mar 05 2005
Posts: 807
Location: I will stab you.
Offline

PostPosted: Thu Apr 14, 2005 10:02 pm    Post subject: Reply to topic Reply with quote

Play???

Thats a bit of an understatement.
Back to top
View users profile Send private message Add User to Ignore List AIM Address
D1st0rt
Miss Directed Wannabe


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

PostPosted: Thu Apr 14, 2005 10:43 pm    Post subject: Reply to topic Reply with quote

Hmmm... learn something new every day biggrin.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Fri Apr 15, 2005 6:07 pm    Post subject: Reply to topic Reply with quote

Yes, sending every death packet to every player is a bit of an overkill, but remember death packets are rather small, so it doesn't matter that much.
_________________
This help is informational only. No representation is made or warranty given as to its content. User assumes all risk of use. Cyan~Fire assumes no responsibility for any loss or delay resulting from such use.
Wise men STILL seek Him.
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Fri Apr 15, 2005 9:52 pm    Post subject: Reply to topic Reply with quote

More issues....

Ok, I'm trying to create a method to announce the current location of a player... I've gotten the bot to spec on the player....

But how the hell do I get his current location?

I've tried PlayerPosition.getXLocation() and PlayerPosition.getYLocation()... I've also tried Player.getXLocation() and Player.getYLocation()...

I get X as being very high, looks like pixels... but Y always comes back as 0. I can't seem to just use %coord in any way or fashion....

So how the hell do I do this?!

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Fri Apr 15, 2005 11:13 pm    Post subject: Reply to topic Reply with quote

Ok. Got it. A very itty bitty typo is what hung me up... Heh. Gotta love the little things... Here's the code I came up with, I'm sure there's a more efficient way, but I'm still a newb, so ... forgive me. icon_smile.gif

Code: Show/Hide

   public String getCoords(Player p) {
      int x=0;
      int y=0;
      
      x = (((p.getXLocation()/16) * 20) / 1024) ;
      y = (((p.getYLocation()/16) * 20) / 1024) + 1;

      String xc[]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};

      return xc[x]+y;
   }
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Fri Apr 15, 2005 11:24 pm    Post subject: Reply to topic Reply with quote

HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH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HAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
Back to top
View users profile Send private message Add User to Ignore List
Purge
Episode I > Eposide III
Jar-Jar is kool


Age:35
Gender:Gender:Male
Joined: Sep 08 2004
Posts: 2019
Offline

PostPosted: Fri Apr 15, 2005 11:25 pm    Post subject: Reply to topic Reply with quote

Holy hell...
Back to top
View users profile Send private message Add User to Ignore List
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Fri Apr 15, 2005 11:59 pm    Post subject: Reply to topic Reply with quote

Ok, I'm assuming by those two comments I either did this the REALLY HARD way... or I did something ingenious... I'm opting for the first of the two possibilities...

What's the better way of doing this?

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Sat Apr 16, 2005 12:28 am    Post subject: Reply to topic Reply with quote

Alright. Since I was LAUGHED at for my first try, here's a refined attempt!

Code: Show/Hide

public String getCoords(Player p) {
   String c[]={"A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T"};
   int x=p.getXLocation()/819;
   int y=p.getYLocation()/819)+1;
   return xc[x]+y;
}


Better? I've only been doing this for a whole four days... Ya can cut the newbie some slack! Last time I coded was back in Dos 6.22 in Borland C 3.1!

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
SamHughes
Server Help Squatter


Joined: Jun 30 2004
Posts: 251
Location: Greenwich
Offline

PostPosted: Sat Apr 16, 2005 2:00 am    Post subject: Reply to topic Reply with quote

wiredfreak wrote:
Code: Show/Hide

   public String getCoords(Player p) {
      int x=0;
      int y=0;
      
      x = (((p.getXLocation()/16) * 20) / 1024) ;
      y = (((p.getYLocation()/16) * 20) / 1024) + 1;

      String xc[]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",
"P","Q","R","S","T","U","V","W","X","Y","Z"};

      return xc[x]+y
   }


Okay. First of all, dividing by 16, multiplying by 20, and dividing by 1024 is inefficient. Though it is the least of your worries. I would not divide by 819, as the mathematical result is not the same.

First, the fraction 20/16 could be simplified to 5/4. So you could have the two equivalent lines,

Code: Show/Hide
      x = (((p.getXLocation()/4) * 5) / 1024) ;
      y = (((p.getYLocation()/4) * 5) / 1024) + 1;


But there is no need to use two division operations, when one would suffice. So the lines could be replaced with

Code: Show/Hide
      x = ((p.getXLocation() * 5) / 4096) ;
      y = ((p.getYLocation() * 5) / 4096) + 1;


However, division is expensive. Instead of dividing by 4096, you could simply shift the bits 14 positions over. Division is slow; bit-shift operations are zippy. 4096 = 2**12, so that would be written as,

Code: Show/Hide
      x = ((p.getXLocation() * 5) >> 12) ;
      y = ((p.getYLocation() * 5) >> 12) + 1;


These lines are a distraction, though. The real source of inefficiency is

Code: Show/Hide
      String xc[]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O",
"P","Q","R","S","T","U","V","W","X","Y","Z"};


This code will end up calling the String object's constructor 26 times. First of all, the possible coordinate letters run up to "T" and no further; the "U".."Z" are a waste. Second, there is no reason for this array to exist at all.

In order to get a character from A..T out of an integer in the range 0..19, all you have to do is add 65 to the integer. So you could use the lines,

Code: Show/Hide

char k[];
k[0] = x + 65;
k[1] = 0;

return String(k) + y;


instead of that humongous array garbage.

Maybe that could be written more concisely. Is

Code: Show/Hide
char k[] = {x+65,0};


valid C(++)? (Or must only constants lie in those brackets?)
Back to top
View users profile Send private message Add User to Ignore List
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Sat Apr 16, 2005 2:39 am    Post subject: Reply to topic Reply with quote

Sam,

Thank you for the help. I've changed the mathematic lines... but, since this is Java, I don't know how to make the other portion of your code work...

I attempted to use it as-is to no avail, I get errors. I tried modifying to what I thought might work... still didn't work... so, I'm still stuck using the humongous string array. heh.

Any other ideas? icon_smile.gif

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sat Apr 16, 2005 6:17 am    Post subject: Reply to topic Reply with quote

Haha, this
Code: Show/Hide
String xc[]={"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"};

reminds me of my "31337" code to convert "1337 5p34k" to normal language:

Quote:
return strreplace(strreplace(strreplace(strreplace(strreplace
(strreplace(strreplace(strreplace(strreplace(strreplace(
line, '1', 'i'),'2', 'z'), '3', 'e'), '4', 'a'), '5', 's')
,'6', 'g'), '7', 't'), '8', 'b'), '9', 'g'), '0', 'o');


Still can't use a second code block in my posts. icon_sad.gif
I wrote it like that to get a really ugly function call and, well, as you can see, it's bad ^ 10. sa_tongue.gif
Back to top
View users profile Send private message Add User to Ignore List
Mr Ekted
Movie Geek


Gender:Gender:Male
Joined: Feb 09 2004
Posts: 1379
Offline

PostPosted: Sat Apr 16, 2005 7:57 am    Post subject: Reply to topic Reply with quote

Be careful trying to simplify integer math.

Code: Show/Hide
a = b / 4 * 5;


is not the same as

Code: Show/Hide
a = b * 5 / 4;


Also, most compilers are very good at detecting simplifications in arithmetic--even ones that humans would not see. In this case, it's best to write code that makes sense and is readable, and let the optimizier do its job.

I am 100% against the String class no matter how simply it is used. Consider this code:

Code: Show/Hide
String function ()
{
String a;

// blah blah

return a + "wins the game!";
}


Whenever "a" is assigned a non-null value, memory is allocated. The return value is a string that needs to be created (allocated)--twice! And when the return value is assign back in the calling function, another allocation takes place. This is retarded. Maybe the use of this function is limited, but once you get used to using Strings, you will use them everywhere, and the above code could easily be 50x faster. No commercial app that handles large amounts of text (Notepad, Wordpad, Word, Excel, VisualStudio, IE, Netscape, Firefox, OpenOffice Write, etc) would be caught dead using String.
Back to top
View users profile Send private message Add User to Ignore List
Cyan~Fire
I'll count you!
I'll count you!


Age:37
Gender:Gender:Male
Joined: Jul 14 2003
Posts: 4608
Location: A Dream
Offline

PostPosted: Sat Apr 16, 2005 10:14 am    Post subject: Reply to topic Reply with quote

Ekted wrote:
Whenever "a" is assigned a non-null value, memory is allocated.

Code: Show/Hide
String::String()
{
   len = 0;
   msg = new char[1];
   *msg = '\0';
}

icon_cry.gif

Edit: Oh wait... this is TWCore, not MERV... oh well, Java Strings, even more inefficient. icon_razz.gif
Back to top
View users profile Send private message Add User to Ignore List Visit posters website
wiredfreak
Newbie


Age:50
Gender:Gender:Male
Joined: Apr 14 2005
Posts: 14
Offline

PostPosted: Sat Apr 16, 2005 11:36 am    Post subject: Reply to topic Reply with quote

Well, until I'm shown a better way to do things, it's going to be difficult for me to improve my coding abilities... Simply laughing at me or criticizing me without offering solutions to the problems doesn't do much other than show immaturaty and perhaps insecurity. But I'm not going to sling hash here... I came here for help, and the only ones that have really offered it are Mr. Ekted and Sam, granted that the former is the biggest offender of being offensive right now.

I'm new to this. I've said it more than once, and it should be quite obvious. It's similar to what I used to do many years ago, but I've forgotten quite a bit and am relearning everything... and then some. So, any future problems I have, I'll refrain from posting my spaghetti and simply ask for someone elses solution and see how close I came to being efficient with my own solution (if mine even works).

Regardless of how inefficient my code may be, it still functions the way it was designed and gives the desired results. That in itself should speak volumes when considering that when I posted that code, I'd only been working with Java and twcore for a whopping 4 days, without ever having looked at it before. Not to mention I haven't coded since the DOS 6.22 days in anything other than Tribes/1 gamecode (which was a disaster anyway).

And as to my simplification of the math I used, it actually simplified down to 819.2, but to keep it simple, I dropped the .2. It still gave me reliable coordinates, so it wasn't something I was too concerned with. I've decided to use Sam's solution to that problem, as it's just as effective, and I like how it looks. And he showed it to me without being snyde...

Cheers.

-wf
Back to top
View users profile Send private message Add User to Ignore List MSN Messenger
Solo Ace
Yeah, I'm in touch with reality...we correspond from time to time.


Age:37
Gender:Gender:Male
Joined: Feb 06 2004
Posts: 2583
Location: The Netherlands
Offline

PostPosted: Sat Apr 16, 2005 12:11 pm    Post subject: Reply to topic Reply with quote

Sam was the only one who actually gave you a solution. sa_tongue.gif

Anyway, I think you should look in the MERVBot source on how to do such things.

I think this is catid's C++ version on what you're trying to do (MERVBot v38, map.h (line 14 - 15) and map.cpp (line 32 - 54)):
Code: Show/Hide
// Code from map.h, line 14 - 15:

#define TILE_MAX_X 0x400
#define TILE_MAX_Y 0x400

//Code from map.cpp, line 32 - 54:

Sint32 getNumeric(Sint32 y)
{
   return (y * 20 / TILE_MAX_Y) + 1;
}

char getAlpha(Sint32 x)
{
   return char('A' + x * 20 / TILE_MAX_X);
}

String getCoords(Sint32 x, Sint32 y)
{
   String s;

   char alpha[2];
   alpha[0] = getAlpha(x);
   alpha[1] = '\0';

   s += alpha;
   s += getNumeric(y);

   return s;
}


This, would burn Ek's eyes again, though.

We were taught (and forced at tests) to use the String class in Java, and well, I'm sure the code I always have to use in my applets sucks.
Although, I'm the only one who actually knows how to get my applets to work, not even the teacher could teach me how to write better code.
Ah well, I don't like Java anyway.
Back to top
View users profile Send private message Add User to Ignore List
Display posts from previous:   
Post new topic   Reply to topic    Server Help Forum Index -> Bot Questions All times are GMT - 5 Hours
Goto page 1, 2  Next
Page 1 of 2

 
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: 208 page(s) served in previous 5 minutes.

phpBB Created this page in 0.571232 seconds : 49 queries executed (85.4%): GZIP compression disabled