Npc optimization - #2
Conversation
|
Nice, the code is better and optimised, its works in locally for my part. |
|
Could you test it with a maze like Café? Need to do: If the customer waits longer before sit down in the longest path, something is still wrong. |
Issue 1: Waiter teleport issue (fixed) Caused: Customer time_to_wait sleep for waiting to the waiter, its uses the old waiter.counter_pos, and uses the customers get_time, and the customers are slower. Fixed with: awaiting the serving task for the waiter. Issue 2: If the player clears the counter wheres the waiter is going (after the waiter wants to go to a new counter, because the current counter is empty) they starts serving an empty dish, because no logic implemented to prevent this. This logic was added, and if the serve_food returns true, its means the new counter have food, so they will serve it. If its false, then the customer leaves, because the player clean that counter. We can fix it, but we need to change the logic for the customer, to don't all tasks in one function. Like in the waiters.
|
What was fixed? Issue 1: Issue 2: after.mp4before.mp4 |
|
Here's how the game update the rating with the luxury value: We need to add it too, to get correct values. |
Happens when the player enter edit mode instantly, and leave. The waiters getting teleported to the counter. Not really need to fix it, errors can be happen in the get_shortest_path
This reverts commit af39c34.
|
What was fixed in the latest NPC bug fixes?
Now all NPCs should work. Need more testings:Deliver a food, then wait for the waiter to almost arrive, then clean the counter. Sometimes the waiters instantly deliver the food. Something cause that. If its happens to a lot of players need to look up what causes it. But for now, its okay, until there's no teleport issues. |
|
When the player clicks on a thirsty customer, their money, xp, rating updates instanly in the server side, and removes -1 drink from the machine. The drink id is set to none (-1) in the customer cycle on customer action.fast_food, or when the player enters in the editor mode. When the player enters, it will send the _use_vending_machine function to the player, which visually updates the vending machine amount. After its sending the ASY command to sync the money. We can do it with temp amounts for the vending machine, but these cause sync errors. This is the best solution do it it. Sadly, the xp is not updating. We can add it in the game ASY command to update it too. |
The customers was spawning fast to the new players.
|
Added a new column in the db called daily_login |
|
Found some issues in the LBU and the waiter get_shortest_pos. LBU issue: The waiter issue: |
The waiters pos not set from the objects actual position. It's set by the reachable closest object side. To get the counter obj, just get the waiter.counter, instead of getting the object by the waiter pos
|
Here's a small before / after comparison.
New issue: before.mp4after.mp4 |
The timing is calculated based on the nearest position, not the object's actual position.
In the game, NPCs always choose the shortest path. Therefore, we need to determine the closest position to the counter and identify which side the waiter is positioned on.
Waiters more faster then the player, or the customers, so they arrive faster.
The new time values is:
distance / 1.85(previously1.95)distance / 2.30(previously1.95)Waiters now have
counter_sidepos, and its used to calculate the time.The simple pos is used to get the counter.
Waiters need the priority to send to the client.
[-] Removed getting random avatars in the npcs class.
[+] Added random avatars in the Avatar class.
[+] The customer cycle is now binded to the Café instead of the Player.
[+] Waiter have a priority value between 0 and 100.
- 0 = Clean only
- 50 = Booth
- 100 = Serve only
Customers spawn fixed random time.
Actions
1.0 (10)or go higher than100.0 (1000)).For the jobs, and spawning back the customers, we need to modify the code, but now its works wheel.
Vending machine interaction is not yet added