I’m making a game with catalog and what will be a fairly-involved search algorithm to navigate that catalog.
I want searching the catalog to be as smooth as possible, but I’m worried about exposing too much of my code if I run the search client-side. On the other hand, I want the game to have large servers, and I’m worried about the network traffic of up to, say, fifty people all running searches with potentially hundreds of results at a time.
My question lies in what approach everyone thinks could be better. Are the risks insignificant enough to warrant running the code client-side to improve user experience, or should I run that code on the server? If I am running it on the server, what could be good ways of reducing network traffic? In my mind, one initial solution could be to cache search results on the server and only sends portions of the results to requesting players at a time (and then also caching those results on the client for some amount of time), but I’m still worried about network traffic and the impact that could have on users with bad connections.
That’s not OOP (unless you weren’t trying to show OOP with that code), and I feel like OOP would be overengineering for a catalog searcher. It’s really a matter of traversing a few lists based on queries and other search options if applicable, then displaying those to the client.
The question falls on whether the client should ask the server for results based on the query or if the server should send the catalog to the client so that the client can search faster, that much is there.
After talking with my design partner, we have decided that client-side search is not an option: our game is not a woefully unique concept. Beyond larger servers, we aren’t doing much that competitors haven’t already done; our engine and especially our meta-data is the main value that we are adding to the genre. Running the search on the client would require exposing all of our meta-data to the client, and that asset is to valuable to lose.
That turns the focus then to optimizing network usage for a larger-than-average load of players. I’m still partial to caching results and sending them chunk-by-chunk to players as needed, but I’d be happy to learn of a better way; especially, for instance, sending the data as object references versus as information that the clients may use to construct their own references.