Deep Sky

A new season, a new project, just likely old times.

So, recently I had this itch of writing some Haskell after a long break and I wanted to to do something more complex than before. So I cooked up a simple idea: 4X, browser based, MMO that is played in turns that take at least a day to complete. I’m not expecting to finish this ever, but use it to learn a bit of coding.

The basic premise is simple. Player is given control of an empire and their task is to guide it to stars. This involves researching new things, building bases and setting up colonies, doing some diplomacy and some fighting.

After some research, I settled for Yesod as a web framework that I was going to use. It looked mature, had features that I needed and didn’t look too scary. And the official documentation strongly suggested on using Stack, which I think is a good idea.

Screenshot from 2018-08-11 19-14-33

View of Earth

Yesod uses Persistent for accessing database. It has some nice features and some not so nice (Joins for example, require crafting SQL by hand, instead of using the fancier function based interface). Developer describes entities that are supposed to be stored in database and Persistent takes care of creating respective tables, keys and constraints automatically. It also creates data structures that are used to manipulate the data in the program.

Speaking of database and storing data. Since the game is supposed to be multiplayer and exploration is part of the game, I had to have a system where each player can have their own view to the world, showing only what they have actually discovered (correctly or incorrectly). And on top of that I need to store the actual situation that is used for running the simulation. For example, for planets, there is table planet and planet_report. Former is used to store real situation and latter reports that players might have received regarding to planets. This allows players to accumulate data over time and system automatically collates it to show what they know so far (if you look at the screen shot above, some tables have date column. This column tells when the data was updated.)

System is in very early stages and I’m still trying to find what kind of structure I should have. Yesod’s scaffolded site helps a ton in getting started. It’s easier to edit something than to write something from scratch. I hope I’ll manage to write at least a simple system where one can build a spaceship and fly it to another star system.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s