Suggestion for gcars Hey Fuzziqer. I'd like to start off by saying you've made a mighty fine program here. And that this is only a suggestion and you are under no obligation to take it.
However, as I've been doing more and more hacking into SSBM, I've noticed a problem: there are a lot of variables that need to be passed in order to ensure that the game is really in sync.
Now, conditional codes (like the ones you're working on) will surely do the trick to certain extent but there are still a LOT of scripts even only during battle that need to be passed. (I'm on the cusp of reaching that limit and that's not even talking about the potential for number of scripts that I haven't even gotten close to finding).
I've stripped it down to the very basics for gcars .95 play (of the existing scripts I have found) to make the game as smooth as possible:
° Character type, flags, costume (1 byte each)
° Number of kills/Lives/Number of coins (depending on your mode, pick 1 only!)
° Displayed Damage (somewhat optional yet highly recommended)
° Internal Damage high
° Internal Damage low
° Shield Size
° X coord high
° X coord Low
° Y coord high
° Y coord low
° X prev coord high
° X prev coord low
° Y prev coord high
° Y prev coord low
° character selection data
° Facing Direction
° Ground Variable High
° Ground Variable Low
° Falling State Variable High
° Falling State Variable Low
And that doesn't even include Animation (high and low), frame data (high and low), the global variables, velocity variables, or any other variables that may be deemed necessary in the future.
Conditional codes can cut down on globals and a few of the existing variables but not by enough, I don't think, before backlog kicks in. Part of it due to the fact that 32 bit variables take up a whole lot of space. Also, certain variables that are right next to each other (like xcoordinates and ycoordinates) take 4 lines of 64 bit code.
This is just a suggestion and I don't know how easy it would be to implement (since I haven't seen any of your code for gcars) but I have a suggestion to help get more scripts with less bandwidth:
Require that everybody have the same scripts (meaning player 1's "script 1" is identical to player 2's "script 1", and their "script 2"s are equal and etc). So everything is in the same order as well. Separate the scripts into 8 bit, 16 bit and 32 bit codes (depending on what the code affects in GCN Codetype helper); this can be done by adding another option in the "script editor" in Gcars or something. When a player sends their own data (let's say player 2 sends his data), his whole file he sends over the net starts with the player number (so 2 in this case), then all of the 8 bit data, then all the 16 bit data, then the 32 bit data (just the data, not the whole code). You shouldn't have to make separater codes or ending codes to mark where the 16 bit codes start or 32 bit codes start or when the file actually ends because the other 1 to 3 players have identical "script 2"s. So, all they need to know to start with is that the file they're recieving is from player 2 and then they start at the beginning of the file, removing an 8-bit data and putting it in the first script in "script 2", until all the 8-bit scripts in "script 2" are used up, at which point 16-bits are removed from the beginning of the file and so on until there are no more scripts to fill in data for in "script 2". Then, all those filled in scripts are run through the AR simulator. However, I don't know how gcars makes/distributes/stores the scripts. If storing all 4 scripts is too much data to store, I guess it might not work (although GCNrd is a huge file and it seems to work, although I may be oversimplifiying things). However, this is a huge bandwidth saver, I think. Addresses don't need to be sent since everyone has the addresses allready. Offsets don't need to be sent. This means for all 8-bit offsetted codes, instead of sending 64 bits over the line, only 8 bits are, an 800% jump in efficiency. 16 bits are similarly effected with a 400% jump in efficiency. Non-offsetted 32 bits are effected by a 200% jump. However, offsetted 32 bit variables are hugely beneffitted; instead of sending 128 bits of data for 2 lines of scripts, they only send 32 bits, a 400% jump in efficiency. Overall, there should be about a 400% jump in effiency (assuming 32 and 8 bit variables pretty much cancel each other out in the efficiency equation), which means you can make roughly 4 times as many scripts without worrying about backlog.
This could make conditional codes a little tricky though. From what I've seen though, there are two uses for conditional codes: one, to reduce the bandwidth needed. This is for such things as "level syncing", where specific values need to be set to sync up the levels (like bullet bill in Peach's castle), or for such things as menu syncing, something that eats up bandwidth when not in the menu. However, I've recently found another use for conditional values: preventing freezes and crashes. One of the codes I found will sync up ground/air state. However, the "battle" doesn't always start right at the same time (the gamecubes' announcer says "GO" at different times). The ground/air state variables also (apparently) keep track of the state of characters when they start up. So if the game is already supposed to be started on one screen but the other person has barely started and the games are supposed to sync up, the person who's already started freezes. The way I see of fixing this is with a conditional code that says, "if your game hasn't started yet, don't send this piece of data". However, there could be data later on that is found that could deal with the issue, "If I'm not in the same place the other guy is, don't take his data, which is similar but the problem is in the other direction.
Since there are conditional codes for next line, next two lines, and until z2 code, here's the first thing that comes to my mind:
When the gamecube is making data to send to others, the script could contain a preceding code before the conditional code that says "Does it matter what my condition is or does it matter what their condition is?" and then it adds a bit to the data that is being sent, 0 for the former and 1 for the latter. This preceeding code can be a variety of things, one way could be to use the two "Subtype 3" codes, under codetype 0 in GCN Codetype Helper: (size 0) indicating the sender matters and (size 1) indicating the reciever matters, which should be okay since they are unused codes anyway.
After that, it then evaluates the condition. It then adds another bit to the data, 0 for failing and 1 for passing; this'll be read by the reciever later. If passing, it then adds all the data from the codes that the conditional code is "conditioning". If failing, none of that data is sent.
So, after all of that, when the reciever gets the data, it says it's from player 2, so it goes over to "script 2". If the first script is an 8-bit script, it then reads 8 bits from the beginning of the file (not including the data that said it was from player 2) and puts it in. Etc. Then it gets to the "Does it matter if it's a sender or receiver code" preceeding the conditional. Then it goes into conditional mode. It reads the first bit afterwards to see if the sender matters of reciever matters. If sender matters, it reads the next bit to see if the conditional passed or didn't. If it passed, it runs the next lines in the script as normal (all the way up to the z2 code if applicable). If failed, it ignores the next line or next two lines or up to the z2 code depending on what the conditional was. This matches up with what the sender did. In the other case that the reciever matters, it should still read the next bit to see if it passed or failed on the sender's game. If failed, it ignores the next line, next two lines, or lines until the z2 code. If passed, the reciever goes and checks its OWN status. If he passed, the data is filled in and the codes are read. If he failed, the data is read but the codes are ignored. The reading part is important so the reciever go through the recieved data until it gets to the part right after the conditional, at which point normal work is resumed.
Again, this is only a suggestion and I don't know how you've programmed gcars and I only know enough of how it works as far as seen it in different situations. If you don't want to do it, that's fine, since it isyour program. Also, it's up to you on how much work you want to put into this. The conditional code implementation I put up could get a bit complicated (I'm already imagining).
But if you decide to implement bandwidth saving algorithms, I'd really like that :D. Anyway, good luck on making v1.0! I'm looking forward to it :)!
PS: Do you still have those velocity scripts? :mrgreen:
biolizard89- 06-23-2006
Re: Suggestion for gcars Hey Fuzziqer. I'd like to start off by saying you've made a mighty fine program here. And that this is only a suggestion and you are under no obligation to take it.
However, as I've been doing more and more hacking into SSBM, I've noticed a problem: there are a lot of variables that need to be passed in order to ensure that the game is really in sync.
Now, conditional codes (like the ones you're working on) will surely do the trick to certain extent but there are still a LOT of scripts even only during battle that need to be passed. (I'm on the cusp of reaching that limit and that's not even talking about the potential for number of scripts that I haven't even gotten close to finding).
I've stripped it down to the very basics for gcars .95 play (of the existing scripts I have found) to make the game as smooth as possible:
° Character type, flags, costume (1 byte each)
° Number of kills/Lives/Number of coins (depending on your mode, pick 1 only!)
° Displayed Damage (somewhat optional yet highly recommended)
° Internal Damage high
° Internal Damage low
° Shield Size
° X coord high
° X coord Low
° Y coord high
° Y coord low
° X prev coord high
° X prev coord low
° Y prev coord high
° Y prev coord low
° character selection data
° Facing Direction
° Ground Variable High
° Ground Variable Low
° Falling State Variable High
° Falling State Variable Low
And that doesn't even include Animation (high and low), frame data (high and low), the global variables, velocity variables, or any other variables that may be deemed necessary in the future.
Conditional codes can cut down on globals and a few of the existing variables but not by enough, I don't think, before backlog kicks in. Part of it due to the fact that 32 bit variables take up a whole lot of space. Also, certain variables that are right next to each other (like xcoordinates and ycoordinates) take 4 lines of 64 bit code. (Edit: Then again, that could sort of defeat the purpose of conditional codes in the first place...)
This is just a suggestion and I don't know how easy it would be to implement (since I haven't seen any of your code for gcars) but I have a suggestion to help get more scripts with less bandwidth:
Require that everybody have the same scripts (meaning player 1's "script 1" is identical to player 2's "script 1", and their "script 2"s are equal and etc). So everything is in the same order as well. Separate the scripts into 8 bit, 16 bit and 32 bit codes (depending on what the code affects in GCN Codetype helper); this can be done by adding another option in the "script editor" in Gcars or something. When a player sends their own data (let's say player 2 sends his data), his whole file starts with the player number (so 2 in this case), then all of the 8 bit data, then all the 16 bit data, then the 32 bit data (just the data, not the whole code). You shouldn't have to make separater codes or ending codes to mark where the 16 bit codes start or 32 bit codes start or when the file actually ends because the other 1 to 3 players have identical "script 2"s. So, all they need to know to start with is that the file they're recieving is from player 2 and then they start at the beginning of the file, removing the 8-bit data and putting it in the first script in "script 2", until all the 8-bit scripts in "script 2" are used up, at which point 16-bits are removed from the beginning of the file until there are no more scripts to fill in data for in "script 2". However, I don't know how gcars makes/distributes/stores the scripts. If storing all 4 scripts is too much data to store, I guess it might not work. However, this is a huge bandwidth saver, I think. Addresses don't need to be sent since everyone has the addresses allready. Offsets don't need to be sent. This means for all 8-bit offsetted codes, instead of sending 64 bits over the line, only 8 bits are, an 800% jump in efficiency. 16 bits are similarly effected with a 400% jump in efficiency. Non-offsetted 32 bits are effected by a 200% jump. However, offsetted 32 bit variables are hugely beneffitted; instead of sending 128 bits of data for 2 lines of scripts, they only send 32 bits, a 400% jump in efficiency. Overall, there should be about a 400% jump in effiency (assuming 32 and 8 bit variables pretty much cancel each other out in the efficiency equation), which means you can make roughly 4 times as many scripts without worrying about backlog.
As far as how conditional codes would work, since conditional codes depend on things being in order, you could - using the above example - have p2, when his GCN is making his own data, create a data of appropriate size (whether the code is in the 8, 16, or 32 bit section) either 1 or 0 to say "true" or "false". When this is transferred to the recieving gamecube, when the "conditional script" is run across, instead of checking its own data, they could check the data at that point to determine if the conditional passed or failed and ignore or use the next (few?) lines accordingly. This way, there is no discrepancy (such as when a conditional should pass on one gcn but not on the other like during transitional periods in the game). Also, this will allows for the scripts to still keep reading however much data they need for each line of script (depending on which section it is in, 8,16, or 32 bits).
Again, this is only a suggestion and I don't know how you've programmed gcars and I only know enough of how it works as far as seen it in different situations. If you don't want to do it, that's fine, since it isyour program.
But if you decide to implement bandwidth saving algorithms, I'd really like that :D. Anyway, good luck on making v1.0! I'm looking forward to it :)!
PS: Do you still have those velocity scripts? :mrgreen:
I totally agree; I think that a method of eliminating the parts of the codes other than the actual value would be great. Besides dealing with the backlog, it would also cut down on bandwidth usage by tons, which is good for people with slow connections. I don't know how well GCARS-CS's programming is suited to such a change (only Fuzziqer knows that), but if it is possible, I think it would be well worth it.
_glook- 06-23-2006
Thanks biolizard :).
Although, I did edit in my post how the conditional codes should work (I was thinking about it a little and conditional codes are a bit more complicated than I initially gave them credit for, especially since we're dealing with syncing issues. Which explains why I edited my post :)).
fuzziqersoftware- 06-24-2006
I did consider that when I was first designing GCARS-CS. The AR code list already works like that (player 1's code list is sent to all players, and they all replace their own with player 1's). Sending only values requires more overhead, however, and it might slow some games down (though SSBM I doubt would slow down at all). Unfortunately, it would probably take a lot of modification for the source to be adapted to such a protocol, as the way it's currently engineered, it doesn't care about large sizes. I probably should have thought about that earlier, though; I think I'll try to implement the values-only protocol.
biolizard89- 06-28-2006
This reminds me, is there any way my suggestion from ages ago about lossless controller data could be implemented? That way, most people don't need an update frequency that's low enough to cause backlog anyway.
(If anyone doesn't remember that, I'm talking about storing multiple copies of the controller data, one for each frame, and sending them all. So if you have the update frequency set to 10fps, it will send the 6 most recent frames of the controller data each time it updates the script, which means that button presses won't get lost. Controller data is really the only data that has to be synced really often; the rest is probably okay at a higher update frequency).
fuzziqersoftware- 06-28-2006
Those are the three things I'm really working on:
- Values-only updating
- Synchronization mode (thought of a new way to do this; should be easy)
- Lossless controller data sending
biolizard89- 06-28-2006
Those are the three things I'm really working on:
- Values-only updating
- Synchronization mode (thought of a new way to do this; should be easy)
- Lossless controller data sending
Awesome. I'm really looking forward to GCARS-CS v1.0.
By the way, have you reinstalled Ethereal yet? I'm really wondering what's screwing up my LAN setup.
Oh, and have fun at COSMOS!
GKi- 06-30-2006
i have a suggestion add a restart gcars to the main menu :twisted:
fuzziqersoftware- 06-30-2006
I installed Ethereal this morning, so after work today I can download that log and look at it.
I'm looking forward to COSMOS too (perhaps you noticed..... lol). I'll still be online, but all of my projects will be suspended until I get back, and I won't be on MSN either.
GCARS can be restarted when an exception occurs; if you're in debug mode, hold X and select Memory Card Manager to open the debug menu, and you can restart it from there.
biolizard89- 07-01-2006
I installed Ethereal this morning, so after work today I can download that log and look at it.
I'm looking forward to COSMOS too (perhaps you noticed..... lol). I'll still be online, but all of my projects will be suspended until I get back, and I won't be on MSN either.
GCARS can be restarted when an exception occurs; if you're in debug mode, hold X and select Memory Card Manager to open the debug menu, and you can restart it from there.
Have you had a chance to look at the Ethereal log?
Also, what kind of stuff do they do at COSMOS? You said math and science, but exactly what kind of science do they deal with? Cosmology?
fuzziqersoftware- 07-01-2006
COSMOS is an acronym, but I'm not sure exactly what it stands for. They teach all kinds of scientific subjects like robotics, biochemistry, engineering, and the like. I got into one of the few mathematics courses, which are even more difficult to get in to.
I haven't had a chance to look at the log - I wasn't home last night. Things just keep changing around here, and usually I can't predict them.
There probably won't be a GCARS release before I get back from COSMOS; my GameCube is broken, so I can't do any -*test*-('")ing. However, if I can get DevKitPPC working on my Mac, I may be able to release an un-*test*-('")ed beta while I'm there.
biolizard89- 07-01-2006
COSMOS is an acronym, but I'm not sure exactly what it stands for. They teach all kinds of scientific subjects like robotics, biochemistry, engineering, and the like. I got into one of the few mathematics courses, which are even more difficult to get in to.
I haven't had a chance to look at the log - I wasn't home last night. Things just keep changing around here, and usually I can't predict them.
There probably won't be a GCARS release before I get back from COSMOS; my GameCube is broken, so I can't do any -*test*-('")ing. However, if I can get DevKitPPC working on my Mac, I may be able to release an un-*test*-('")ed beta while I'm there.
That's cool with the log. I can wait.
COSMOS sounds awesome. Does your school do Botball (http://www.botball.org)? If not, you should see if they can get the funding to do it. It costs $2300 to register, but they'll give schools $1000 fee waivers if the schools are having trouble getting the money. The PTA at my school has covered a large part of Botball in the past. The Botball National Conference (including the tournament) for this year starts Jul. 7 and goes through Jul. 10. And conveniently for me, this year it's in Norman, OK (I live in Oklahoma). Anyway, Botball is really fun, especially if you're into computer programming, science, math, or engineering.
Have fun at COSMOS!
fuzziqersoftware- 07-01-2006
Botball looks neat; I wish my school would do it. I'd probably be the main programmer on our team.... lol
_glook- 07-06-2006
Wait, if I'm understanding this correctly would "lossless controller data" get rid of the need of syncing at all? If the button presses are all synced up, why would we need game syncing in the first place?
Maybe I'm just not understanding it correctly.
biolizard89- 07-06-2006
Wait, if I'm understanding this correctly would "lossless controller data" get rid of the need of syncing at all? If the button presses are all synced up, why would we need game syncing in the first place?
Maybe I'm just not understanding it correctly.
Lossless controller data sending would definitely reduce desyncing, but there are still two factors that will screw it up if there's no resyncing. These are ping and random factors. Ping will always desync the game unless your ping is less than 16.67ms (or 20ms if you're using PAL50). And of course, random factors will still need to be synced.
Synchronization Mode (in which the game is paused until the data arrives, which Fuzziqer is working on) would eliminate ping from desyncing the game, but then there are still random factors. And Synchronization Mode would also slow down the game, which would of course make it less fun.
Forumer™ is Voted #1 Free Forum Hosting provider
Build your own community today with the largest message board hosting company.