PDA

View Full Version : Angband Java port


strangeintp
January 19, 2008, 22:05
Hopefully I'm not stirring up a nest of nether worms or commiting some other dreadful faux pas, but I'm testing the waters to see what kind of interest there might be in the Angband community for developing a Java port of Angband. I'd been wanting to develop a 2D tile based version of Moria for a while, and even started a Sourceforge project about a week ago (Jmoria - there's nothing in it right now), but then I discovered Angband, and I love the gameplay features added on to the classical Moria.

So now I've set my sights on porting the 2D tile based Angband version to Java, with all the attendant benefits (cross platform, expandibility, maintainability, etc.) I know, a lot of time and code has already been invested in the existing version, but would any developers like to join me in seeing it happen?

I don't have any interest (at the moment) in making a signifiant variant, just porting the latest version to Java. Eventually I'd like to add network play for small groups of players, but that would be after getting the single-player version out.

If you're interested, let me know (either here or in the sourceforge jmoria forum)

pav
January 19, 2008, 22:22
What would be the target platform? PC? Phones? Consoles?

strangeintp
January 19, 2008, 22:37
good question. I was thinking PC's, but now that you mention it, anything that runs a JRE could be a target platform. I'm not sure I'd want to try playing on a PDA, but I suppose if one needed one's Angband fix on the go, that could be a possibility!

takkaria
January 20, 2008, 01:39
So now I've set my sights on porting the 2D tile based Angband version to Java, with all the attendant benefits (cross platform, expandibility, maintainability, etc.) I know, a lot of time and code has already been invested in the existing version, but would any developers like to join me in seeing it happen?

Cross-platform, expandability and maintainability are all things we currently have. I'm naturally resistant to the idea of a Java version, just because I can't get any bloody Java apps working on my linux machine at the moment, but many people have suggested this, started, and ultimately failed. I wish you good luck if you want to try and rewrite the game, but I'm not sure it's worth it.

Nick
January 20, 2008, 02:04
Cross-platform, expandability and maintainability are all things we currently have. I'm naturally resistant to the idea of a Java version, just because I can't get any bloody Java apps working on my linux machine at the moment, but many people have suggested this, started, and ultimately failed. I wish you good luck if you want to try and rewrite the game, but I'm not sure it's worth it.

Agreed; I don't really think it's the best use of effort. What would be nice is a front end for the existing game that runs as a Java app or in a web browser or some such. Sounds easy when you say it quickly.

zaimoni
January 20, 2008, 02:19
What would be nice is a front end for the existing game that runs as a Java app or in a web browser or some such.Looking at nethack.alt.org, it appears the easy way would be a telnet front end which has a Java applet coming in.

Zero
January 20, 2008, 02:56
I wholeheartedly support the porting of Angband to Java. In fact, I've had the same idea for the last week or two, since I've started playing Angband again.

I am a professional Java programmer, but inexperienced and I've been thinking that a project like this would be good for my resume and would sharpen my skills.

I understand the resistance to Java by other developers. My own opinion of Java was poor back when I was purely C/C++, but since learning the language I have come to appreciate how it simplifies a lot of what can make C and C++ programming frustrating. It is just a nice language to work with, and the performance of the JVM has improved greatly since Java's early days.

If I was going to do a Java Angband though, I'd change certain things. For one, I'd move as much to the edit files as possible, even things like resistances, monster types, and spells. The edit files themselves could also be converted to XML format, to simplify the code needed for edit file read/writing. I'd also change the UI so it is better suited for modern screens. Basically, there are a lot of things about Angband that could be made modifiable without recompilation, that currently require source code changes. Let me say, however, that Angband is hands-down one of the BEST designed pieces of software I have ever seen. I really have to congratulate Ben Harrison and Robert Ruehlmann for their amazingly well polished code, and I am sure that Andrew has and is continuing their quality work.

This would be a long project, and I'm not sure if I can commit to the kind of time that would be required for it. But since you're asking to see if there's interest, yes, there's definitely interest.

strangeintp
January 20, 2008, 04:54
I wholeheartedly support the porting of Angband to Java. In fact, I've had the same idea for the last week or two, since I've started playing Angband again.

I am a professional Java programmer, but inexperienced and I've been thinking that a project like this would be good for my resume and would sharpen my skills.

I understand the resistance to Java by other developers. My own opinion of Java was poor back when I was purely C/C++, but since learning the language I have come to appreciate how it simplifies a lot of what can make C and C++ programming frustrating. It is just a nice language to work with, and the performance of the JVM has improved greatly since Java's early days.

If I was going to do a Java Angband though, I'd change certain things. For one, I'd move as much to the edit files as possible, even things like resistances, monster types, and spells. The edit files themselves could also be converted to XML format, to simplify the code needed for edit file read/writing. I'd also change the UI so it is better suited for modern screens. Basically, there are a lot of things about Angband that could be made modifiable without recompilation, that currently require source code changes. Let me say, however, that Angband is hands-down one of the BEST designed pieces of software I have ever seen. I really have to congratulate Ben Harrison and Robert Ruehlmann for their amazingly well polished code, and I am sure that Andrew has and is continuing their quality work.

This would be a long project, and I'm not sure if I can commit to the kind of time that would be required for it. But since you're asking to see if there's interest, yes, there's definitely interest.

Zero, it sounds like we think along similar lines. The project is actually something of a resume/experience builder for myself as well, in addition to the fact that I've always wanted to get into game programming.

Changing the edit files to a more human-readable code is something I had in mind, and parsing in Java is relatively painless (in fact, writing an auto-converter would not be difficult). When I mentioned not changing much, I was really referring to game play features - I'm not really setting out to make an Angband variant per se.

To address comment by previous poster - By no means did I intend to malign the existing code base; after looking through it, I can certainly appreciate the effort that has gone into (and it's especially nice to see the C code well documented - I intend to use that code extensively as a reference). But having moved from C to C++ to Java myself, I'm a big proponent of the language. Just as an e.g. - I haven't been able to get the graphical version running on my Linux box; that wouldn't be an issue with Java.

Additionally, I'll be doing a fair bit of the coding on a Linux platform anyways, so there should be a pretty good chance that incompatibilities are minimized (though I have yet to encounter any issues myself).

I did notice that at least one Java port has been attempted (see JAngband) and petered out. I think part of the problem is that the developer tried to tackle too much at once (in addition to real life butting in, I'm sure). I think the project can be broken down into reasonable bite size pieces and incrementally chipped away it. For version 0.0.1, for example, I have in mind a canvas displaying a single room (with graphics from the Gervais tile set), in which the player moves around.

In any case, I'm starting the project, and will try to get a foundation code base - or at least s/w spec - posted into the sourceforge project in the near future (one to two weeks). I welcome any assistance anyone wants to provide. And of course, it will be GPLed.

takkaria
January 20, 2008, 05:41
I haven't been able to get the graphical version running on my Linux box; that wouldn't be an issue with Java.

No, the problem would be getting it working at all. ;)

In any case, I'm starting the project, and will try to get a foundation code base - or at least s/w spec - posted into the sourceforge project in the near future (one to two weeks). I welcome any assistance anyone wants to provide. And of course, it will be GPLed.

I would note that it pretty much has to be GPL'd if you're using the current code as a reference, in the same way that Angband retained the original Moria licence having being ported from VMS Pascal.

takkaria
January 20, 2008, 05:59
I understand the resistance to Java by other developers. My own opinion of Java was poor back when I was purely C/C++, but since learning the language I have come to appreciate how it simplifies a lot of what can make C and C++ programming frustrating. It is just a nice language to work with, and the performance of the JVM has improved greatly since Java's early days.

My opinion of Java is completely unrelated to whether I think it's a good idea to port the game to it -- I don't think it's a good idea to port Angband to python, or Lua, either, and I really really like Lua. :) It's just that it seems you gain no real advantage in doing so. If you're not changing the gameplay at all, then no-one will be particularly interested in playing it over the C version, and if you do change the gameplay, you might as well write a roguelike from scratch, simply because that would be a much better learning experience.

(I might seem to contradict myself at a later date if I claim that I want to put large chunks of my Angband variant into Lua and try and keep the amount of new C code to a minimum, but that's different-- that's replacing chunks of the game at a time with better code as necessary to achieve my ends.)

If I was going to do a Java Angband though, I'd change certain things. For one, I'd move as much to the edit files as possible, even things like resistances, monster types, and spells.

The edit files themselves could also be converted to XML format, to simplify the code needed for edit file read/writing.

Some years ago my brother Antony wrote a slimline XML parser for Angband, and we experimented with putting the edit files in XML. The problem then became not not knowing what all the values meant, but rather being able to fit more than one entry on the screen at any given time. Leading me to believe that one would seriously need a dedicated editor to edit such XML files. At that point, I gave up on the idea... given the choice between editing a compact format with a text editor, being able to use sed and grep and all the other unix tools that I do, or using an editor I have to write myself and keep up-to-date that doesn't allow me to use grep &c., I'll take the compact text format anyday.

There are plans afoot to change the format during the 3.1.x release cycle to something ever-so-slightly more verbose but still proprietary... but I'm still not sure if it's worth it.

I'd also change the UI so it is better suited for modern screens,

That's one of my goals with the main Angband branch, though nothing much is happening in that area for a while.

Basically, there are a lot of things about Angband that could be made modifiable without recompilation, that currently require source code changes.

You might want to take a look at what Andrew Doull's done in UnAngband wrt spell effects, and putting those into edit files. Though the implementation is in C, the ideas are still well worth looking at.

Nick
January 20, 2008, 07:03
No, the problem would be getting it working at all. ;)


Rewriting Angband in a different language is kind of like entering the Paths of the Dead - you'll be constantly stepping over the skeletons of those who went before you. Or the Fire Swamp. It's not that you can't get through, it's just that no-one ever has.

strangeintp
January 20, 2008, 11:48
hm, I'll ignore fatuous comments and naysayers for now, and give it a shot. Better to have tried and failed, etc.

Wrt game play features - I fully expect that once the basic port is done (w/o game play variance), game play feature improvement/creep can occur. In fact, that would be a major advantage in going to Java - those features can be added with greater ease. Not that it can't be done in C, it's just easier in Java (without getting into a debate about the relative merits of various programming languages, I'll just make that statement as fact), especially if the code base is designed and documented comparable to what I've seen in Angband.

The point behind doing a straight port w/o gameplay feature additions/changes is because it's much easier to start from a known baseline, without having to worry about designing balanced game play. And of course, it keeps down the potentially endless do-loop of feature creep before getting a working product out the door.

Nick
January 20, 2008, 12:11
Fatuous? I thought it was ... deep ... *snif*

Also, to have the best shot at success (and don't get me wrong, I'd love to see you succeed), it seems like a good idea to go in with your eyes open. There is only one (http://langband.sourceforge.net/) comparable project that I know of, although there have been a number of "I'm going to rewrite Angband in language x" posts to the newsgroup. This is probably because it's a sizable amount of effort to provide similar to existing functionality. In the end, you need to have a good enough reason to complete such a thing; my advice is to try and work out now whether you have a good enough reason.

Good luck :)

strangeintp
January 20, 2008, 13:29
Fatuous? I thought it was ... deep ... *snif*

Also, to have the best shot at success (and don't get me wrong, I'd love to see you succeed), it seems like a good idea to go in with your eyes open. There is only one (http://langband.sourceforge.net/) comparable project that I know of, although there have been a number of "I'm going to rewrite Angband in language x" posts to the newsgroup. This is probably because it's a sizable amount of effort to provide similar to existing functionality. In the end, you need to have a good enough reason to complete such a thing; my advice is to try and work out now whether you have a good enough reason.

Good luck :)

I wasn't referring to your comment as the fatuous one, Nick (yours was more amongst the naysayers hehe). But you're right, going in with eyes open is always a good idea. As for reasons, I think I've already got quite a few good ones:

- Learn Java more better, especially as regards to larger projects
- Produce something for once (I have yet to produce a working product - I usually get stuck in the design stage)
- Provide a port of Angband that's more easily expandable and much easier to port across platforms.

And if that wasn't enough, you guys have now given me a challenge, and I don't back down from one (especially when I'm convinced it's achievable)!!

Thanks for the tip on langband, I'll check it out.

Zero
January 20, 2008, 15:05
I definitely understand what you're saying about not changing the gameplay until you get something out the door that works. But, I really hope you're not thinking of line-by-line translating the existing C code.

Having overall _gameplay_ that is the same as Angband or very close to it would be ideal, but I'd suggest designing the program from scratch. Come up with a list of classes, and describe in English what each of their members and methods would do. I wouldn't even write a single line of code until the design is finished.

Cross-platform, expandability and maintainability are all things we currently have.

For a C program, yes. Writing the game in Java would improve these tremendously, though. I still haven't been able to get Angband to compile, even following the detailed list of instructions Doull provided. But I can take Java code from anywhere and get it to run easily.

The easier it is to modify Angband, the more interest people will have in doing so.

zaimoni
January 20, 2008, 15:29
... But, I really hope you're not thinking of line-by-line translating the existing C code.Agreed. z-virt.h/c will have to be completely ditched (automatic memory management and stronger typing pretty much makes everything there outright impossible to translate), and I think ditching z-file.h/c is also a good idea for a Java port.

Anything that goes through format strings is also going to need a moderate rewrite.

takkaria
January 20, 2008, 18:59
Rewriting Angband in a different language is kind of like entering the Paths of the Dead - you'll be constantly stepping over the skeletons of those who went before you. Or the Fire Swamp. It's not that you can't get through, it's just that no-one ever has.

I think of all the amusing replies you've made to people, the Princess Bride has been the most-referenced. Good taste.

strangeintp
January 20, 2008, 19:02
I definitely understand what you're saying about not changing the gameplay until you get something out the door that works. But, I really hope you're not thinking of line-by-line translating the existing C code.

haha, egads no! That would be an impractical and pointless task. The existing code *will* be used to translate the gameplay features. Calculating the success of disarming a trap, for instance.

Having overall _gameplay_ that is the same as Angband or very close to it would be ideal, but I'd suggest designing the program from scratch. Come up with a list of classes, and describe in English what each of their members and methods would do. I wouldn't even write a single line of code until the design is finished.

bah! design... psh! Actually, design is a good thing. Unfortunately I'm not familiar enough with the tools and such to get all that done *before* starting code. However, Javadoc is a pretty durn good alternative! I basically find that by the time I finish a more formalized design as you describe I could have written a skeleton design with stub classes and decent Javadoc that accomplishes the same thing.

For a C program, yes. Writing the game in Java would improve these tremendously, though. I still haven't been able to get Angband to compile, even following the detailed list of instructions Doull provided. But I can take Java code from anywhere and get it to run easily.

The easier it is to modify Angband, the more interest people will have in doing so.

full agreement

K.I.L.E.R
January 23, 2008, 05:50
I find it strange no one has offered to write Angband in x86_64 ASM. :p

Pete Mack
February 12, 2008, 07:30
A full rewrite (and re-architecture) is probably a brutal job. It took more than 1 person to write the original Angband, and I don't see it being that much easier to rewrite it in java. But I can imagine that it might be useful to write a thin java layer like main-win.c--say main-jni.c--to transport between the program and the terminal stuff, and then write the actual UI (input, display, and startup) in java.

Since nearly all the effort in writing a new port is the main-xxx.c code, this would make the existing code a lot more portable for any platform that supports java and gcc.

TricksterWolf
September 14, 2012, 03:49
Just so y'all know... I'm doing this now, too.

Or, rather, I'm writing a roguelike that is Angband-inspired from scratch in Java. It'll be heavily themed, but designed for easy modification by others.

Originally I was just going to compile vanilla and modify it to make a variant, but I'd really like to start from scratch and see what I can come up with. It won't be identical to Angband: it will be tile-based, commands will be simpler, etc., but I hope to closely capture the experience of the 'band class of games, while providing an easier framework for expansion and modification; both for non-programmers and implementers alike.

I probably won't be able to put time into it until January, but it'll be pretty high on the queue once 2013 rolls around.

Derakon
September 14, 2012, 04:39
Wow, it's been four years since this thread was started.

Just so you know, I've started a similar project (https://bitbucket.org/derakon/pyrel), only in Python. There's a bunch of threads about it in the Variants section. If nothing else, you might want to check out the object model; I really think it's the best way to go for this kind of thing as it's readily extensible while still making it easy to find the objects you need.

PowerWyrm
September 14, 2012, 12:30
FYI: http://sourceforge.net/projects/javamangband/

This is the client part of MAngband, written in java. You could have a look at that.

TricksterWolf
September 16, 2012, 04:47
FYI: http://sourceforge.net/projects/javamangband/

This is the client part of MAngband, written in java. You could have a look at that.I'd love to, were only the source code available! I might have to try to contact the author later, if they left information up.

TricksterWolf
September 16, 2012, 04:48
Ah, scratch that. I see the source now...still not used to the new style for Sourceforge as it's been a very long time since I used it. :P