The beginning is a very delicate time
The past weeks where very, very busy for this project.
Since my last post about the ‘time issue’, I got myself motivated enough to spend more time (read, getting less sleep) on the game and see if I could make anything out of the existing codebase. I was wondering why my motivation was so low, and the reason is simple: Refactoring all the time, without making ‘real progres’ is very de-motivating. Especially since the game was so broken already, that it would require a major amount of effort to get it working again. Then again, it would be done in a rush, and that makes you want to refactor further along the road.
To be blunt, it was a dead end.
So what to do then? Rewriting, again? Sure why not. But not from scratch using SDL as I tried before some while back, but instead try to get out the minimals of the old source code, and see if I could make anything from there. It would be a waste to completely disbandon the code that has been written over the past 10 years.
I spent a week orso doing this. Along the way Arjen joined the process and we where talking about what would be good for a game in terms of code design. We built a little engine using a viewport on a map with pixel-perfect scrolling. After that we wanted to refactor something, due the lack of good tooling for C++, it took us half an hour. We had more little frustrations along the way. We knew how fast it could be, because we both had enjoyed the pleasentness of IntelliJ’s IDEA and the world of Java.
After the refactoring process, we both said “wish it could be done like in IntelliJ”. It happens to be that I had tried to write D2TM in Java a long time ago (somewhere in 2009 I tried a little bit). So I knew things could be done in Java. We quickly agreed to give it a shot.
We built the same engine (which took us a week orso) within an hour in Java.
We did not had to think much to decide we would go on with Java instead of C++.
The project is open source, you can grab the source code from here.
Tonight, we realised a multi-module project that knows three concepts:
– The concept of an “engine”
– The concept of a “mod” (the game rules)
– The concept of a “game” (which brings the engine and mod together)
We can draw a map and spawn multiple “viewports” which basically are now “camera’s” watching the map. We can spawn unlimited amount of viewports and give them pixel perfect scrolling.
Because Arjen and I are working on the project together (a lot of time using TeamViewer) we keep each other motivated. I am very happy with the help from Arjen and I hope we can continue working like this for a long time. It is fun to do, and we get great results pretty fast.
Here is the result so far:
– you can run the game, spawn ‘viewports’ (random size, viewing random location at map). You can move what the viewports see at the same time with arrow keys.
Next thing we want to do is get the facing of tiles correct, so the terrain being drawn is looking prettier.
Btw, you can join our programming sessions for fun, or if you want to contribute in anyway. Just get TeamViewer, and stay tuned on our twitter channel. Once we broadcast a new Teamviewer meeting ID you can join in.