The PokéCommunity Forums

The PokéCommunity Forums (https://www.pokecommunity.com/index.php)
-   Binary Hack Research & Development (https://www.pokecommunity.com/forumdisplay.php?f=195)
-   -   Research Revisiting Multiplayer Capabilities (https://www.pokecommunity.com/showthread.php?t=335817)

U.Flame September 16th, 2014 1:57 PM

Revisiting Multiplayer Capabilities
 
Anyone remember the multiplayer project I mentioned a while back? The one where I plan to expand 3rd gen's multiplayer capibilities and make s fun plaza?...anyone?...yeah whatever. So! Last time I posted my findings based on memory alone, now I have fresh results! Since I'm finally able to hack again, and getting the hang of scripting, I'm able to start the project anew! I'm going to be tested many functions in multiplayer mode to see what works and what doesn't. Anyone interested in experimenting or suggestions go ahead and post here. Here's what I've tested so far:

Oh, one more thing. I'm going to mention desyncing often. I'm not talking about link errors, desyncing means both screens show different things, usually different player movement. It's commonly caused by an external event either pausing or moving one player while the other screen doesn't show it.

HMs: nonfunctional. Details:
Spoiler:
Cut will glitch nearby sprites and cause desyncing. Even after cutting a tree, an invisible obstacle remains.
Fly won't work no matter what kind of map.
Strength claims to work, but boulders still can't be pushed.
Rock Smash has similar problems as Cut, but the player becomes stuck.
Flash won't work no matter what cave settings.
Surf, Waterfall, and Dive are all nonfunctional, even manulally due to water problems as described below.


Water: nonfunctional. Players will walk on water and even waterfalls without the push effect.

Battles: semifunctional. Details here:
Spoiler:
Wild Pokemon can't be encountered normally. Scripted wild battles and trainer battles function, but will cause desyncing when it ends. Trainers with more than one Pokemon cause link errors when switching. Player battles can't be started, instead a wild ??????????s appear.


Trade: semifunctional. NPC trading works fine, player trading does not start.

Berries: functional. They will show up differently on each screen if one person picked and another didn't, but it isn't a major desync issue.

Secret Bases: nonfunctional. Can't be entered.

Warps: nonfunctional, not even map connections. Scripted warps work but it may cut off connection.

Signpost events: nonfunctional. Their offsets can be applied to person events however.

Person events: semifunctional. The person events themselves are capable of working, but like scripting, there may be some events that can't function. Random movement can cause desyncing, so it's best they stay still.

Scripting: semifunctional. Script events can work, but there are many limitations. This needs further experimentation. Details here:
Spoiler:
Movement can cause desyncing, genderchecks work, some normally unfunctional things like warps and wild battles can occur. Giving Pokemon and items work. Flags are functional. Some scripts may have problems.


Shopping: functional. Shopkeepers may randomly look up, and when browsing, every person looks down, but it works .

Weather: functional. Simple enough.

Day Care: functional. No problems as far as I can see

Key items: nonfunctional. None can be activated. Maybe some can be forced through scripts or something. Meanwhile, no bikes. :(

Finding items: semifunctional. Visible Pokeball items can be picked up, but won't go away.

Contests: semifunctional. Like berry blending, precise simultaneous activation is needed. Afterwards, the connection may be cut.

Slots and Roulette: functional. No errors here. Their offsets simply have to be applied to person events.

So there's still so much more to test, especially since scripts work. I'll update when I have more results. Keep in mind there may be multiple ways to approach things, especially with scripts, so don't think anything I couldn't get to work is hopeless yet.

Red John September 17th, 2014 2:14 AM

I myself did some research and found that scripted wild pokemon battles are also semifunctional.

Touched September 17th, 2014 3:39 AM

You would need to hook into many different functions in order to implement these features - not a simple task (also very time consuming). Additionally, it's difficult to debug linking stuff as pausing execution during linking would probably crash or cause the linking to fail in any emulator.

It probably would help if you could fix any of those features that you say are broken or only semi-functional. That way we'd know how feasible this is to do on a large scale.

U.Flame September 17th, 2014 8:50 AM

That's why I wanted to create a team. When that didn't happen, I scaled down my goal and expectations. The purpose of these experiments is to take what's usable and make multiplayer fun. Even as it is right now it's already better than the default tiny rooms.

Nex September 17th, 2014 11:13 AM

Intresting research I must say I wanted to make something like this months ago xD whatever good luck!

U.Flame September 17th, 2014 12:47 PM

Quote:

Originally Posted by Nex (Post 8440288)
Intresting research I must say I wanted to make something like this months ago xD whatever good luck!

Thanks! If you have any ideas on anything in Ruby/Sapphire that you want tested in multiplayer, let me know. I need to try everything possible.

Quote:

Originally Posted by Knight of Duty (Post 8439847)
I myself did some research and found that scripted wild pokemon battles are also semifunctional.

Right, the main problem is the desyncing afterwards. The only solution I can think of st the moment is to make every other player freeze while someone battles or participates in any kind of potential desync activity.

Red John September 17th, 2014 4:59 PM

Is there any certain flag which is set when we enter the room which will prevent items use?

U.Flame September 17th, 2014 5:04 PM

Quote:

Originally Posted by Knight of Duty (Post 8440595)
Is there any certain flag which is set when we enter the room which will prevent items use?

Good idea. Maybe the script can be dissected and touched up. I'm not able to do so yet, but maybe in the future. Or hopefully a real scripter can look into it. I've wondered the same thing with player battling and trading.

Red John September 17th, 2014 5:32 PM

Do flag scripts work? Like setflag? And if does then does it work for both players?

U.Flame September 17th, 2014 6:19 PM

Quote:

Originally Posted by Knight of Duty (Post 8440624)
Do flag scripts work? Like setflag? And if does then does it work for both players?

Just tested it. Flags are indeed functional. They work individually for each player.

Red John September 17th, 2014 6:26 PM

Meaning that even though they are connected, events will be individual? And also day care would be individual, would they not?

U.Flame September 17th, 2014 6:50 PM

Quote:

Originally Posted by Knight of Duty (Post 8440687)
Meaning that even though they are connected, events will be individual? And also day care would be individual, would they not?

Eeyup! The Day Care is functional and individual.

Red John September 17th, 2014 9:32 PM

Aww i thought the players would be able to breed together :3 If we could create any function that would make the events happen together, but i think we would need ASM for that

Touched September 18th, 2014 1:15 AM

Is this research for Ruby? Most of the research done is for FireRed, with porting to Emerald only. Ruby's engine is a mess, thus many avoid it. If you wish for help with ASM, you should at least do this on Emerald.

Also, Game Freak didn't sync everything. Faceplayer and stuff didn't synchronise completely. Again, for this to work, you'd have to hook into a variety of functions.

You should document how you got linking working: What emulator you used and version, etc. I am unable to get wireless adapter functionality working, but cable trade/battle works perfectly.

U.Flame September 18th, 2014 10:31 AM

Quote:

Originally Posted by Touched (Post 8440951)
Is this research for Ruby? Most of the research done is for FireRed, with porting to Emerald only. Ruby's engine is a mess, thus many avoid it. If you wish for help with ASM, you should at least do this on Emerald.

Also, Game Freak didn't sync everything. Faceplayer and stuff didn't synchronise completely. Again, for this to work, you'd have to hook into a variety of functions.

You should document how you got linking working: What emulator you used and version, etc. I am unable to get wireless adapter functionality working, but cable trade/battle works perfectly.

Good point. When I first started this many years ago, most hackers used Ruby while Emerald was barely touched. So I just kinda stuck with it. I guess I should shift my priorities now that Emerald is better. Still, I plan to experiment with every 3rd gen game some time.

At the moment, I'm using VBA Link. I don't remember the version, I just googled it.

Shiny Quagsire September 18th, 2014 5:03 PM

Quote:

Originally Posted by U.Flame (Post 8441314)
Good point. When I first started this many years ago, most hackers used Ruby while Emerald was barely touched. So I just kinda stuck with it. I guess I should shift my priorities now that Emerald is better. Still, I plan to experiment with every 3rd gen game some time.

At the moment, I'm using VBA Link. I don't remember the version, I just googled it.

It might also be worthwhile to test the differences between versions. Fire Red and Emerald might be more complete or even less complete due to the changes made for wireless adapters (ie multiple people in one room, up to 32 iirc). I'm definitely interested though, because this could be very interesting to do. However, I wonder what the best solutions would be for something like events (ie old man event). Modifications might have to be made in order to properly present things. Perhaps a sort of setting so that the game can be told not to send certain NPCs over wireless? That way you could have the old man be client side so the most that could happen would be people walking past the old man. Definitely on board with this idea though, it could be very interesting to try. I'd also like to try it on actual hardware as well, since I have access to a flash cartridge (although I'd need another one to be the second client, so that might be a problem).

Deokishisu September 18th, 2014 5:27 PM

Quote:

Originally Posted by Shiny Quagsire (Post 8441669)
It might also be worthwhile to test the differences between versions. Fire Red and Emerald might be more complete or even less complete due to the changes made for wireless adapters (ie multiple people in one room, up to 32 iirc). I'm definitely interested though, because this could be very interesting to do. However, I wonder what the best solutions would be for something like events (ie old man event). Modifications might have to be made in order to properly present things. Perhaps a sort of setting so that the game can be told not to send certain NPCs over wireless? That way you could have the old man be client side so the most that could happen would be people walking past the old man. Definitely on board with this idea though, it could be very interesting to try. I'd also like to try it on actual hardware as well, since I have access to a flash cartridge (although I'd need another one to be the second client, so that might be a problem).

So person events, script tiles, all of that would be handled client-side, basically making it so that you're playing single player but your friend might walk by occasionally? I think that that is the best solution, honestly. Focusing on getting that to work without desynching should be the goal, and then additional interaction players can do with each other should be next on the list. I think the first order of business is to not forcestop the game with an error screen when a disconnect happens, as players could lose significant progress if they haven't saved in a while. That's why the link rooms force you to save beforehand.

EDIT: Also, the "32 people in a room" thing isn't actually people walking around. Those are just basically NPCs the player uses as an interface to "page" the player of the other game to ask them to do something. There's no interaction in the Union Room itself, just jumps to the trade and battle screens in the other rooms. It's essentially the lite version of linking.

U.Flame September 18th, 2014 5:57 PM

Quote:

Originally Posted by Shiny Quagsire (Post 8441669)
It might also be worthwhile to test the differences between versions. Fire Red and Emerald might be more complete or even less complete due to the changes made for wireless adapters (ie multiple people in one room, up to 32 iirc). I'm definitely interested though, because this could be very interesting to do. However, I wonder what the best solutions would be for something like events (ie old man event). Modifications might have to be made in order to properly present things. Perhaps a sort of setting so that the game can be told not to send certain NPCs over wireless? That way you could have the old man be client side so the most that could happen would be people walking past the old man. Definitely on board with this idea though, it could be very interesting to try. I'd also like to try it on actual hardware as well, since I have access to a flash cartridge (although I'd need another one to be the second client, so that might be a problem).

I'm honored in your interest. Seriously there were no posts the last three attempts. Yea, I'm going to cover every version once I define a suitable list of things to test on each one. Currently I'm using the Mixing Records chamber to connect to multiplayer. If there's ever a way to create what's essentially a co-op mode, I'd have reached my unrealistic dream for the project. Since warps and map connections normally won't work, I scaled down those hopes. But if advanced and experienced people working on it, maybe it isn't so unrealistic.

Touched September 19th, 2014 6:10 AM

I too am interested in this, so here are a couple of suggestions: You should specify exactly what you mean by functional, sem-functional, and non-functional. Do map connections cut off connections, or can you simply not move into the adjacent map? When linking, it appears that the tradional map loadering hook is replaced with another one, tailored for that map of connection. This could be a reason why these connections do not work.

However, due to the fact that there are no working emulators with a linker/debugger combo, we can't do much besides static analysis in IDA. So, our first port of call should be to write an emulator that can do such a thing. Additionally, I spied some assertions and debug logging features that were disabled (the logging function's internals were commented out). We could definitely hook into these with some asmagix.

My second suggestion is that you should dissect the scripts that are responsible for linking. Try to see what specials are used, what specials are essential for linking to work, etc. I suspect that many of the pre-linking checks are in those scripts, and can be removed. It would also be helpful if you posted a patch of your work so that others can test without having to repeat the set up of all of this.

The "NPC state" of the player is clearly copied between games, and I'm wondering how feasible it would be to copy the 15 others across, which would allow syncing over other NPCs. This would be important for NPCs who move around, so that they don't overlap with players etc. If we could find an unused bit in this state, we could also create a thing which says "This person is busy" if another player is talking to them.

If we extend the emulator, we unlock a whole set of potential features. We could do Nintendo Style mystery gift events for certain hacks, etc. So I think this is the most important step. VBA link/VBA-M runs off out-dated networking code, and is in dire need of an update.

U.Flame September 19th, 2014 9:50 AM

1 Attachment(s)
Alrighty. Here's what I have so far. As I said, I replaced the Mixing Records room with the plaza. It contains a nurse with the script of the old woman that gives you a rest for healing purposes, a shop, gambling games at the base of the fountains, coin exchange and prize people, the day care couple, the berry master, four berry/soil patches, a berry mixer with the sprite of a lump of soil, the contest woman, and a Latias/Latios encounter based on player gender. I believe I also placed a warp in Littleroot that goes to Mauville as a shortcut. There may also be a couple of NPCs or hidden items I placed around Littleroot or Mauville for testing outside of multiplayer that I haven't removed yet.

To clarify, map connections are cut off in multiplayer, it acts like there aren't any to begin with. I'll get to dissecting the entrance scripts later, last time I attempted something like that ended in disaster. But it's on my to-do list.

Currently. I'm switching to Emerald, so I'll re-test most of the basic stuff and post my findings soon.

Itachi September 25th, 2014 12:25 PM

This is a very cool idea, I hope this project dont die!

U.Flame September 25th, 2014 4:32 PM

Sorry about the lack of progress. A friend lent me Kingdom Hearts 2 so uh, yeah place the blame wherever. Anyways besides the distraction from a damn good game, I have just experienced a bit of a setback. I was copying everything I did to Ruby unto Emerald, and just found out my Emerald ROM is broken. It shouldn't take too long to redo what I did, I just need to get a new ROM. Once I'm finished with KH2 distractions, I'll probably resume random experiments in Ruby in the meantime.

And don't worry, even if I recieve no support, come across an obstacle, or lack any certain goal, I won't give up on this. Especially now that it finally has attention. Even back when it didn't and I left it alone for a long time, I still had plans to revive it eventually. It's one of the things I pursue because I'm personally interested.

Red John November 17th, 2014 4:53 AM

So this thread is finally dead? I wanted to see this project come out as a succes, but i guess i was hoping too much *sigh* this thread needs to be closed i guess

U.Flame November 24th, 2014 7:24 PM

Like I said, life may get in the way, but that doesn't mean the project itself will ever die. I'll personally to see it's completion, even if it does take an unreasonable amount of time. So! With that in mind I've got news! I got nothing done these past months! But wait, there's more! Now I can! Turns out my Emerald problem had to do with my emulator settings. I believe it should work without a problem now. I can dust off my files and skills and start porting my Ruby experiments to Emerald now. I won't promise immediate results, but know that it's active again.

Baby steps progress so far. I replicated the map, no problems there. The gambling games, the shop, and healing all works just like Ruby. NPCs work the same too, they often face a random direction when spoken to. So far, no difference. Gonna continue the same experiments as Ruby for now, but I don't expect much difference.

U.Flame November 26th, 2014 9:58 AM

Quote:

Originally Posted by pokemontutorialTV (Post 8509707)
So, i have to say, you can fix the "random facing" by doing a async-connectionmode. Its is pretty simple, if you call special 0x127, the player2 who talks with player1 get the message, that "the player is too busy to talk to". Otherwise link-connection will be lost. Special 0x128 clears the blockade and you can talk to the other player again. Just an example from German-rom:

#org 0x1BF200
textcolor 0x3
special 0x127
msgbox 0x81C01C9 MSG_KEEPOPEN '"Bitte geh in Position und beginne\..."
special 0x128
closeonkeypress
end


'---------
' Strings
'---------
#org 0x1C01C9
= Bitte geh in Position und beginne\nmit dem Tausch.

I Hope i could help.^^

Those specials work for Emerald? Where must I apply them? The NPCs or the Pokemon Center multiplayer-handling lady? I placed them to a shopkeeper's script but it had no effect. The Pokemon Center lady's script is huge, I may need some help with where to place the specials there, if that's where they go in the first place.


All times are GMT -8. The time now is 8:50 AM.


Like our Facebook Page Follow us on Twitter © 2002 - 2018 The PokéCommunity™, pokecommunity.com.
Pokémon characters and images belong to The Pokémon Company International and Nintendo. This website is in no way affiliated with or endorsed by Nintendo, Creatures, GAMEFREAK, The Pokémon Company or The Pokémon Company International. We just love Pokémon.
All forum styles, their images (unless noted otherwise) and site designs are © 2002 - 2016 The PokéCommunity / PokéCommunity.com.
PokéCommunity™ is a trademark of The PokéCommunity. All rights reserved. Sponsor advertisements do not imply our endorsement of that product or service. User generated content remains the property of its creator.

Acknowledgements
Use of PokéCommunity Assets
vB Optimise by DragonByte Technologies Ltd © 2023.