Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old August 16, 2010, 15:37   #1
Sirridan
Knight
 
Sirridan's Avatar
 
Join Date: May 2009
Posts: 560
Sirridan is on a distinguished road
A proposal... (python)

A couple of folks here seem to show interest in having Angband written in python; I myself am one of them. So why not do it? I think if we get enough people, we can get it working.

I'd say start by making the AngbandBase in python first, then moving to porting over the logic. I know it's quite a few thousand lines of code (100k+ right?) but the conversion should knock it down quite a bit.

Anyone interested?
Sirridan is offline   Reply With Quote
Old August 16, 2010, 16:15   #2
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,938
Derakon is on a distinguished road
Much as I would love to see Angband in Python, I have far too many projects in the air right now to commit to helping out.

Also, to do it properly, you'd need to do more than just a straight port. Angband is a procedural program that was written ~25 years ago; ideally a modern port of it would change the design into something more object-oriented without significantly changing the gameplay. Such a redesign would require the help of someone who has a good understanding of the overall program, though.
Derakon is offline   Reply With Quote
Old August 16, 2010, 18:15   #3
fph
Knight
 
Join Date: Apr 2009
Location: Berlin / Italy
Posts: 790
fph is on a distinguished road
Maybe it's a stupid idea, but I'd like to bring it up for discussion, too.
There are several methods to interface python with C; it could be a possibility to do the porting gradually, starting from small parts of the code which would benefit more from the scripting (e.g. spells and effects).
This would make it easier to test and playtest, since the code would be usable from the early stages. It would also feel more like an evolution rather than a completely different project/fork.

I know that scripting has been introduced in the past with LUA and then dropped, but I am not familiar with the reasons that led to its elimination. What were its drawbacks?
fph is offline   Reply With Quote
Old August 16, 2010, 19:44   #4
d_m
Angband Devteam member
 
d_m's Avatar
 
Join Date: Aug 2008
Location: Philadelphia, PA, USA
Age: 39
Posts: 1,516
d_m is on a distinguished road
Quote:
Originally Posted by Derakon View Post
Also, to do it properly, you'd need to do more than just a straight port. Angband is a procedural program that was written ~25 years ago; ideally a modern port of it would change the design into something more object-oriented without significantly changing the gameplay. Such a redesign would require the help of someone who has a good understanding of the overall program, though.
This is the reason why I have never seriously started this. I actually think it will be really difficult to redesign the whole program to be object-oriented, use fewer (or no) global variables, etc, and still actually play the same. The current implementation is hairy enough that even a straight port would be buggy for a long time.

Once you start redesigning things you're going to get bogged down into discussions about which legacy design choices were "bugs" and which were "important game features".

If I were going to do it I would make it as close a port as possible. That would mean:

1. structs become classes with no methods (initially)
2. keep all the global variables
3. remove the memory allocation code but keep the string processing/formatting code
4. keep the current "term" design
5. keep the current savefile and edit file structures

Once you get the working (or maybe "if") then you can start refactoring code to be more modern. This plan loses a lot of the appeal of a Python port, which is probably why I haven't done it
__________________
linux->xterm->screen->pmacs
d_m is offline   Reply With Quote
Old August 16, 2010, 20:15   #5
RogerN
Swordsman
 
RogerN's Avatar
 
Join Date: Jul 2008
Posts: 308
RogerN is on a distinguished road
Quote:
Also, to do it properly, you'd need to do more than just a straight port. Angband is a procedural program that was written ~25 years ago; ideally a modern port of it would change the design into something more object-oriented without significantly changing the gameplay. Such a redesign would require the help of someone who has a good understanding of the overall program, though.
After writing Cryptband, based loosely on Angband code, I can attest to the fact that Angband's code is not at all simple to translate into an object-oriented framework. A major design overhaul would be needed to take advantage of the benefits of a language like Python. Without it, you'll end up with yet another procedural code base which is no more extensible or moddable than what Angband already has. At the same time, you'll lose all the compile-type benefits of a strongly typed language.

I think it would be best to attempt a project like this by not looking at the Angband code at all, or at least infrequently.
RogerN is offline   Reply With Quote
Old August 31, 2010, 20:29   #6
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Hmmm. As someone with a good understanding of the code and the game, but without the skill or the time to play a major part in the python coding, I'm ideally positioned to act as the aforementioned consultant to this project!

Seriously, I agree that this project should stick as closely as possible to the current V until a working port is running, before getting into major gameplay changes. OTOH I'm quite happy to take full advantage of Python in terms of redesigning how the code works - e.g. taking another look at what's read in from text files and how (elly on IRC has done a lot of work on this, with a more modern edit file syntax).

One thing I think would need to be agreed at the outset: we're writing it for Linux, and thus postponing any and all port-specific issues. (Yes, ideally it should Just Work on any Python platform, but I think it would save energy and retain focus if we were not distracted by issues on non-Linux platforms.) Once it works on Linux, people can put effort into making it work on other OSs.

(Oh, and I totally agree with the idea of starting from AngbandBase, as well.)

So, who's actually up for this?
Magnate is offline   Reply With Quote
Old August 31, 2010, 20:44   #7
Atarlost
Swordsman
 
Join Date: Apr 2007
Posts: 441
Atarlost is on a distinguished road
Quote:
Originally Posted by Magnate View Post
Hmmm. As someone with a good understanding of the code and the game, but without the skill or the time to play a major part in the python coding, I'm ideally positioned to act as the aforementioned consultant to this project!

Seriously, I agree that this project should stick as closely as possible to the current V until a working port is running, before getting into major gameplay changes. OTOH I'm quite happy to take full advantage of Python in terms of redesigning how the code works - e.g. taking another look at what's read in from text files and how (elly on IRC has done a lot of work on this, with a more modern edit file syntax).

One thing I think would need to be agreed at the outset: we're writing it for Linux, and thus postponing any and all port-specific issues. (Yes, ideally it should Just Work on any Python platform, but I think it would save energy and retain focus if we were not distracted by issues on non-Linux platforms.) Once it works on Linux, people can put effort into making it work on other OSs.

(Oh, and I totally agree with the idea of starting from AngbandBase, as well.)

So, who's actually up for this?
In theory shouldn't AngbandBase be dealing with any portability issues for non-handheld platforms?
__________________
One Ring to rule them all. One Ring to bind them.
One Ring to bring them all and in the darkness interrupt the movie.
Atarlost is offline   Reply With Quote
Old August 31, 2010, 20:55   #8
Derakon
Prophet
 
Derakon's Avatar
 
Join Date: Dec 2009
Posts: 8,938
Derakon is on a distinguished road
To be quite honest I think the best way to deal with this would be to make a new roguelike from the ground up that strives to be similar to Angband and isn't afraid to steal content wholesale. Attempting to port a large established C codebase to Python would be a huge amount of work, and it'd be difficult to get motivated if you knew you weren't going to reap the rewards of that port for a long while.
Derakon is offline   Reply With Quote
Old August 31, 2010, 20:58   #9
Magnate
Angband Devteam member
 
Join Date: May 2007
Location: London, UK
Posts: 5,057
Magnate is on a distinguished road
Send a message via MSN to Magnate Send a message via Yahoo to Magnate
Quote:
Originally Posted by Atarlost View Post
In theory shouldn't AngbandBase be dealing with any portability issues for non-handheld platforms?
Yes, in theory. But all these things take time, and if the python rewrite is going to happen, I just think we need to stay focused until it starts working. Just my 2p.

Besides, there are enough other people interested in AngbandBase that that might be fixed independently ...
Magnate is offline   Reply With Quote
Old August 31, 2010, 22:05   #10
cinereaste
Scout
 
Join Date: May 2010
Posts: 39
cinereaste is on a distinguished road
Quote:
Originally Posted by Derakon View Post
To be quite honest I think the best way to deal with this would be to make a new roguelike from the ground up that strives to be similar to Angband and isn't afraid to steal content wholesale. Attempting to port a large established C codebase to Python would be a huge amount of work, and it'd be difficult to get motivated if you knew you weren't going to reap the rewards of that port for a long while.
I tend to agree with Derakon here. Although I can see the argument that fph puts forth about porting the code gradually to maintain functionality, I suspect that method will force (or strongly encourage) the adoption of the programming techniques and hacks that we would like to get away from by porting to Python. Maybe it can be avoided, but I think it would be much easier to adopt good coding practices by starting from the ground up.

I think in either case motivation might be an issue -- As Derkon states, a gradual port delays the time when we can reap the benefits of Python, but starting from the ground up will also take a long time.
cinereaste is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
New ego-weapon/armour proposal: (Light) Nightmarjoo Vanilla 24 May 20, 2010 23:08


All times are GMT +1. The time now is 15:15.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.