Dev Blog - Trilarion

Discussion of ongoing programming work.
Forum rules
Posted relevant content can be used under GPL or GFDL (http://www.gnu.org/) for the project. Thanks!
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XII - What's going on?

Post by Trilarion »

Just for you to know, what's going on now: I was testing sound playback and found that still no out-of-the-box, low overhead sound solution for playing ogg vorbis files in java exists. There are some libraries (Jogg, Jorbis, Easyogg, Tritonus, Vorbis SPI) and I will use them but I need to go deeper and also understand the Java sound system a bit. I will do so in the next time. It might take a while but I love to do such things.

In the end there will be hopefully a facility to play a number of background songs one after another and to keep some effects in memory (so they don't have a huge delay) and play them whenever needed with a second effect always canceling the first one and mixing effects and background songs together with a clean interface. Sounds not too complicated but needs a bit of time.

In the mean time I think I incorporated railroads already - at least as a map property that you can see, not with their real function, but units like engineers are a bit more tricky. And I commented the code better in case some new programmer arrives in the next time. :)
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XIII - Playing Ogg files in Java

Post by Trilarion »

So Java does not support playing ogg files right out of the box. The Java Sound API however is easily (although a bit awkward at the same time) extensible to integrate new file formats and since ogg/vorbis is open source there are implementations written completely in java. Most projects I checked use a combination of Jorbis and Tritonus or Jorbis and VorbisSPI (from JavaZoom), but there are a few others.

Now I was not completely satisfied, so I created in the last week a side project in this Imperialism remake and combined the sources of Jorbis, VorbisSPI and TritonusShare in one library (they're all GPLv2+). This way I can optimize the code (make it more understandable, extend it, make it faster, ...) and offer ogg/vorbis support right out of one box. I guess this will also be of interest to others, so I will make it available for download soon.

So in short: Yes, we can play ogg files and the next release will have music. What is still to do is to define a nice and stable framework for playing small sounds (effects) and longer songs (background music).
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XIV - Playing Songs in the game

Post by Trilarion »

A short update about what I am doing: I am still engaged in playing sound in the game. Just to give you an impression about the different layers you have to think about:

Layer 1: Take Ogg/Vorbis files and decode them. This is offered as a service to the sound system.

Layer 2: Take decoded sound chunks and feed it to the sound system. Do it concurrently, i.e. use multi-threading. Make it stoppable and pausable and resumable. This constitutes a player object.

Layer 3: Have a jukebox where songs are played one after another. Do it again concurrently, so it too can run in the background. This controls the player.

I think I have it mostly, what's missing currently is a way to know when a song ends. Need to add a callback. It's a bit slow overall, but fun. I promise the next release will show progress.
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XV - I can hear music

Post by Trilarion »

As of now I start the game and hear music, Ven's music. Sorry guys, you won't experience it for more than a month. But that's okay because it gives me time to put in more things, as there are: Cities, Railroads, Units. First I have to change how these things are stored internally, then the drawing of these has to be corrected, then I need to parse the original save games. Maybe I can even get the province names.
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XVI - One picture says more than thousand words

Post by Trilarion »

I changed the structure of the save files a lot lately and now I am happy that it looks as before, even a bit better. So instead of boring with words I share an actual (from just now) screenshot with you. :)
Current Editor
Current Editor
CurrentEditor-Screen.jpg (45.24 KiB) Viewed 11206 times
Haxaco
Posts: 48
Joined: Sat Mar 17, 2012 1:07 pm

Re: Dev Blog - Trilarion

Post by Haxaco »

Looks great! Again, Keep Up The Good Work 8-) :mrgreen:

EDIT1: Love the mountain tile BTW ;)

EDIT2: Tri, is there ANYTHING we can do to help you?
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

Re: Dev Blog - Trilarion

Post by Trilarion »

Haxaco wrote:EDIT1: Love the mountain tile BTW ;)
Thanks, actually you're not the first one to comment on this. It's the developing philosophy. First make it working and prove that it can be done, then make it beautiful.
EDIT2: Tri, is there ANYTHING we can do to help you?
Maybe not so much right now but there will. You can and should always comment on everything here (content/graphics/programming/...) that interests you and give us your opinion. Testing new releases and reporting errors or things you would have made different (no need to tell me though what is still missing - I know for myself :) ) is also good.

Apart from that contribution in artwork or programming is very important but usually requires certain skills. Things that do not require special skills that I can think of right now would be:

- gather a list of sound effects in the original game and report them there: viewtopic.php?f=8&t=1067 and then try to find replacements for as many of them as possible from there: http://www.freesound.org/.

- write a short promotional text (like 20 lines) that explain why one must play an Imperialism Remake game (sounds like school homework but is part of developing a game..)

If somebody would do this for me I would have more time for programming. :)
Veneteaou
Posts: 280
Joined: Sat Aug 25, 2012 4:23 am

Re: Dev Blog - Trilarion

Post by Veneteaou »

EDIT1: Love the mountain tile BTW ;)
IMO it's the best tile I've done so far.
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XVII - The server again

Post by Trilarion »

I am working on the server again since I found that the graphics capabilities department has made enough progress for the next release. And I found that I basically made almost everything wrong the last time. The most difficult part of programming is not actually doing it but before thinking about how a problem can/should/must be solved. In this case it means to invent a robust/flexible/complete network of objects that allow to do everything we want. Only I do not know everything I will want. And it's a complex field, difficult to keep everything in mind.

What I want is basically a chain or tree of handlers that process incoming messages. They can consume these messages or they can pass them to one or several consecutive handlers in the chain. Also they can remove themselves from the chain or add new handlers to the chain. That is the client. For the server I imagine such a chain for every connected client. The handlers can additionally in rare occasion (errors for example) request a disconnect or schedule some action (time out for registration...). Now to realize this programmatically will be a bit more time-consuming.

And the best tool for this: pen and paper. :)
User avatar
Trilarion
Founder
Posts: 845
Joined: Thu Jan 12, 2012 9:27 pm
Location: Central germany

XVIII

Post by Trilarion »

Just a quick update. I am working on the network communication part and that is complicated. More complicated than I thought. Apart from the AI of the computer opponents I cannot think of any other part that has more complex interactions. Anyway in case you wondered how that looks here the output of one of the tests: :)

Code: Select all

Server start initiated. [org.iremake.server.network.ServerManager start]
Bound to port. [org.iremake.server.network.ServerManager start]
Client connection initiated. [org.iremake.client.network.ClientManager start]
Client has connected. [org.iremake.client.network.ClientListener connected]
Send message: TextMessage [Version, 0.1.2] [org.iremake.client.network.ClientManager send]
Send message: TextMessage [ClientName, client-name] [org.iremake.client.network.ClientManager send]
Received message: TextMessage [Version, 0.1.2] [org.iremake.server.network.ServerHandler received]
Received message: TextMessage [ClientName, client-name] [org.iremake.server.network.ServerHandler received]
Client [1,/127.0.0.1:50803] transmitted correct version [org.iremake.server.network.handler.VerifyVersionHandler process]
Client [1,/127.0.0.1:50803] transmitted name: client-name [org.iremake.server.network.handler.ClientNameHandler process]
Will stop. [org.iremake.client.network.ClientManager stop]
Connection 1 disconnected. [org.iremake.client.network.ClientListener disconnected]
Connection 1 disconnected. [org.iremake.server.network.ServerHandler disconnected]
Will stop. [org.iremake.server.network.ServerManager stop]
Post Reply