Fishing in MMO

Started by
39 comments, last by hplus0603 15 years, 7 months ago
When I implemented a fishing system in my NWN MMO, I didn't bother with any constant checking. I just scheduled an event for x seconds in the future (up to 30) and then that event fired a script which just checked to see if you caught anything.
Advertisement
But most of all users stand on the ground and click where they like to fish!? And how those zones with fish are stored? How do they change?
VATCHENKO.COM
Anton, this is a very simple thing to implement. You sound like you are a very beginner programmer, and really have no clue here. Just let them click on water, play the animation, and run a script to see what they catch, if anything.

How they are stored depends on how your game is setup. It can be as simple or complex as you want. Are you writing the engine from scratch, do you have a scripting engine, or are you using realmcrafter or something similar?
Yes, it's very simple. To implement a world where everything is divided to zones/tree, every object is quite small comaring with big sea where can be some zones. And the actions are different. 99% of actions are like:
1. Click on the bush, gathering animation, getting fruit.
2. Click on the enemy, fight animation, death.
3. Click on the bot, show the dialog.

I cannot click on the sea - it has thousand different zones that has different actions. I cannot check for intersection on the client with those zones because they are secret (it's a cheat to see where to get fish).

I think it's a real problem, but not for people here that do not make big spaces for large amount of people.
VATCHENKO.COM
Quote:Original post by Anton Vatchenko
1. Click on the bush, gathering animation, getting fruit.
2. Click on the enemy, fight animation, death.
3. Click on the bot, show the dialog.
4. Click on any water polygon while holding a fishing rod, and run fishing script
Fixed.

What does it matter how big the zones are? If they can see water, let them cast off into it.

Water is a big polygon in size of 1000x1000 km in summary. It's not a rectangle and there is more than one "water" (lakes, rivers etc). Yes, client knows where is the water (polygon check), but server must check it. How? And in those 1000x1000 non-rectangle water there are different types of fish, somewhere is empty...
VATCHENKO.COM
Well, the Client can at least render the polygons of the water, so you could check which polygon has been clicked and where. You don't need to know where which type of fish is in to just click on a part of water.

This information gets sent to the server. The server should have a view on the world in this scenario, too, and should not be just a broadcasting machine. This might be helpful for other things in game anyway. The client doesn't do any checking or loot generation in this scenario.

Then fishing starts, every other client in range will be informed, and the server will eventually send the information about the loot to the client.

As already explained, in WoW, you don't click exactly where you want to fish. You run near the water, equip your stuff, and then hit the "spell" to fish. The server there will then choose if you can fish at all and where you exactly fish.
Then you even don't have to the problem to pick a polygon from the water.
Quote:client knows where is the water (polygon check), but server must check it. How?


How does the server know whether the player is drowning or not? How does it know whether the player is in water or not? Use the same mechanism to figure out whether the client can fish at a given point or not.

In general, you just load your terrain database (meshes, material info) on the server, and use sphere, sweep or ray queries to find terrain features in the given range. Examine the materials of the polygons you get, and if there's water there, you can fish.

To store what kind of fish there is in different areas, you can either store it per-material, and use different materials (that may look the same) for the different water areas, or you can store a "catch influence" value at various points in the world. When you fish, whichever "catch influence" point you are closest to will determine what you catch, and perhaps the proximity to the point determines how often/much you catch.

Finding the closest "catch influence" point can either be done by examining a grid for the player's current cell and its neighbors, and selecting one point of of those that are in those cells, or by building a Voronoi diagram of the catch influence points. Easiest way to build the voronoi diagram is to build the Delaunay triangulation dual and then invert it. (And, yes, I expect you will need to google a bit to figure out those algorithms, if you haven't worked with them before).
enum Bool { True, False, FileNotFound };
To joachim_n:
Yes, client sends something like "I clicked on polygon 21, X 23.1, Y 11.2, Z 1.2. How to check if it's in water if my lake has about 80000 polygons if I sum all locations?

To hplus0603:
The server doesn't know about drowning. If I step on the water the server continue to move person (like it walks) but client shows swimming.
VATCHENKO.COM
Quote:Original post by Anton Vatchenko
To joachim_n:
Yes, client sends something like "I clicked on polygon 21, X 23.1, Y 11.2, Z 1.2. How to check if it's in water if my lake has about 80000 polygons if I sum all locations?


Your server will need to now the polygons that make up the landscape (and the water), too, like the client does. It doesn't need to render anything, but it needs to know what polygon 21 actually is. Or enough information to check what is at location X 23.1, Y 11.2, Z 1.2.

Quote:To hplus0603:
The server doesn't know about drowning. If I step on the water the server continue to move person (like it walks) but client shows swimming.


That way I think it won't be possible to dive. Perhaps this is no problem for you, if characters shouldn't be able to dive anyway.

Combined with your problems with fishing, I think the server you think about just doesn't know enough about the world to really handle all this well. You'll want to duplicate some informations that your client seems to have on the server as well.

This topic is closed to new replies.

Advertisement