Looking for technical PSO information
Moderators: BlueCrab, Aleron Ives
-
- DCEmu Newbie
- Posts: 6
- https://www.artistsworkshop.eu/meble-kuchenne-na-wymiar-warszawa-gdzie-zamowic/
- Joined: Fri Jan 10, 2014 11:41 am
- Has thanked: 0
- Been thanked: 0
Looking for technical PSO information
Hi guys
I've started taking quite a bit of interest in PSO lately, and i want to get into understanding how PSO works from a client / server standpoint and the protocols that are involved. I come from a background of c++ , c#, and ruby. I have glanced over the sylverant source code and i get the gist of what is going on.
I want to be able to add custom content to the game via client & server modifications, along with nearly seamless cross platform gaming. I know that's saying a lot. I'm not really asking for all of the answers, but more of a place to start looking.
I would to find out how much of the game's logic is handled client side vs server side. As well as any map singing / encryption methods.
So yea, i know what I'm asking is a huge amount of information, like i said, i am just looking for place to start looking.
I've started taking quite a bit of interest in PSO lately, and i want to get into understanding how PSO works from a client / server standpoint and the protocols that are involved. I come from a background of c++ , c#, and ruby. I have glanced over the sylverant source code and i get the gist of what is going on.
I want to be able to add custom content to the game via client & server modifications, along with nearly seamless cross platform gaming. I know that's saying a lot. I'm not really asking for all of the answers, but more of a place to start looking.
I would to find out how much of the game's logic is handled client side vs server side. As well as any map singing / encryption methods.
So yea, i know what I'm asking is a huge amount of information, like i said, i am just looking for place to start looking.
- Aleron Ives
- DCEmu Nutter
- Posts: 872
- Joined: Wed Jan 05, 2011 2:15 pm
- Location: California
- Has thanked: 0
- Been thanked: 25 times
- Contact:
Re: Looking for technical PSO information
Aside from decompiling the game, the only other place to look is in the Sylverant source, which you've already browsed. Facilitating things like cross-platform play requires massive amounts of work on the server side, since altering the client isn't an option with disc-based games.
"Fear the HUnewearl."
Re: Looking for technical PSO information
What makes the GC version of the game so different from the other versions? Maps / quests?
- Aleron Ives
- DCEmu Nutter
- Posts: 872
- Joined: Wed Jan 05, 2011 2:15 pm
- Location: California
- Has thanked: 0
- Been thanked: 25 times
- Contact:
Re: Looking for technical PSO information
Aside from packet differences (which are relatively easy to adjust, as DC/PC has significant differences that are already accounted for), the main problem with GC is that Sega arbitrarily changed the maps. One of the ways PSO minimises network traffic is to refer to map objects by number, e.g. pressing a switch to open a door relays packets saying that player 1 pressed switch object 38 to unlock door object 87. If the GC map has that same switch as object 39 or the door as object 88, PSO freaks out when it thinks you used a switch to unlock a box (or any other invalid, mismatched object relationship).
Consequently, the only way to make DC/PC and GC not crash when playing together is to make an entire translation table of which object is which in every single freeplay map so that the server can forge packets to make the object numbers coincide with what the target client expects them to be. It isn't particularly difficult to do, but it's tedious and time consuming, which is why it hasn't been done yet (aside from the other gameplay differences that make cross-platform gaming problematic, even without such bugs).
Consequently, the only way to make DC/PC and GC not crash when playing together is to make an entire translation table of which object is which in every single freeplay map so that the server can forge packets to make the object numbers coincide with what the target client expects them to be. It isn't particularly difficult to do, but it's tedious and time consuming, which is why it hasn't been done yet (aside from the other gameplay differences that make cross-platform gaming problematic, even without such bugs).
"Fear the HUnewearl."
- BlueCrab
- The Crabby Overlord
- Posts: 5665
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for technical PSO information
As Ives has said, cross-platform play (at least between all versions except Blue Burst) is extremely tedious and error-prone to do. Other than the mapping of objects and such, pretty much everything else should "just work" in Sylverant as it is, hence why DC/PC games can enable GC compatibility mode and GC users can join -- it just requires those extra steps to make sure people know the problems that can occur.
Blue Burst is a whole other can of worms, however. While it is possible to get it to work, it would probably require disassembling multiple versions of the game, and it would require the server to do a lot more work than it would otherwise have to. Not a fun task at all, and a whole lot more difficult than the GC/DC/PC compatibility.
Blue Burst is a whole other can of worms, however. While it is possible to get it to work, it would probably require disassembling multiple versions of the game, and it would require the server to do a lot more work than it would otherwise have to. Not a fun task at all, and a whole lot more difficult than the GC/DC/PC compatibility.
Re: Looking for technical PSO information
I don't know really how far i will take it, but it has sparked my curiosity for now.
I guess i need to grab a copy of wireshark and start analyzing the protocol, hopefully there not any encryption involved.
I guess i need to grab a copy of wireshark and start analyzing the protocol, hopefully there not any encryption involved.
- BlueCrab
- The Crabby Overlord
- Posts: 5665
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for technical PSO information
Everything is encrypted, with the exception of the initial encryption setup packet. You're better off reading the Sylverant source code for the communication protocols.
Re: Looking for technical PSO information
I see
I've been browsing the source and making notes. I have come across a few things i have some questions on. First, it looks like all of the ports are defined in login_server.c. Is the purpose of each port known? I originally thought it might have something to do with localization. As in american clients connect on one port and Japanese clients on another, but i am not really sure.
Second i see that a lot of strings are limited to 16 characters, is this because the game tries to fit the entire string in a single packet and nothing larger will fit?
Also what are the purpose of the web ports?
I've been browsing the source and making notes. I have come across a few things i have some questions on. First, it looks like all of the ports are defined in login_server.c. Is the purpose of each port known? I originally thought it might have something to do with localization. As in american clients connect on one port and Japanese clients on another, but i am not really sure.
Second i see that a lot of strings are limited to 16 characters, is this because the game tries to fit the entire string in a single packet and nothing larger will fit?
Also what are the purpose of the web ports?
- BlueCrab
- The Crabby Overlord
- Posts: 5665
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for technical PSO information
Well, keep in mind that the login server only handles the initial part of the communications. Actual gameplay takes place on the ship server. That has a lot more code dealing with packets than does the login server (both share the packets.h file you're probably looking at, but the "master" version of that is in the ship server as well).
As you initially suspected, different region/version clients connect on different ports to the login server. That's all there is to it there. As for string length, it's not so much an issue of the packet length (since TCP packets can be up to 4GiB in length, in theory -- not that the Dreamcast would be able to accept such a large packet, especially considering some of the really braindead stuff that the TCP stack on the DC did), that's just how the game does things. There's no special magic to it, that's just the maximum length that the strings needed to be in Sega's opinion. That said, there are plenty of packets that don't have a 16-byte max length for strings, such as those for talking on the ship server.
As for the web ports, that's used by the website to check the status of the login server. That's completely specific to Sylverant itself and has nothing to do with the game.
As you initially suspected, different region/version clients connect on different ports to the login server. That's all there is to it there. As for string length, it's not so much an issue of the packet length (since TCP packets can be up to 4GiB in length, in theory -- not that the Dreamcast would be able to accept such a large packet, especially considering some of the really braindead stuff that the TCP stack on the DC did), that's just how the game does things. There's no special magic to it, that's just the maximum length that the strings needed to be in Sega's opinion. That said, there are plenty of packets that don't have a 16-byte max length for strings, such as those for talking on the ship server.
As for the web ports, that's used by the website to check the status of the login server. That's completely specific to Sylverant itself and has nothing to do with the game.
Re: Looking for technical PSO information
Ah, thats makes quite a bit more sense. I was assuming the game was limiting all packets to a small size, possibly because of connection quality back in the DC era. Do you happen to know which ports are assigned to each localization? If not i can probably figure it out. Are the different clients in each region limited to a specific subset of languages?BlueCrab wrote:Well, keep in mind that the login server only handles the initial part of the communications. Actual gameplay takes place on the ship server. That has a lot more code dealing with packets than does the login server (both share the packets.h file you're probably looking at, but the "master" version of that is in the ship server as well).
As you initially suspected, different region/version clients connect on different ports to the login server. That's all there is to it there. As for string length, it's not so much an issue of the packet length (since TCP packets can be up to 4GiB in length, in theory -- not that the Dreamcast would be able to accept such a large packet, especially considering some of the really braindead stuff that the TCP stack on the DC did), that's just how the game does things. There's no special magic to it, that's just the maximum length that the strings needed to be in Sega's opinion. That said, there are plenty of packets that don't have a 16-byte max length for strings, such as those for talking on the ship server.
As for the web ports, that's used by the website to check the status of the login server. That's completely specific to Sylverant itself and has nothing to do with the game.
So are NTST-J and NTSC-U/C combined into one port? Or is PAL and NTSC-U/C combined in one port?
- BlueCrab
- The Crabby Overlord
- Posts: 5665
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for technical PSO information
It depends on the version of the game you're talking about how the ports are combined.
For the Dreamcast versions, all regions for PSOv1 and PSOv2 used port 9200, except for the Eurpoean versions when running in 50hz mode, which used port 9201. Port 9000 was used by the Dreamcast Network Trial Edition, as is commented in the source code.
As for the Gamecube versions, I believe that the Japanese versions used ports 9000, 9001, 9002, and 9003; the US versions used ports 9100 and 9103; and the European versions used ports 9200, 9201, and 9203 (yes, two of these overlap with the Dreamcast version, hence the odd code for sorting out what version is connecting in the source code). I'm not entirely positive of those assignments, as it's been a while since I actually checked. The xxx3 ports are all for Episode III, by the way (and 9002 is the Trial Edition of Episode III).
Language-wise, all non-trial versions have all languages that are supported on a given release; although I believe the translations were updated between the Japanese and US/EU releases, at least with the Dreamcast version. The Trial versions are all Japanese-only.
That said, I'd think that there's usually very little need to differentiate what regional variant of a game that a particular user is using, and there are other ways to do it than just the port number. Sylverant really doesn't make any differentiation of regions, as I've yet to find a reason to actually do so.
For the Dreamcast versions, all regions for PSOv1 and PSOv2 used port 9200, except for the Eurpoean versions when running in 50hz mode, which used port 9201. Port 9000 was used by the Dreamcast Network Trial Edition, as is commented in the source code.
As for the Gamecube versions, I believe that the Japanese versions used ports 9000, 9001, 9002, and 9003; the US versions used ports 9100 and 9103; and the European versions used ports 9200, 9201, and 9203 (yes, two of these overlap with the Dreamcast version, hence the odd code for sorting out what version is connecting in the source code). I'm not entirely positive of those assignments, as it's been a while since I actually checked. The xxx3 ports are all for Episode III, by the way (and 9002 is the Trial Edition of Episode III).
Language-wise, all non-trial versions have all languages that are supported on a given release; although I believe the translations were updated between the Japanese and US/EU releases, at least with the Dreamcast version. The Trial versions are all Japanese-only.
That said, I'd think that there's usually very little need to differentiate what regional variant of a game that a particular user is using, and there are other ways to do it than just the port number. Sylverant really doesn't make any differentiation of regions, as I've yet to find a reason to actually do so.
Re: Looking for technical PSO information
I wonder why they would decide to host over so many ports if the servers essentially were the same. I could see if it was redirecting to different ports which had different servers behind them for load balancing. I'll probably never know that answer.BlueCrab wrote:It depends on the version of the game you're talking about how the ports are combined.
For the Dreamcast versions, all regions for PSOv1 and PSOv2 used port 9200, except for the Eurpoean versions when running in 50hz mode, which used port 9201. Port 9000 was used by the Dreamcast Network Trial Edition, as is commented in the source code.
As for the Gamecube versions, I believe that the Japanese versions used ports 9000, 9001, 9002, and 9003; the US versions used ports 9100 and 9103; and the European versions used ports 9200, 9201, and 9203 (yes, two of these overlap with the Dreamcast version, hence the odd code for sorting out what version is connecting in the source code). I'm not entirely positive of those assignments, as it's been a while since I actually checked. The xxx3 ports are all for Episode III, by the way (and 9002 is the Trial Edition of Episode III).
Language-wise, all non-trial versions have all languages that are supported on a given release; although I believe the translations were updated between the Japanese and US/EU releases, at least with the Dreamcast version. The Trial versions are all Japanese-only.
That said, I'd think that there's usually very little need to differentiate what regional variant of a game that a particular user is using, and there are other ways to do it than just the port number. Sylverant really doesn't make any differentiation of regions, as I've yet to find a reason to actually do so.
Sorry for all of the questions lol. I just want to ensure i have my head properly wrapped around this
So i see a lot of code the only specifies DC and BB (especially in packets.h). Should i be assuming that the DC packets are identical to the GC and PC packets?
- BlueCrab
- The Crabby Overlord
- Posts: 5665
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for technical PSO information
For the most part, the DC and GC packets are identical -- where they are different there are different structures defined in the code. Packets for the PC version have a slightly different header, hence why there are a lot of structures with things that look like this at the top:
All versions prior to Blue Burst use a 4-byte long header. Blue Burst uses an 8-byte long header, hence why it's packets are separated out. Many of them are identical to the earlier versions with the exception of the header. However, because of how I cast pointers all over the place, I have to have different structure definitions for those packets (the union approach only works if all the types in the union are the same length).
Code: Select all
union {
dc_pkt_hdr_t dc;
pc_pkt_hdr_t pc;
} hdr;
- RyoDC
- Mental DCEmu
- Posts: 366
- Joined: Wed Mar 30, 2011 12:13 pm
- Has thanked: 2 times
- Been thanked: 0
Re: Looking for technical PSO information
Always wondered what this stuff for:
in v2_player struct.
Code: Select all
uint32_t grave_coords_time[5];
char grave_team[20];
char grave_message[24];
How do I try to build a Dreamcast toolchain:
- BlueCrab
- The Crabby Overlord
- Posts: 5665
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for technical PSO information
For the player's grave in Challenge Mode (which marks the last place where the user died while playing that mode).RyoDC wrote:Always wondered what this stuff for:in v2_player struct.Code: Select all
uint32_t grave_coords_time[5]; char grave_team[20]; char grave_message[24];
- Didi
- DCEmu Freak
- Posts: 70
- Joined: Mon Sep 30, 2013 9:44 am
- Location: Brasil
- Has thanked: 0
- Been thanked: 1 time
- Contact:
Re: Looking for technical PSO information
Leveraging the topic, anyone here knows and could tell how to enable Challenge mode and windows trade in private server of the PSOBB?
- BlueCrab
- The Crabby Overlord
- Posts: 5665
- Joined: Mon May 27, 2002 11:31 am
- Location: Sailing the Skies of Arcadia
- Has thanked: 9 times
- Been thanked: 69 times
- Contact:
Re: Looking for technical PSO information
Well, if we're talking about Sylverant it is unimplmented, so without additional code, you cannot. I believe the same goes for Tethealla, as I don't remember ever seeing any code to do so in that server either.
I haven't really studied PSOBB enough to comment on anything for sure with regard to either, but I'd suspect that the trade window could be done in a very similar fashion to how Sylverant handles it for PSOGC, except with the additional step of updating both sides' inventory on the server as well. Once again, that is pure conjecture, but it seems at least logical on its face.
I haven't really studied PSOBB enough to comment on anything for sure with regard to either, but I'd suspect that the trade window could be done in a very similar fashion to how Sylverant handles it for PSOGC, except with the additional step of updating both sides' inventory on the server as well. Once again, that is pure conjecture, but it seems at least logical on its face.