Java Port

Discussion of all aspects of the game engine, including development of new and existing features.

Moderator: Forum Moderators

User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Java Port

Post by professor_max »

I've seen several posts mentioning a Java Port for BfW, but I can't seem to see anybody working on one now. I'm new to J2ME, but would consider helping casually.
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Java Port

Post by Gambit »

There is not one in progress as far as I know.
User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Re: Java Port

Post by professor_max »

If I were to start a project, would it be best to just do it, or get the 'thumbs up' from the powers that be? :?
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
Anonymissimus
Inactive Developer
Posts: 2461
Joined: August 15th, 2008, 8:46 pm
Location: Germany

Re: Java Port

Post by Anonymissimus »

silene wrote:
axyd wrote:Hello, can you please roughly estimate how long will it take to completely rewrite Wesnoth basics (without multiplayer) in another language?
Between 6 and 12 man-months, depending on your proficiency and the language you choose.
projects (BfW 1.12):
A Simple Campaign: campaign draft for wml startersPlan Your Advancements: mp mod
The Earth's Gut: sp campaignSettlers of Wesnoth: mp scenarioWesnoth Lua Pack: lua tags and utils
updated to 1.8 and handed over: A Gryphon's Tale: sp campaign
User avatar
ancestral
Inactive Developer
Posts: 1108
Joined: August 1st, 2006, 5:29 am
Location: Motion City

Re: Java Port

Post by ancestral »

professor_max wrote:If I were to start a project, would it be best to just do it, or get the 'thumbs up' from the powers that be? :?
BfW is open source, so anyone can port the code to any platform.

If you’re serious about starting a Java port then I would start getting acquainted with the code, hop on IRC and start coming up with questions to ask the devs.
Wesnoth BestiaryPREVIEW IT HERE )
Unit tree and stat browser
CanvasPREVIEW IT HERE )
Exp. map viewer
User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Re: Java Port

Post by professor_max »

6 - 12 months, unless I'm still in school ( sadly ) so I could put in 20+ hours a week.

It would have to be completely rewritten, as C/C++ is so different from J"ME.

The biggest problem would be writing it in a way that works. Java phone tend to be the lowest ones on the market, and wouldn't have space for a 175MB app. I think that the MIDlet should be under a MB to download.
I am currently thinking that I would:
- Remove the music/sound affects. This would free up 143MB, a lot of RAM, and as ( to my knowledge ) the JMRE has no .OGG player, so a lot of my time. They say that J2ME MIDlets should run in 512K of RAM, so this will make life much easier. Also, if you're playing BfW on the move, you won't really want the sound on. Sorry West, et al, I think the music is really good.
- Shrink the hex size. Currently I'm using 20x17, but this is a bit crowded, so I might have to make this bigger.
- Simplify the terrain types - eg. all 'plain' hexs would be the same - who's going to notice the difference on such a cheap ( and often distorted ) screen?
- Only supply the game with the Tutorial and one campaign, and allow you to download addon campaigns. This campaign would need to be short, hopefully simple, and have small maps. I've only played one UMC campaign ( blame mobile 'broadband', ) so I would need the community's opinion on which campaigns qualify best. It wouldn't need the best of portraits, as these will be shrunk down to 75x75. So no UtBS. ( Arrr. )
- The menus will have to be redone.
- The AI would have to be simplified, with a possibility to connect to a server that would provide advanced AI for advanced players. I don't think this would upset the balance of the campaign, as it is much harder to play on a small screen, you tend to loose perspective of the battle.
- In the game, the side bar would go, when the cursor moved over a unit, an 'info bar' would scroll down from the top. this would free up space on the screen.
- The mini map would go.
- When paused, it could show a mini map, or a clock
- The WML would have to be simplified.
- Many unit portraits would go if they weren't used in the default campaigns.
- Advanced graphics would be available as an add on.
- Terrain animations would go for many terrains, like water, where you wouldn't be able to see them easily.
- Hopefully, I can multiplayer to work over Bluetooth.
- Story images would go, as they are huge, and can't be seen easily on a small screen.
- The continent map has been kept, at the same resolution, you can scroll around it. I'm thinking, in eras, hard coding the small overlays, this will cut down space. Still, it's 120K on highly compressed JPEG.

I've download the source code, trying to add a 'camp icon' to the continent map ( http://forums.wesnoth.org/viewtopic.php?f=12&t=34025; ) although I can't make head or tail of it. ( because it's not a drake? )

Hopefully I'll have a version for you to comment on within a couple of weeks, but I've offered to code Lord Bob's prepossessed website revamp ( http://forums.wesnoth.org/viewtopic.php?f=17&t=33612 ) , so if he accepts, longer.

Just a few ideas to start with - please comment on what you think. I have spend several weeks coding, and I think I can do it for non-touch screens. I might make it work on touch screens when I can afford one.

Ta for now,
'Professor Max'
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Re: Java Port

Post by professor_max »

Seems like nobody has any opinions. Great, I can do it how I like... :D

I was going to post the .jar today, but I have been very busy last week, and so it isn't yet releasable. I have decided to also get it running as an applet, so that might take some time as well.

The biggest problem now is the AI, MP, memory, and touch screens.

The AI of BfW proper is, I understand, done using several custom scripts. This would be possible on the Java port, but it would require huge amounts of possessor power to load and compile this at the start of every game. I am currently thinking about hard coding an AI into the code, as part of a separate class that could be updated by anyone. This would require a large amount of my time, and would be hard to maintain, as I understand most of the community doesn't use Java; but would be by far the fastest in terms of game play. Alternatively, there could be a compromise - loading the AI from a very basic script. This would probably be the best option to go for.

Memory is a very big problem. Currently I am using a single thread, which means I have to load all the portraits at the start of the game. This is alright, but means that huge ammount of memory are in use. I am going to move to multiply threads- so the screen will be rendered by one tread, while another thread loads in the portrait. This means on a [message], no portrait would be shown for about a third of a second, but this would free up 50 - 100 K of memory. On the world map, compressing the image on a low level .jpeg reduces it to 149K, but the labels become almost unreadable. These might become separate images as overlays, which would also make internationalisation easier.

I am currently having some problems with movement points and battles, but these shouldn't take to long to fix.

MP will be the hardest, as I haven't done anything with networking before, and I heave no idea how BfW proper does it. This feature might have to be left for later / someone else.

I haven't got a clue how long adding touch screens will take.

[EVENT]s

The Wiki isn't very clear on the order in which events are fired.

capture - when you capture a village, which one if fired first, moveto or capture?
time over - when on the scale is this fired?
enemies defeated - dose this only apply to side 1, ( as it says in the wiki, ) or to the current side? If the former, what if the player is playing side 2, or more than one side, which is possible?

My other plan is to create a Synchronization programme that would sync your games on your PC/MAX/Linux &c. with your Java phone. This could be extended to cover the iPhone/iPad/iPod touch.

I hope to have a version ready to test within a fortnight.

Cheerio
'Professor Max'
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
User avatar
MetalKing
Posts: 197
Joined: July 8th, 2011, 11:34 am

Re: Java Port

Post by MetalKing »

Please report furthermore. I can't help you though I'm still interested in your work.
"Sir! We are surrounded by our enemies!" - "Excellent ! We can attack in every direction!"
"Make everything as simple as possible, but not simpler." -- Albert Einstein
No Source - No Binary - No Trust!
Map Wesnoth Springs - The great War [200x120],Player=9
User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Re: Java Port

Post by professor_max »

Hello MetalKing. So far, I have an app which is loading files, but it isn't yet possible to play a full campaign as not all the wml command have been finished yet.
The main things I need to do is put in defense, resistanses, saving, and the AI.
I am still waiting for somebody to say if they think the AI should be hard coded or should I write a lua interpreter for the port. I hope to post an alpha on Saturday.
I am currently quite busy with over things, but i hope to have a bit more time over the summer.
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Re: Java Port

Post by professor_max »

Sorry to double post, but I just have several questions to ask.

In /data/core/images/themes are the five of the icons that appear across the top of the screen, villages.png, gold.png, units.png, income.png, upkeep.png. There are respectively named images with transparent backgrounds, however villages-t.png is missing ( 1.9.6 source ). I need a copy, wherever one can be found.

I also need the BfW logo with layers. The text has to be split into two lines to fit on many of the smaller screens.

All of my code has been written from scratch. Can I release my code under the CC Non-Commercial ShareAlike license, as long as all images are released under the GPL?

Also, which forum should I put it on? The Coders' Corner doesn't quite seem to be the correct forum anymore.

Should all the credits be shown? Many things aren't used, like music, so should a list of composers be shown on the credits screen?

I will post a copy of Saturday, after which I shall disappear to 24, 16 for a Java-free week where I might actually see some of my family for the first time since I started 6 weeks ago...

Take care,
'Professor Max'
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Java Port

Post by Gambit »

Out of curiosity, why are you porting it to java?

If it's for android (which your discussion of "small screens" seems to suggest), another android port is nearly completed.
User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Re: Java Port

Post by professor_max »

Gambit - I am porting it to Java becouse I can't afford an Android phone. Not to mention a future browser game. And as you have said many times - if you want something, DIY.
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
User avatar
Gambit
Loose Screw
Posts: 3266
Joined: August 13th, 2008, 3:00 pm
Location: Dynamica
Contact:

Re: Java Port

Post by Gambit »

Oh. Wesnoth in a browser. I didn't think of that. Neat!
Max
Posts: 1449
Joined: April 13th, 2008, 12:41 am

Re: Java Port

Post by Max »

what phone are we talking about?
User avatar
professor_max
Posts: 66
Joined: June 2nd, 2011, 7:06 pm
Location: 4, 21

Re: Java Port

Post by professor_max »

Max -
A Java app should work on all java enabled phones that have good enought specs. This is what made Java phones so popular several years back.
Please excuse my bad English - my first language is BASIC.

Proud to be a citizen of Nowhereisland.
Post Reply