Advertisement

Sport Team Management

Started by September 10, 2021 09:58 AM
4 comments, last by RuthStewart 3 years, 2 months ago

Hello. Here it goes the information about the project and myself:

- My goal is to program a sport team management game and make it work on the Internet. I don't expect to make money out of it. It is just a hobby. And the goal is to get it running, not it being a specially good game. I have a clear idea of how I want the game to be. I guess I would have to change some things in the process, but the game structure is clear in my mind.

- The only programming language that I know is Java. I am a complete amateur, so the time I can spend in learning new skills is lmited. I want to keep the project as simple as possible.

- I think I am pretty talented for the logic of programming. Some years ago I programmed a chess engine from scratch. It worked in my computer, but I couldn't integrate my code in any kind of server (not tried hard either). My knowledge abour servers and databases is non-existent. I also programmed some small desktop things for my own use in the past.

So my question is if my goal is realistic. And some advice for getting it done and not to get stuck in the process. Thank you very much.

Hello,

I have no idea what you want to code in your game, but Java is generally fine (although it may depend on what you really want to achieve wrt “the internet”). Management games are often more about proper bookkeeping than about tricky logic, so that should be fine too.

You may want to expand on “the internet”, a zillion miles of cables around the globe doesn't say much about how people will play the game. Do they use a browser and visit a (central) web-site, or do they install your code on their desktop computer and play while exchanging messages with each other in some way? Are there parts in the game that should not be handed over to people that want to cheat?

[ Don't know if everything is a valid question, just throwing some things in the air. ]

Advertisement

Ok, thanks. I want to make a “hattrick” type of game. And I want to make it work in a Kongregate type of platform. Or maybe the game can have its own web site, whatever is easier and cheaper. The interface can be very simple, that shouldn't be a problem. Users send instructions beforehand for the games, only bids for buying players are kind of concurrent.

I feel I would be able to program the management game for one user, run in a computer, with the AI managing the other teams. But if I think of many users connecting to a server on the Internet, updating a database … I don't have idea how to do all that and if that is too difficult for an amateur programmer.

So I will insist: I have a general idea of what a server and a database is. But no experience whatsoever in programming for anything beyond my own computer. That should be my bigger problem to get the project done.

A bit of a coincidence, but I had the exact same idea about 3 days ago: a sports management game that preferably runs in a browser to make it as accessible as possible. I looked a bit into what tools there are for such a game and I think the consensus answer is to not use a heavy game engine like Unity or UE with WebGL but to instead use a frontend framework since most of such a game would be played in menus, in which case HTML with CSS beats the GUI frameworks of full-fledged game engines. So if you want to get serious about it I would recommend that you look into Javascript frontend frameworks and see if they allow the type of rendering you want (if you want any).

If you just want it to be offline (but accessible from a browser) you could basically code everything in the frontend and then save data on the local computer (similar to how cookies are saved if I would take a guess but a browser runs in a sandbox so you might have to find a way to sidestep that to be able to save to the file system). If you want players to play against each other you would need a backend and database as you say (in Java or whatever language you prefer). But you could have that as a later iteration of your game and just focus on making a playable offline-in-browser game and worry about backend stuff later.

For online games that aren't real-time/twitch-ey, the best way to build them is to build the game as a state machine of sorts.

You define one or more structures (objects with plain data members, NO MEMBER FUNCTIONS) for the different operations the user can take in the game.

Then, you implement the game as some interface or object or library that “loads game state from storage,” then “performs the operation described in the struct,” then “stores the result in storage” and “return the current state of the game.” (Presumably there's a “no-op” operation that just loads the state and returns its presentation.)

Playing the game will then end up being making a series of these requests, and sending them to the game runner instance. The user interface for the game ends up being rendering the game state from presentation, and helping the user construct the next request.

Once all of this works (it could start on the command line if you want,) it should be pretty easy to expose the “do this struct for game instance X” as a web service that serializes structs to/from JSON. You'd need a little bit of login/authorization, and some session state for which particular game you're current operating on, to be able to support many different players/games, and then the rest of the work is building the web page / app that lets players play the game.

If the game needs to scale, the next step up will be to make the “storage” part of the game runner be cached in memory and asynchronously flush game state back, and use state out of memory where possible (as some kind of cache,) and after that you'll want to figure out how to shard the game runner service across many servers, with game-instance based load steering, but that's all for much later. The good news is that, for turn based games, the solutions typically used by business web applications, will likely work alright for the game, too.

If your game needs direct interaction (like an interactive online game – shooter, MOBA, MMORPG, RTS, etc) then you will need very different tools and a very different setup, so knowing which kind of game you want to build ahead of time is quite helpful!

(I tried to figure out how to tag this post with “Networking and Multiplayer” as well as “For Beginners” but couldn't figure out how to make it be in both categories, but feel free to post networking/multiplayer/online/database related questions over in that forum!)

enum Bool { True, False, FileNotFound };

This topic is closed to new replies.

Advertisement