Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Creating an offline version of Phaserquest #25

Open
phuongdtvd opened this issue Aug 27, 2023 · 13 comments
Open

Creating an offline version of Phaserquest #25

phuongdtvd opened this issue Aug 27, 2023 · 13 comments

Comments

@phuongdtvd
Copy link

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
Copy link
Owner

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

  • Identify what actions are possible and where they are sent to the server
  • Where the commands coming back from the server are processed
  • And basically connect the two, removing the server
    E.g. when clicking somewhere to move, the usual loop is:
  • Client: click detected, send move request to server
  • Server: validate request, send back response to all clients
  • Client: make the character move
    To make it single player, you can just remove the second step, i.e. when a player performs an action, execute the consequence immediately without having it checked by the server :)
    Hope this helps!

@phuongdtvd
Copy link
Author

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
Copy link
Author

@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
Copy link
Owner

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
Copy link
Author

phuongdtvd commented Nov 5, 2023

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
Copy link
Owner

Jerenaux commented Nov 6, 2023

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

@phuongdtvd
Copy link
Author

Thank you! :D

@phuongdtvd
Copy link
Author

phuongdtvd commented Nov 13, 2023

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
Copy link
Owner

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
Copy link
Author

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
Copy link
Author

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
Copy link
Owner

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
Copy link
Author

phuongdtvd commented Nov 18, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants