From basic at us.netrek.org Tue Nov 13 18:42:54 2012 From: basic at us.netrek.org (Bob Tanner) Date: Tue, 13 Nov 2012 18:42:54 -0600 Subject: [netrek-dev] Client connection: State? References: <20121024065625.GM8324@us.netrek.org> <20121026013428.GJ5473@us.netrek.org> <20121026043858.GK5473@us.netrek.org> Message-ID: On 2012-10-28 22:41:27 +0000, Bob Tanner said: > Something buggy in how I handle segmentation of the packets. > > Example, I get 1340 bytes, after reading 15 SP_MOTD packets (15 * 84 = > 1260) I have 80 bytes "left over". Code goes into "misalign" state and > things are broken from that point forward. Spending time getting to > know Xcode and it's debugging. Been short on time lately. Finally getting around to this issue. Found my problem. Guess I should write my unit tests before the code huh? Anyways, I feel like I'm missing something really simple. I want to simulate "fragmented" packets. I cannot for the life of me figure out how in objective-c to change ASCII text into the equivalent hex values. I'm doing stuff like this now (SP_MOTD packet fragment) const char shouldFragment[] = { 0x0b, 0x00, 0x00, 0x00, 0x48, 0x6f, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x3a, 0x20, 0x42, 0x61, 0x73, 0x69, 0x63, 0x20, 0x3c, 0x62, 0x61, 0x73, 0x69, 0x63, 0x40, 0x75, 0x73, 0x2e, 0x6e, 0x65, 0x74, 0x72, 0x65, 0x6b, 0x2e, 0x6f, 0x72, 0x67, 0x3e }; What am I missing? Seem like there should be something to change "Bob" into "0x42 0x6f 0x62" const char *bob = asciiToHex("Bob"); I'm feeling really dumb right now. -- Bob Tanner Key fingerprint = 9906 320A 8BB6 64AD 96A7 7785 CBFB 10BF 568B F98C -------------- next part -------------- An HTML attachment was scrubbed... URL: From quozl at us.netrek.org Tue Nov 13 19:27:20 2012 From: quozl at us.netrek.org (James Cameron) Date: Wed, 14 Nov 2012 12:27:20 +1100 Subject: [netrek-dev] Client connection: State? In-Reply-To: References: <20121024065625.GM8324@us.netrek.org> <20121026013428.GJ5473@us.netrek.org> <20121026043858.GK5473@us.netrek.org> Message-ID: <20121114012720.GB19819@us.netrek.org> I don't know objective-c, but I have a few comments: - for injecting data stream faults, consider also doing it server side, potentially much easier than client side, - the fault-injecting code need not look nice, so using a hex dump is quite okay for the task, - the packets are never actually segmented, it is better to understand that the API you are using may not return a whole Netrek packet, and you will have to buffer what you have and try reading again, - build the packets using the same mechanism that you use to unpack them, ... which since I haven't seen how you are unpacking them I can't imagine how you would pack them. > What am I missing? Seem like there should be something to change > "Bob" into "0x42 0x6f 0x62" char *bob = "Bob"; isn't this a pointer to an array containing 0x42 0x6f 0x62 0x00? -- James Cameron http://quozl.linux.org.au/ From basic at us.netrek.org Wed Nov 14 23:19:19 2012 From: basic at us.netrek.org (Bob Tanner) Date: Wed, 14 Nov 2012 23:19:19 -0600 Subject: [netrek-dev] Client connection: State? References: <20121024065625.GM8324@us.netrek.org> Message-ID: On 2012-10-24 06:56:25 +0000, James Cameron said: > SP_PLANET_LOC pnum= 0 x= 20000 y= 80000 name= Earth Getting closer. Building game packet for SP_PLANET_LOC I'm getting some whacky values for x and y SP_PLANET_LOC pnum=0 x=541982720 y=2151153920 name=Earth Looking at the raw data 1a type 00 pnum 00 pad2 00 pad3 00004e20 x 00013880 y Putting that into a test program I get the right stuff pnum=0 x=20000 y=80000 name=Earth Here is the struct I'm using typedef struct _serverPacketPlanetLocationStruct { int8_t type; /* SP_PLANET_LOC */ int8_t pnum; int8_t pad2; int8_t pad3; int32_t x; int32_t y; int8_t name[16]; } serverPacketPlanetLocationStruct; Making sure the sizes is right ServerPacketPlanetLocation 28 SP_PLANET_LOC 28 NSLog is a lot like printf, it's what I use to debug NSLog(@"%@ pnum=%d x=%d y=%d name=%s", self, gamePacket.pnum, gamePacket.x, gamePacket.y, gamePacket.name); Some reason it feels like an endian issue (don't ask me why) Posting it here for comments. It's late. I'll look at it more tomorrow night. -- Bob Tanner Key fingerprint = 9906 320A 8BB6 64AD 96A7 7785 CBFB 10BF 568B F98C From quozl at us.netrek.org Wed Nov 14 23:47:50 2012 From: quozl at us.netrek.org (James Cameron) Date: Thu, 15 Nov 2012 16:47:50 +1100 Subject: [netrek-dev] Client connection: State? In-Reply-To: References: <20121024065625.GM8324@us.netrek.org> Message-ID: <20121115054750.GB15987@us.netrek.org> On Wed, Nov 14, 2012 at 11:19:19PM -0600, Bob Tanner wrote: > On 2012-10-24 06:56:25 +0000, James Cameron said: > > >SP_PLANET_LOC pnum= 0 x= 20000 y= 80000 name= Earth > > Getting closer. > > Building game packet for SP_PLANET_LOC I'm getting some whacky > values for x and y > > SP_PLANET_LOC pnum=0 x=541982720 y=2151153920 name=Earth These numbers are byte swapped forms of the raw data. 541982720 is 0x204E0000 and should be 0x00004E20 2151153920 is 0x80380100 and should be 0x00013880 So check the order of the bytes as they are unpacked into your local variables. Should not cause misalignment though. > > Looking at the raw data > > 1a type > 00 pnum > 00 pad2 > 00 pad3 > 00004e20 x > 00013880 y > > Putting that into a test program I get the right stuff > > pnum=0 x=20000 y=80000 name=Earth > > Here is the struct I'm using > > typedef struct _serverPacketPlanetLocationStruct > { > int8_t type; /* SP_PLANET_LOC */ > int8_t pnum; > int8_t pad2; > int8_t pad3; > int32_t x; > int32_t y; > int8_t name[16]; > } serverPacketPlanetLocationStruct; > > Making sure the sizes is right > > ServerPacketPlanetLocation 28 > SP_PLANET_LOC 28 > > NSLog is a lot like printf, it's what I use to debug > > NSLog(@"%@ pnum=%d x=%d y=%d name=%s", self, gamePacket.pnum, > gamePacket.x, gamePacket.y, gamePacket.name); > > Some reason it feels like an endian issue (don't ask me why) > > Posting it here for comments. It's late. I'll look at it more tomorrow night. > > -- > Bob Tanner Key fingerprint = 9906 > 320A 8BB6 64AD 96A7 7785 CBFB 10BF 568B F98C > > > _______________________________________________ > netrek-dev mailing list > netrek-dev at us.netrek.org > http://mailman.us.netrek.org/mailman/listinfo/netrek-dev > -- James Cameron http://quozl.linux.org.au/ From basic at us.netrek.org Thu Nov 15 18:19:50 2012 From: basic at us.netrek.org (Bob Tanner) Date: Thu, 15 Nov 2012 18:19:50 -0600 Subject: [netrek-dev] Client connection: State? References: <20121024065625.GM8324@us.netrek.org> <20121115054750.GB15987@us.netrek.org> Message-ID: On 2012-11-15 05:47:50 +0000, James Cameron said: > These numbers are byte swapped forms of the raw data. > > 541982720 is 0x204E0000 and should be 0x00004E20 > 2151153920 is 0x80380100 and should be 0x00013880 > > So check the order of the bytes as they are unpacked into your local > variables. > > Should not cause misalignment though. That was it. gamePacket.x = NSSwapBigIntToHost(gamePacket.x); Fixes the problem. -- Bob Tanner Key fingerprint = 9906 320A 8BB6 64AD 96A7 7785 CBFB 10BF 568B F98C From apsillers at gmail.com Sun Nov 18 21:33:47 2012 From: apsillers at gmail.com (Andrew Sillers) Date: Sun, 18 Nov 2012 22:33:47 -0500 Subject: [netrek-dev] HTML5 Netrek Lite Message-ID: Hello all, I've been hard at work on the HTML5 Netrek client, online at http://trekproxy.nodester.com (and source at https://github.com/apsillers/html5-netrek). I have made massive improvements to the game's performance and usability (indeed, while I was testing on Continuum, I found myself playing several full rounds of pre-T). Since my last update in April, I have added: - login screen with server selection - speed indicator (settable with mouse, too -- I was hoping to make this playable on a tablet someday) - engine temp indicator - cloaking - repair/fuel/army planet indicators - phasers (visually a little messy, but they're there) - defensive torp detonation - incoming chat (no outgoing yet; not pretty) - army transport (untested, but I think it should work) When you try it out, know that sometimes the outfitting screen does not work and you need to refresh the page. This happens very rarely, and I am working on a fix. There's also a "bug" where you get ghost busted after 20-30 seconds of inactivity, which will disappear as soon as I get pings working. But enough about present. Let's talk about THE FUTURE: Sadly, I must focus my attention to other projects and cannot continue regular development on the client (until at least next year, probably). There's a lot of work to do before this can be a fully-fledged client (explosion animations, tractors, pressors, key mapping, alliances, to name a few) but I think this client could be a kind of "Netrek Lite" that new prospective players could play in-browser, to sample the game without having to download and install a native client application. My question to all of you is: what's the best way to go about it? I don't have time to integrate a dynamic tutorial into the game, but I could make an on-page static tutorial ("Once you set course back toward Earth, go to the next lesson...") with paged, incremental lessons. The main question is whether to use a separate server for learning (a quiet server is good for learning to drive, but not combat; a hot server might keep you from following the tutorial due to unexpected combat). Similarly, what functionality is missing right now that you feel is *critical* to learning to play and/or keeping a prospective player interested? I can give this project a few more solid hours of effort, so please let me know how I should spend them. For example, I could probably implement tractors and pressors, or I could clean up the phaser animation, or I could ensure chat works cleanly, but I can only do so much. I need some discussion of what you think is most important. Rearranging and resizing the elements on the screen (world, galactic, chat) is easiest (and probably most important, since right now the chat is very awkwardly placed) -- that would take only a matter of minutes, once I decided where to place everything. Finally, if I am going to use a static tutorial, I need someone to either 1) draft out the tutorial text, or at least 2) propose a lesson plan that I could flesh out into a set of tutorial pages. What say you, mailing list? --Andrew P.S. I've only really tested the client on Ubuntu Firefox, so let me know if you find any big browser compatibility bugs. If your browser supports canvas and Websockets (and even those are technically optional) and you find a problem, let me know. -------------- next part -------------- An HTML attachment was scrubbed... URL: From quozl at us.netrek.org Tue Nov 20 21:31:01 2012 From: quozl at us.netrek.org (James Cameron) Date: Wed, 21 Nov 2012 14:31:01 +1100 Subject: [netrek-dev] HTML5 Netrek Lite In-Reply-To: References: Message-ID: <20121121033101.GB6869@us.netrek.org> G'day Andrew, Thanks for your work on the HTML5 client. Progress looks good. I'm using Ubuntu 12.10 with Firefox 16.0.2. The most common problem I have is that Quick Find appears whenever I try to press a key. I think that one of the quickest features you might add would be on-screen buttons for the keyboard operations, that would serve to act as a learning tool and reminder for bindings. Regarding tutorials. When I am teaching the game to teenagers, once a year, I use a very basic lesson plan, with some assistance from the Gytha client's achievement list. http://james.tooraweenah.com/cgi-bin/darcsweb.cgi?r=gytha;a=headblob;f=/gytha/__init__.py#l5209 shows the achievements, and this ordering is close to what I use as a speaking script, while my aids wander the classroom to check that the players have heard the instruction and have done the achievement. I also use a teaching lesson plan that can be found in the server source, which gradually enables features on the server over a period of fifteen minutes. http://james.tooraweenah.com/cgi-bin/darcsweb.cgi?r=netrek-server;a=headblob;f=/Vanilla/tools/teacher The Gytha client also saves the achievements in a file in the users' home directories, so we're able to assess progress during the session. Also, the server can provide a parallel rudimentary achievements system using the MOTD tips packets. You might want to check if you can use that. -- (I didn't get your netrek-dev@ posting, the archives show it is present, but the spam traps must have got it. I saw a forwarded copy in netrek-forever@ ) -- James Cameron http://quozl.linux.org.au/ From apsillers at gmail.com Sat Nov 24 22:32:17 2012 From: apsillers at gmail.com (Andrew Sillers) Date: Sat, 24 Nov 2012 23:32:17 -0500 Subject: [netrek-dev] HTML5 Netrek Lite In-Reply-To: <20121121033101.GB6869@us.netrek.org> References: <20121121033101.GB6869@us.netrek.org> Message-ID: Hi James, all, I've added on-screen buttons/indicators, included some context-sensitive ones (bomb, beam) for orbiting. Excellent suggestion -- it increases the teaching value of the client a lot. Regarding FF16 Quick Find, I don't see that behavior, but I added a event.preventDefault() call in the keypress handler that should stop that from happening. I also added modest support for tractors and pressors, which requires you to click on a target ship after you press the key. The MOTD tips are a great idea; I'll turn them on. I've also added a "Quick Start" guide that pops up when you press Tab. It contains introductory controls and a desperately brief overall game overview. Feedback on anything there would be most welcome. Thanks for all the suggestions! I'll post again soon with my final (for now) results. Andrew G'day Andrew, Thanks for your work on the HTML5 client. Progress looks good. I'm using Ubuntu 12.10 with Firefox 16.0.2. The most common problem I have is that Quick Find appears whenever I try to press a key. I think that one of the quickest features you might add would be on-screen buttons for the keyboard operations, that would serve to act as a learning tool and reminder for bindings. Regarding tutorials. When I am teaching the game to teenagers, once a year, I use a very basic lesson plan, with some assistance from the Gytha client's achievement list. http://james.tooraweenah.com/cgi-bin/darcsweb.cgi?r=gytha;a=headblob;f=/gytha/__init__.py#l5209 shows the achievements, and this ordering is close to what I use as a speaking script, while my aids wander the classroom to check that the players have heard the instruction and have done the achievement. I also use a teaching lesson plan that can be found in the server source, which gradually enables features on the server over a period of fifteen minutes. http://james.tooraweenah.com/cgi-bin/darcsweb.cgi?r=netrek-server;a=headblob;f=/Vanilla/tools/teacher The Gytha client also saves the achievements in a file in the users' home directories, so we're able to assess progress during the session. Also, the server can provide a parallel rudimentary achievements system using the MOTD tips packets. You might want to check if you can use that. -- (I didn't get your netrek-dev@ posting, the archives show it is present, but the spam traps must have got it. I saw a forwarded copy in netrek-forever@ ) -- James Cameron http://quozl.linux.org.au/ -------------- next part -------------- An HTML attachment was scrubbed... URL: From quozl at us.netrek.org Fri Nov 30 20:35:41 2012 From: quozl at us.netrek.org (James Cameron) Date: Sat, 1 Dec 2012 13:35:41 +1100 Subject: [netrek-dev] HTML5 Netrek Lite In-Reply-To: References: <20121121033101.GB6869@us.netrek.org> Message-ID: <20121201023541.GG6572@us.netrek.org> G'day Andrew, I gave it another try just then. Can you tell me how I can set up my own instance so that I can make code changes? I like the context sensitive buttons. The Quick Find didn't stop happening, but the app did get the keystrokes eventually. I think the Quick Start guide should be more obvious. Tab won't be communicated easily. On Sat, Nov 24, 2012 at 11:32:17PM -0500, Andrew Sillers wrote: > Hi James, all, > > I've added on-screen buttons/indicators, included some context-sensitive ones > (bomb, beam) for orbiting. Excellent suggestion -- it increases the teaching > value of the client a lot. > > Regarding FF16 Quick Find, I don't see that behavior, but I added a > event.preventDefault() call in the keypress handler that should stop that from > happening. > > I also added modest support for tractors and pressors, which requires you to > click on a target ship after you press the key. > > The MOTD tips are a great idea; I'll turn them on. I've also added a "Quick > Start" guide that pops up when you press Tab. It contains introductory controls > and a desperately brief overall game overview. Feedback on anything there would > be most welcome. > > Thanks for all the suggestions! I'll post again soon with my final (for now) > results. > > Andrew > > G'day Andrew, > > Thanks for your work on the HTML5 client. Progress looks good. > > I'm using Ubuntu 12.10 with Firefox 16.0.2. The most common problem I > have is that Quick Find appears whenever I try to press a key. > > I think that one of the quickest features you might add would be > on-screen buttons for the keyboard operations, that would serve to act > as a learning tool and reminder for bindings. > > Regarding tutorials. > > When I am teaching the game to teenagers, once a year, I use a very > basic lesson plan, with some assistance from the Gytha client's > achievement list. > > http://james.tooraweenah.com/cgi-bin/darcsweb.cgi?r=gytha;a=headblob;f=/gytha/ > __init__.py#l5209 > shows the achievements, and this ordering is close to what I use as a > speaking script, while my aids wander the classroom to check that the > players have heard the instruction and have done the achievement. > > I also use a teaching lesson plan that can be found in the server > source, which gradually enables features on the server over a period > of fifteen minutes. > > http://james.tooraweenah.com/cgi-bin/darcsweb.cgi?r=netrek-server;a=headblob;f= > /Vanilla/tools/teacher > > The Gytha client also saves the achievements in a file in the users' > home directories, so we're able to assess progress during the session. > > Also, the server can provide a parallel rudimentary achievements > system using the MOTD tips packets. You might want to check if you > can use that. > > -- > > (I didn't get your netrek-dev@ posting, the archives show it is > present, but the spam traps must have got it. I saw a forwarded copy > in netrek-forever@ ) > > -- > James Cameron > http://quozl.linux.org.au/ -- James Cameron http://quozl.linux.org.au/