I want to program a simple valheim NPC client (a bot)

fictional character

Hi, I've been playing a lot of valheim lately. And what I've been doing is go to a virgin Island and build houses, roads, ports, store houses, cultivation etc.. basically I'm making whole villages.

But my villages are empty !

So here is my proposal.

I'm an ok VB.net programmer (please don't throw eggs yet) and I want to build a npc from scratch.

First version would be like this, using wireshark, sniff client-server valheim network traffic. Figure out the initial handshake and the downloading of the map.

The NPC logic would be as follows.

Teleport to preset coordinates in in file.

Find nearest unclaimed bed and claim it.

Check time of day

If before sleep time, walk to preset coordinates (preconfigured "geofenced" work area).

When inside the zone. Search map for nearest tree in the zone (this is a lumberjack bot for now)

Hit tree with axe until server says tree is broken.

Walk to pickup able object inside work zone.

If inventory full, search work zone for non full chest. Dump wood in chest.

If axe breaks, search map for nearest workbench and repair.

If enemy nearby, run away in any non water direction.

In case of any error, go to bed(teleport if necessary) and try to sleep every 60 seconds.

When time of day greater than sleep time, go to bed and sleep.


If I can get that far, I can make NPCs that can do anything, including harvesting simple quest giving and enemy NPCs.

Has anyone tried this before is there any documentation of the network protocol this game uses ? Thanks !

Source: https://www.reddit.com/r/valheim/comments/n51jkn/i_want_to_program_a_simple_valheim_npc_client_a/

leave a comment

Your email address will not be published. Required fields are marked *