 |
Server Help Community forums for Subgame, ASSS, and bots
|
Author |
Message |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Thu Apr 14, 2005 2:56 pm Post subject: twcore issues. |
 |
|
|
|
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.
-wf |
|
Back to top |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Thu Apr 14, 2005 3:16 pm Post subject: |
 |
|
|
|
I just tried j2sdk1.4.2_08 with no success either.
-wf |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Thu Apr 14, 2005 4:13 pm Post subject: |
 |
|
|
|
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 |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Thu Apr 14, 2005 4:28 pm Post subject: |
 |
|
|
|
Dude. You rule.
I set it to 16384 and now receive the kill messages in the bot every time!
-wf |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Thu Apr 14, 2005 8:12 pm Post subject: |
 |
|
|
|
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 |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Thu Apr 14, 2005 8:39 pm Post subject: |
 |
|
|
|
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 |
|
 |
Chambahs Guest
Offline
|
Posted: Thu Apr 14, 2005 9:36 pm Post subject: |
 |
|
|
|
ekted owns you all, good luck with the bot wired
(off topic) just wondering ekted, what zone do you play?  |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Thu Apr 14, 2005 9:52 pm Post subject: |
 |
|
|
|
Powerball |
|
Back to top |
|
 |
Cerium Server Help Squatter

Age:42 Gender: Joined: Mar 05 2005 Posts: 807 Location: I will stab you. Offline
|
Posted: Thu Apr 14, 2005 10:02 pm Post subject: |
 |
|
|
|
Play???
Thats a bit of an understatement. |
|
Back to top |
|
 |
D1st0rt Miss Directed Wannabe

Age:37 Gender: Joined: Aug 31 2003 Posts: 2247 Location: Blacksburg, VA Offline
|
Posted: Thu Apr 14, 2005 10:43 pm Post subject: |
 |
|
|
|
Hmmm... learn something new every day  |
|
Back to top |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
Posted: Fri Apr 15, 2005 6:07 pm Post subject: |
 |
|
|
|
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 |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Fri Apr 15, 2005 9:52 pm Post subject: |
 |
|
|
|
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 |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Fri Apr 15, 2005 11:13 pm Post subject: |
 |
|
|
|
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.
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 |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Fri Apr 15, 2005 11:24 pm Post subject: |
 |
|
|
|
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAH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HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA
HAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHAHA |
|
Back to top |
|
 |
Purge Episode I > Eposide III Jar-Jar is kool

Age:35 Gender: Joined: Sep 08 2004 Posts: 2019 Offline
|
Posted: Fri Apr 15, 2005 11:25 pm Post subject: |
 |
|
|
|
Holy hell... |
|
Back to top |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Fri Apr 15, 2005 11:59 pm Post subject: |
 |
|
|
|
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 |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Sat Apr 16, 2005 12:28 am Post subject: |
 |
|
|
|
Alright. Since I was LAUGHED at for my first try, here's a refined attempt!
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 |
|
 |
SamHughes Server Help Squatter

Joined: Jun 30 2004 Posts: 251 Location: Greenwich Offline
|
Posted: Sat Apr 16, 2005 2:00 am Post subject: |
 |
|
|
|
wiredfreak wrote: |
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,
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
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,
x = ((p.getXLocation() * 5) >> 12) ;
y = ((p.getYLocation() * 5) >> 12) + 1;
|
These lines are a distraction, though. The real source of inefficiency is
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,
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
valid C(++)? (Or must only constants lie in those brackets?) |
|
Back to top |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Sat Apr 16, 2005 2:39 am Post subject: |
 |
|
|
|
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?
-wf |
|
Back to top |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sat Apr 16, 2005 6:17 am Post subject: |
 |
|
|
|
Haha, this 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.
I wrote it like that to get a really ugly function call and, well, as you can see, it's bad ^ 10.  |
|
Back to top |
|
 |
Mr Ekted Movie Geek

Gender: Joined: Feb 09 2004 Posts: 1379 Offline
|
Posted: Sat Apr 16, 2005 7:57 am Post subject: |
 |
|
|
|
Be careful trying to simplify integer math.
is not the same as
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:
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 |
|
 |
Cyan~Fire I'll count you!

Age:37 Gender: Joined: Jul 14 2003 Posts: 4608 Location: A Dream Offline
|
|
Back to top |
|
 |
wiredfreak Newbie
Age:50 Gender: Joined: Apr 14 2005 Posts: 14 Offline
|
Posted: Sat Apr 16, 2005 11:36 am Post subject: |
 |
|
|
|
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 |
|
 |
Solo Ace Yeah, I'm in touch with reality...we correspond from time to time.

Age:37 Gender: Joined: Feb 06 2004 Posts: 2583 Location: The Netherlands Offline
|
Posted: Sat Apr 16, 2005 12:11 pm Post subject: |
 |
|
|
|
Sam was the only one who actually gave you a solution.
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 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 |
|
 |
|
|
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
|
Software by php BB © php BB Group Server Load: 146 page(s) served in previous 5 minutes.
|