Jerenaux / phaserquest

Reproduction of Mozilla's BrowserQuest using Phaser, socket.io and Node.js
http://www.dynetisgames.com/2017/03/18/phaser-quest/
MIT License
371 stars 127 forks source link

Creating an offline version of Phaserquest #25

Open phuongdtvd opened 10 months ago

phuongdtvd commented 10 months ago

Hi there, I would first like to apologize since this is not exactly an issue. But I really want to create an offline version of Phaserquest with some scope update to make the game smaller as I would just like an RPG game that takes around 1-2 hours to finish to teach my brother some concepts through gamification. I was just wondering how feasible would it be to do this? I would like to add some new npcs with the sprites from BQ and also a quest system as well. Thank you!

Jerenaux commented 10 months ago

Hi, I think it shouldn't be too difficult to do, it would mostly boil down to

phuongdtvd commented 10 months ago

Oh wow, I didn't expect you to respond at all, let alone so quickly, thank you so much honestly! That definitely helps a lot as it gives me a high-level plan of what I need to do. I think the biggest problem would be that the game was written in Phaser 2 and most current documentation and tutorials seem to be for Phaser 3 instead. At this point migrating to Phaser 3 would be a complete rewrite of the game, but I suppose that's something for me to figure out! I mostly want the Quest Manager plugin from Phaser 3 but I suppose I can write my own barebone version of it for Phaser 2. Thank you so much again @Jerenaux !

phuongdtvd commented 8 months ago

@Jerenaux Hi, sorry for pinging you all of a sudden, I was wondering if you could help me a bit with this problem. Basically, I'm trying to make the map smaller, and to do that I want to move some of the teleport points or "doors" around. For example, I just copied and pasted the teleport of the boss room to another cave entrance. However when I try to do this, the player will be stuck after being teleported, when clicking around, the move animation will still play however the player can't move around at all. I assume this has something to do with the placement of the teleport tile itself because even when I try to move the original teleport tile of the cave back, the player still gets stuck after being teleported.

Jerenaux commented 8 months ago

Hi, unfortunately I don't see from the top of my head what could be the issue, this would need thorough debugging (starting by reverting the commit that broke it to be back to a working state, then trying again in small steps). Unfortunately I haven't touched this code in years and don't have the bandwidth to dive into it so on this one I don't think I'll be able to help :(

phuongdtvd commented 8 months ago

Sorry I completely missed your reply since GitHub notification refused to work for some reasons. That's no problem at all, thank you so much for replying! :) Can I ask you another question if possible? This one is quite simple and hopefully doesn't require any dive at all into the codebase. So basically I want the game to be gated by progress a bit so I'm placing the guards NPC in front of all the entrance point to the forest from the beginner town. However, I need them to disappear after a certain condition is fulfilled. I'm planning to do this by adding an object layer in Tiled with these guards and each will have a custom property, so I will just need to check if the guard NPC has a certain property within the code and "kill" the NPC with Phaser when the condition is met. Do you think this would work?

Jerenaux commented 8 months ago

Yes I think it'll work and it's probably the cleanest way to do so too! :)

phuongdtvd commented 8 months ago

Thank you! :D

phuongdtvd commented 7 months ago

Hi, sorry it's me again, so it's still the issue with the teleport, it seems like the x and y coordinate of the teleport needs to be exactly the same as the old existing ones or else the server with have this error which causes everything to freeze. So for example the first picture will make the teleport work, but the second will cause it to break. Sorry for bothering you so much again :( I just wonder if something pops into your mind of what might have went wrong when you look at this problem. Maybe I have a big misunderstanding of how teleports are handled in game which causes this. It just seems like the Client is already at the new coordinate but the server is still at the coordinate before moving to the teleport but I'm not sure why it only happens if you change the coordinate of the teleport within Tiled.

image image image

Jerenaux commented 7 months ago

I find it very strange but I don't remember it well enough to be able to provide much help! What I can advise (in general when dealing with a large codebase) is to try to trace down the entire series of function calls that happen, in this case when a teleport is used, and to use a debugger to track down the different variables. If you can clearly identify which series of functions is called when a teleport is used, you should be able to spot what goes wrong :)

phuongdtvd commented 7 months ago

Thank you for the advice :D. I managed to figure out that the x and y coordinate of the teleport must be a multiple of 32(the tile size) for it to work. I'm not sure why this is the case but it seems to work for me after I did that.

phuongdtvd commented 7 months ago

Hello... It's me again... Really sorry for bothering you yet again 🙃 So I'm trying to create a quest "system" but am currently stuck on how to give players equipment, because right now the only way to do that is by the player moving into a Tile with equipment. I thought this would be very easy but apparently it's a lot harder than I expected since equipping on the client will be overridden by the server immediately when the next package comes or when refreshing the page. But trying to change this serverside by sending requests to fake stepping on an equipment to the server is also unexpectedly difficult. Maybe I'm missing something really obvious, I would really appreciate it if you could help me with this a bit. If it takes too much deep dive into the code you can just ignore this since I really don't want to bother you too much.

Jerenaux commented 7 months ago

As I was mentioning in the beginning, the first thing you should do is remove any interactions with the server. Don't send anything to it and just trigger the logic that you want instead. Once you do that then you won't have issue like this one

phuongdtvd commented 7 months ago

Sorry, I think I forgot to mention this one important thing that I decided I still want to keep the multiplayer function 🙃I really should have mentioned that before.

On Sat, Nov 18, 2023 at 20:36 Jerome Renaux @.***> wrote:

As I was mentioning in the beginning, the first thing you should do is remove any interactions with the server. Don't send anything to it and just trigger the logic that you want instead. Once you do that then you won't have issue like this one

— Reply to this email directly, view it on GitHub https://github.com/Jerenaux/phaserquest/issues/25#issuecomment-1817484793, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQIO4MGIR4QZ3LBET32LULLYFCMVDAVCNFSM6AAAAAA4APKPVKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQMJXGQ4DINZZGM . You are receiving this because you authored the thread.Message ID: @.***>