arjanfrans / realtime-multiplayer-in-html5

:computer::earth_africa::computer: Realtime multiplayer game in the browser.
MIT License
22 stars 10 forks source link

Add support for NPCs #7

Open jgamedev opened 8 years ago

jgamedev commented 8 years ago

NPCs are super fun!! :laughing: :laughing:

Sorry, I know this doesn't help much. I will update this issue with more useful comments once I understand the codebase better but I wanted to submit this so I can come back to it later.

jptosso commented 8 years ago

For NPCs I would just use the player class and create a bot, instead of receiving inputs by a browser, receive inputs by the server :)

2016-07-03 11:30 GMT-04:00 jgamedev notifications@github.com:

NPCs are super fun!! 😆 😆

Sorry, I know this doesn't help much. I will update this issue with more useful comments once I understand the codebase better but I wanted to submit this so I can come back to it later.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/arjanfrans/realtime-multiplayer-in-html5/issues/7, or mute the thread https://github.com/notifications/unsubscribe/ABLfzj2nimwKaTtyC2BXySEJ8I2wRI0hks5qR9WhgaJpZM4JD4-f .

jgamedev commented 8 years ago

@asdfuken Do you have any examples of this approach being used anywhere?

Well, regular socket communication between both server would definitely add up to the total data exchange payload, unless you use a separate node process for the bot server and communicate via IPC with the game server or some similar type of solution.

However, since bot AI is expensive, offloading it from the game server would definitely be a huge plus.

jptosso commented 8 years ago

I agree with you, I would add a second server and IPC communication as it would rather slow down the server main thread. It could be written in the same server code as a Asynchronous activity or a new server. For communication between processes I would register each NPC with a special UUID as a common player (Browser Like), so you wouldn't have to make hard modifications for the client.

2016-07-03 15:01 GMT-04:00 jgamedev notifications@github.com:

@asdfuken https://github.com/asdfuken Do you have any examples of this approach being used anywhere?

Well, regular socket communication between both server would definitely add up to the total data exchange payload, unless you use a separate node process for the bot server and communicate via IPC with the game server or some similar type of solution.

However, since bot AI is expensive, offloding it from the game server would definitely be a huge plus.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/arjanfrans/realtime-multiplayer-in-html5/issues/7#issuecomment-230169403, or mute the thread https://github.com/notifications/unsubscribe/ABLfzs23mjz8FyLMkoL0kqvsV_GiFYjOks5qSAbygaJpZM4JD4-f .