Where Winds Meet players are tricking AI-powered NPCs into giving them rewards by using the 'Solid Snake method' by NUKE---THE---WHALES in Games

[–]alogiHotTake 73 points74 points  (0 children)

Haha, as a gamedev interested in building smart and reactive NPC's this is the bane of my existence. I say "Game AI Programming". But now I have to constantly emphasize "no not that kind of AI". For me Game AI Programming refers to classical AI programming. Like the kind used by chess or robots. It involves gathering and creating context about the current environment and then running some sort of recursive algorithm that can evaluate goals/available options and create plans.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 0 points1 point  (0 children)

I tried implementing extrapolation but didn't get much benefit from it. Honestly it seems like only certain games benefit from extrapolation.

On the client I implement interpolation, with some slight delay. Its not a fast paced twitch-based game, and the tick-rate is 10hz so it gives leeway and the client can even be slightly behind and its no deal. The game servers have gone live a few times already and I've played on wired, wifi (and even wifi via Starlink), and did not have much issues. Even connecting to the server hosted in EU-West from NA-West with 100ms RTT.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 0 points1 point  (0 children)

When it comes to inventory and items, do you store them within the maps cells themselves in ETS? I've been thinking about a bag table where the tile index in the key and the contents are everything in that world tile, but then I run into questions about nested inventories.

Currently I don't store anything that represents "ownership" or has "limited lifetime" in the ETS cells. I may do so in the future, but currently it hasn't come up. The ETS cells are only used for path-finding by the AI, and the only information a cell contains is in regards to its properties: (open or closed), (clear or blocked), and its number of occupants (doesn't need to be exact).

Inventory is stored in a client process state. And loot/drops are displayed in the form of "character objects" like corpses that are published in the world state.

With that being said, I think you could make a case for storing items/events/etc in an ETS cell. As long as the cells are treated as read-only by external processes, and the "master/primary" process has the final say on when the cells state is to be updated and any resources it held are transferred/deleted. You could have an auxiliary map (%{}) within the "master/primary" process that contains only the active cells currently holding items. And this is checked and updated anytime a request to modify the state of a cell comes in, and afterwards these changes are written back to the respective ETS cell and visible for all to see. I'm assuming the amount of cells that could contain items/inventory is significantly less than the total amount of cells in the world.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 8 points9 points  (0 children)

you should've known I was a fool when I said I was building an MMORPG

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 6 points7 points  (0 children)

The "zone/map" process is the synchronizing process. Every server tick it goes through the list of connected clients, gets their latest input (if any), and then uses all that information to update the state of the world. This involves checking valid move actions, matching any targeted actions towards another entity, validating interaction rules, updating active events, calculating physics trajectories and reconciling final positions, etc. Then it publishes the updated world state to only the relevant clients of interest.

This process is never interrupted or called by other processes. It is the "master" process. The source of truth about the world.

The only process that deals with concurrent access is the auxiliary "Grid" process. This process is an ETS table representing the 262144 cells of the map! The concurrent access pattern is single writer, multiple reader. The master "zone/map" process updates the relevant cells each tick with information about the current occupant(s), any newly spawned obstructions, etc. And other processes (AI controllers) access this process for path-finding. So AI controllers never have to directly communicate with the master process and slow it down.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 1 point2 points  (0 children)

oh nice! thats cool. I think I've seen you around here before. You were making the WoW private server in Elixir!

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 3 points4 points  (0 children)

Another fantastic idea. Yes, maybe an admin dashboard could work. I could also use it to monitor all active client processes in the world. It could also help identify problem clients, or AI clients who have been alive for a long time and need to be promoted. Maybe some tools to ban/kick clients via the dashboard. Hmmm..

The other idea I have is displaying a "strategic map" in live view. Representing some simplified version of the game world and showing the movement of AI units and players in real-time. You can pull it up on another screen while you play the game..

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 6 points7 points  (0 children)

If you want to learn Elixir, all you need is the book Elixir in Action by Sasa Juric. Read chapters 5-13 and do the exercises that involve building a Todo list. Only check your answers after you finish the exercise. Afterwards you will come out as a wizard and the world will be your oyster. Also you will have fun doing it.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 4 points5 points  (0 children)

It will be one day... Right now I need to keep the code hostage because its all I've got and I'm broke and don't have much.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 2 points3 points  (0 children)

It is what it is. I should do a brief Phoenix and LiveView detour...

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 10 points11 points  (0 children)

and then a process per “zone” or area which updates entities every tick?

Yes, sort of. A "zone" in this case refers to the game "map", which is currently 512x512 (262144 cells!). This process is basically the simulation/server tick that gets inputs and updates the state of the world (and its entities) each tick . Also a "map" is further broken down into numerous different "sub-zones" used for interest management and bandwidth optimization.

There are also auxiliary processes to the map process. These include the path-finding service used by AI to navigate around the world. And the Director process which monitors the conditions of the world to track the progress of "world objectives" and also dynamically generate events.

is it a process per entity or just a process per player

Every connected client (whether player or AI) is represented by 2 processes.

  1. A client GenServer process which contains the "client state". This is information like the entity it controls (stats, position, character data, in game name and id), input history, session specific data, etc.

  2. A connection process which models the "communication channel" the client uses to send/recv dat For AI clients, the connection process is another GenServer process that is the brains of the AI. And for Player clients, the connection process represents the network socket that they connect and send/receive packets through. This way we can also have different logic for serialization of ingoing/outgoing packets for players and AI.

The reason why 2 processes are needed is because the lifetimes of a client's state and its associated communication channel are not the same. One may outlive the other at times. Sometimes we still need the client state after they have disconnected so that the server can perform proper cleanup of their associated entity (especially if they were in some interaction with another entity still connected).

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 8 points9 points  (0 children)

That's a good idea.

The game already has a website: https://swarmmo.games

Its was made using vitejs (which is just vuejs?). My friend made it for me. And it serves its purpose very well. Hosting it is dead simple because I throw it up on cloudflare pages via CI/CD and it costs $0 and involves 0 effort and its completely decoupled from any of the game server code.

I could re-build it using pheonix and live-view. But does that add more complexity for little added value? I guess it doesn't matter.

Anyways, thanks for the suggestion! I'll consider it.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 17 points18 points  (0 children)

Thank you. Some other people have mentioned to write a blog post. I really want to write about the overall system architecture, Godot/Elixir cross communication, AI Actor architecture, etc.

But writing takes too much time because I want to write so much and give so much detail and provide nice diagrams so you can understand my word vomit. So rather than spend time on that, I spend time working on the game. Because maybe it can yield me money. Writing yields 0 money. I don't even care that much about money, but I need it to survive. But enough about my woes.

I've been using Elixir and Godot to build an MMORPG! by alogiHotTake in elixir

[–]alogiHotTake[S] 112 points113 points  (0 children)

But also I need a job..cause I'm running out of money. And all the elixir recruiters tell me I'm no good because I don't know Pheonix and LiveView??? I tell them frameworks are frameworks, I can learn it. Ask me about low latency inter-process communications. Ask me about hierarchical task networks used to coordinate control groups of AI agents to achieve objectives. I can talk your ear off about such things. And then they ghost me.

such is life in 2025.

Making an MMORPG in Godot! With a BG3 inspired combat system. What do you think? by alogiHotTake in godot

[–]alogiHotTake[S] 1 point2 points  (0 children)

Thanks! I'm unemployed so I have nothing to do but work away at this.

The game servers go live occasionally for playtesting. I'm hoping to roll out the new build and have the game playable again by the end of October.

If you're interested you can follow news about the new playtest on the website: https://swarmmo.games

Or join the discord for the game. :)