Devlog #3 - Making Money
I've added a shop keeper in the shop. His name is John, he runs John's Goods. What a coincidence.
This was difficult because of the way the map loads buildings in. I used to spawn the shop keeper inside the building, but this caused problems. Every object that is on a tile in the game is put into an object pool when the chunk gets move. This means if the game is going to work with multiplayer, if the shop keeper was inside the shop he would despawn when either player moved too far away from the shop. This also allows other NPCs to enter and exit the shop which I hope will work soon.
What I ended up doing is that when a shop appears on one of the players map, the server is requested to see if the shop floor exists and if it hasn't, it spawns a separate floor object and the shop keeper.
John will buy pretty much anything. Some of the best things to sell to him are fish and bugs.
So far the fish and bugs spawn depending on the type of bio they spawn in. So there are fresh water and salt water fish. There are desert bugs, tropical bugs and water side bugs. There are 3 types of bugs in these categories too. Flying bugs, like butterflies and dragonflies, crawling bugs like beetles and spiders, and jumping bugs like grasshoppers. I have plans to change the types depending on the time of the day. (Fireflies at night would be cool).
I'm working on seeds that can be grown and sold back to John, so I hope to have that working soon.