Sign in to follow this  
Anton Vatchenko

Fishing in MMO

Recommended Posts

How to implement fishing in games where fishing is not a main goal, and just a thing to make money/food. I know that there must be some types of rod, fish and other objects, but fishing doesn't look like other processes where you click on the object and it runs some script. Water is very big and meybe have different fishes in different places. Maybe somewhere there's no fish. How to implement fishing?

Share this post


Link to post
Share on other sites
Daaark    3553
It's usually just all a simple animation with a script that gives you a random prize various of fish, or maybe an old boot.

Have the player with an equipped fishing rod click on some water polygons, then play the relevant casting off animation, and have them wait with the rod. The player can click away to get up and leave (and resume normal play) or wait a bit and see if something bites.

If something bites, then you just award a random prize of whatever fish live in that area.

Just store a list somewhere in each area of what fish live there. Just like you have a list of what monsters roam that area, and possibly what loot is available.

Share this post


Link to post
Share on other sites
I'm talking about online game, so client can show any animation - it's not a problem! And if the player uses silver rod (for example) - server must check it! And if I use big bait I can get one type of fish, another bait - another fish.

And if I go fishing - everybody must see it, so server must check where I click to make hack less (if I will stand on the road and get a fish near some cars for example).

Talking about monsters. They are the objects. With a position. If position is near to me they kill me. But fish is not such object - I can't see it, because if I could I had to hack.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by Anton Vatchenko
I'm talking about online game, so client can show any animation - it's not a problem! And if the player uses silver rod (for example) - server must check it! And if I use big bait I can get one type of fish, another bait - another fish.

And if I go fishing - everybody must see it, so server must check where I click to make hack less (if I will stand on the road and get a fish near some cars for example).

Talking about monsters. They are the objects. With a position. If position is near to me they kill me. But fish is not such object - I can't see it, because if I could I had to hack.
The server must check everything anyway, the client must always ask tom do something, then the server acknowledges it. The moment you let the client tell the server it's doing something instead of asking, you open your game up to hacking.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by Anton Vatchenko
He doesn't answer. 90% is about client. About "Just store a list somewhere in each area of what fish live there" - is just a continuation of my question.
When the client sends the "I'm starting fishing" action to the server, the server takes that clients position and compares it to the list of known fishing regions (I.e. locations of ponds, sea, etc) and then periodically (Time based on amount of fish in the area, client's skill level and rod type, etc) the server sends a message to the client saying "Caught fish type X".

Share this post


Link to post
Share on other sites
Daaark    3553
Quote:
Original post by Evil Steve
Quote:
Original post by Anton Vatchenko
So how to solve my problem?
Daaark's reply answers your question. What problem is outstanding?
Yep. I can't go into any further detail, because the finer points of this are specific to your game engine, and the database.

Share this post


Link to post
Share on other sites
Antheus    2409
Like WoW?

- Player issues "Start Fishing" action.
- Server creates bobber in random, nearby location. Bobber is a "mob", spawned based on location where it was created
- On every tick, server checks if fish has bitten
- If it has, notify the user
- When user issues "reel in" action, the bobber "dies", and its loot table is checked
- If user doesn't respond fast enough, bobber despawns.

Voila.

Share this post


Link to post
Share on other sites
Daaark    3553
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.

Share this post


Link to post
Share on other sites
Daaark    3553
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Daaark    3553
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.

Share this post


Link to post
Share on other sites
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...

Share this post


Link to post
Share on other sites
joachim_n    138
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.

Share this post


Link to post
Share on other sites
hplus0603    11356
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).

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
joachim_n    138
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.

Share this post


Link to post
Share on other sites
joachim_n    138
To me this is the underlying problem. With a server that only knows this, I actually can't come up with a good concept that doesn't use too much information on the client side either.

Perhaps you don't need every polygon detail on the server. If your world is flat, it might be sufficient to have 2D map what is at which place in the world.

Share this post


Link to post
Share on other sites
Evil Steve    2017
Quote:
Original post by Anton Vatchenko
I don't use polygons on server. The world is flat for it. It's client knows that here's the rock, here's a down street. Yes, server checks some obstacles, but doesn't make a pollygon check.
The server can't tell the client something it doesn't know. That means you can't check where the client is fishing, server side. That means you'll have to change this so the server knows, or give control to the client (Which could cause exploits).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this