All news concerning the development of METRO.
Soooo, the refactoring on the UI system is done now. Unfortunately I had not that much time I wish I’d have had, but studying and working takes a lot of time.
Currently I’m working on the architecture of the code. In the most recent commits, I separated UI-code from the logic and created a dependency injection class (called Locator). The locator will create things like services and tools and helps to implement new features even faster. It already helped to find bugs and unwanted behavior and solved a problem I hab a long time with the toolbar and its buttons.
The next step is to finish this separation of the UI-code and the logic, switch all services and tools to the locator and may restructure the services (there’re many hacks in them). This would also be the next version (0.1.4). After that, I’ll focus on new features and improve things like the drawing algorithm.
This evil word … refactoring. People wan’t to see progress and not some nice and clean code, but those two things are very strongly connected: There’ll be less progress when the code is obfuscated, complicated and hacky. Unfortunately clean code becomes hacky and unnecessary complicated all by itself 🙁 … no really, sometimes it just feels like good code is changing itself into bad code …
Nearly one month ago (27th of may) I started a huge refactoring of the whole UI system I wrote in the early days of METRO. Unfortunately it was not build to handle a great amount of UI elements in a smart way. I’m currently changing everything in this package and make things less bad. This also includes the way you interact with UI elements which is sometimes a bit … tricky and buggy.
tl;dr – Rewriting the UI system. Will take some time.
The old system was build around a class called ControlActionManager. This class holds all controls (buttons, input fields, labels, …) and manages interactions like clicks and key presses. It also drawed all controls.
The problem was that there were windows which controls are always above others, which should not get interaction events.
After some weeks I finished my work on the first attempt of a new drawing routine. The old one was not working at all (s. da8b728) or the result was very ugly. The new algorithm (s. 774a339) is a bit better but not perfect yet.
Due to the general held algorithm, some lines are a bit to far away from their node so that a train (which is driving on the track beneath the line) is not on the line anymore. I’ll fix these issues or let them be and change the way trains are driving … I don’t know but there’ll be a fancy solution 😉
Many things needs to be implemented until the METRO v.0.1.4 release, but I think that I can meet the deadline (31.5.2016) 🙂
In the commit d370875… I finally implemented the passenger routines. The amount of waiting passenger in a station will be reduces when a train waits there. It also increases by time considering the city circle the station is in.
The train itself does not know any passenger (has no cardinality) yet. Passenger also have not any destination, they are just entering the train with unlimited capacity 😉
I also re-arranged the UI a little bit, so that you don’t have to move the mouse over the whole screen to get to another tool on to tool-bar. Also implemented a notification area where geme- and system-relevant information will be displayed.
In the next few days (perhaps weeks) I’ll implement this, so that passenger do have a destination and also change the train to get to this destination. This requires a path-finding algorithm which is the most tricky part I think but it’s not too bad.
After that there’ll be some bug-fixed and minor changes and then the v0.1.4 release is there, yeii 😀
The v0.1.4 release will be the first one where METRO deserves the title “game” 😉
I recently released the version v0.1.3r3 alpha of METRO. There are some major changes that you’ll like 😉
The main focus was on the trains, so there’ll be lots of new things. I also restructured things internally, so that it’s easier to create new things like window-controls or game screens.
- Game window with own window-bar
- Trains and template Trains
- Train buy dialog
- Moving trains
- Bug fixes
- Window management
- Line system
- Technical stuff
- Implemented observer pattern for window controls
- Simplified the `METRO` class and the train/line overseer classes
You can download the source from github as a zip or tar.gz archive. This also includes an archive with the jar file (but without textures and other data files). There are already some bug fixes and improvements for these versions, so I recommend the latest commit that’s available. You also can download this as a zip file (this contains always the latest files).
But there’s also a runnable jar-file with all textures, fonts and other content files 😉 You need at least Java 7 to run this (I always test it in Java 7), but newer versions (Java 8) will also work. If you have Java 6, METRO should normally also work but there’s no guaranty for that.
More information and further links can be fount on github too. There’s also a wiki if you have questions about how to play.
What comes next?
There will be improvements in the train system (different speeds, graphics, failure of a train, …) and the stations will work (trains will stop there and may be late after moving on 😉 ). When finished these two points, the game is ready to be played, because that’s all it needs. After that there’ll be many improvements of existing things, balancing stuff, bug fixed and so on.
That includes also a rearrangement of the UI system to ensure that you don’t have to move the mouse over the whole screen when creating a line or train.
I hope you’ll enjoy it,