Angband.oook.cz
Angband.oook.cz
AboutVariantsLadderForumCompetitionComicScreenshotsFunniesLinks

Go Back   Angband Forums > Angband > Development

Reply
 
Thread Tools Display Modes
Old October 2, 2009, 04:25   #1
buzzkill
Prophet
 
buzzkill's Avatar
 
Join Date: May 2008
Location: Indiana, USA
Posts: 2,939
Donated: $8
buzzkill is on a distinguished road
Programmer wanted...

I'm looking for someone, anyone, to write a little piece of code for me. It doesn't have to be pretty, just effective. What I want is a program that will that will take the guts of a typical angband-type edit file and output, in a new text file, a 'skeleton' graf-dvg.prf.

It shouldn't take any more work than reading each set of lines, breaking it down into it's parts, and spitting it back out again in a different format. I'll strip out the header and other irrelevant parts of the file in advance...

So, something like this...

Code:
# 0x00 --> nothing

N:0:nothing
G: :w

# 0x01 --> open floor

N:1:open floor
G:.:w

# 0x02 --> invisible trap (drawn as open floor)

N:2:invisible trap
G:.:w
M:1

would be turned into something like this..

Code:
# nothing
F:0:0x80:0x80

# open floor
F:1:0x80:0x81

# invisible trap
F:2:0x80:0x81
Obviously, it would have to insert 'dummy' hex values.

It needs to work in windows. I'm working with Dev-C++ (so if plays nice all the better). It would be nice if it was able to handle the terrain, objects and monster files, all of which are a little different. Given the source for any one of the above, I could probably, with some effort, modify it to work with the others. It would be a learning experience. The file input and output is what I have no idea how to do.

As should be obvious by now, I plan to use this to create .prf files for variants that don't currently have 'working' graphics. The bulk of the work is creating a matching .prf so having such a program would save hours. Manually adding the hex values is easy.

If I don't get any takers, I'll probably go ahead and try to do it in visual basic (but I'd rather learn C++).
__________________
www.mediafire.com/buzzkill - Get your 32x32 tiles here. UT32 now compatible Ironband and Quickband 9/6/2012.
My banding life on Buzzkill's ladder.
buzzkill is offline   Reply With Quote
Old October 2, 2009, 04:47   #2
Pete Mack
Prophet
 
Join Date: Apr 2007
Location: Seattle, WA
Posts: 4,345
Donated: $40
Pete Mack is on a distinguished road
You probably want to use VB or some other scripting language (perl) for this. There's no benefit to doing basic string manipulation in C.
Pete Mack is offline   Reply With Quote
Old October 2, 2009, 07:13   #3
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
I'd be happy to write you a perl script, but I don't do windows, so you should try to get another volunteer. It looks pretty trivial.
PowerDiver is offline   Reply With Quote
Old October 2, 2009, 07:15   #4
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by buzzkill View Post
If I don't get any takers, I'll probably go ahead and try to do it in visual basic (but I'd rather learn C++).
Of the languages I am personally competent enough in to immediately implement (C, C++, Perl, Python):
1) Perl or Python (for this particular task they're about equivalent, as this doesn't look like something that needs regular expression-like processing. Perl would win if regular expressions were important. Python would win if processing files hundreds of megabytes in size was important.) Any reasonably modern scripting language that garbage-collects for you and allows you to loop over the read-in lines directly, should have the required functions to be in this class.

It is very unlikely that you need Genuine C Performance. For text-processing like this, Python will give you Genuine C Performance if you don't do something stupid like copying strings instead of using those handy reference slices.

2) C++ : assuming you actually use Resource Acquisition Is Initialization, the C++ Looking-glass land mirror of garbage collection . While the standard library does provide std::string, you might be better served by std::vector<char> and the C library functions.

Just because C++ is my dominant programming language, doesn't mean I use it for everything.

For this application, if you use malloc/calloc/realloc/free you're programming C with a C++ compiler. That's in the next category.

3) C : C standard libary string functions are great at what they do, but being damned to malloc/calloc/realloc/free just isn't worth it.

The problem is that C and C++ are both targeting "next to the machine" programming, and this application doesn't need "next to the machine" programming.

So...
* Choose a familiar language, or
* Choose a portable language in 1) [Perl, Python, Lua are obvious; you probably could get away with PHP.], or
* Choose a language you want to learn no matter what.
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old October 2, 2009, 07:23   #5
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by PowerDiver View Post
I'd be happy to write you a perl script, but I don't do windows, so you should try to get another volunteer. It looks pretty trivial.
But windows has Perl.

ActivePerl, Strawberry Perl, ....

Building Perl from source is more difficult than it should be on Windows, but possible. [I can think of exactly two projects that use DMake. Perl and OpenOffice.org. ]
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old October 2, 2009, 08:11   #6
PowerDiver
Prophet
 
Join Date: Mar 2008
Posts: 2,712
PowerDiver is on a distinguished road
Quote:
Originally Posted by zaimoni View Post
But windows has Perl.

ActivePerl, Strawberry Perl, ....

Building Perl from source is more difficult than it should be on Windows, but possible. [I can think of exactly two projects that use DMake. Perl and OpenOffice.org. ]
I wouldn't even know what extension to use. .prl or .per or .perl ?

My first line, #!/usr/bin/perl , would most likely be wrong. Or would it not matter?

Things that claim to be portable usually aren't until you tweak them.
PowerDiver is offline   Reply With Quote
Old October 2, 2009, 15:44   #7
konijn_
Hellband maintainer
 
konijn_'s Avatar
 
Join Date: Jul 2007
Location: New York, the Big Apple
Age: 40
Posts: 351
Donated: $120
konijn_ is on a distinguished road
http://hellband.net/convert.html
__________________
* Are you ready for something else ? Hellband 0.8.7 is out! *
konijn_ is offline   Reply With Quote
Old October 2, 2009, 18:08   #8
zaimoni
Knight
 
zaimoni's Avatar
 
Join Date: Apr 2007
Posts: 590
zaimoni is on a distinguished road
Quote:
Originally Posted by PowerDiver View Post
I wouldn't even know what extension to use. .prl or .per or .perl ?
.pl would be most traditional. The Windows-native ones don't use extension binding, so it's whatever works.

Quote:
Originally Posted by PowerDiver View Post
My first line, #!/usr/bin/perl , would most likely be wrong. Or would it not matter?
It doesn't matter when executing from the Windows command prompt.

In bash, it does matter -- but you're already in trouble because Windows-native Perl uses /r/n newlines and the results won't play well with just about anything using /n newlines. And the MingW perl (which has /n newlines, thus isn't Windows-native) ships with a broken Cwd module, so lots of things break.
__________________
Zaiband: end the "I shouldn't have survived that" experience. V3.0.6 fork on Hg.
Zaiband 3.0.10 ETA Mar. 7 2011 (Yes, schedule slipped. Latest testing indicates not enough assert() calls to allow release.)
Z.C++: pre-alpha C/C++ compiler system (usable preprocessor). Also on Hg. Z.C++ 0.0.10 ETA December 31 2011
zaimoni is offline   Reply With Quote
Old October 3, 2009, 04:44   #9
buzzkill
Prophet
 
buzzkill's Avatar
 
Join Date: May 2008
Location: Indiana, USA
Posts: 2,939
Donated: $8
buzzkill is on a distinguished road
Quote:
Originally Posted by konijn_ View Post
It's alive! Thanks a lot. It works fine, churning through a whole file in a couple of minutes. After outlining my own project today, I came to the conclusion that it's a lot easier than I originally thought, and I didn't think it would be all that hard to begin with. I'm going to try to write one in C++, just as an exercise for myself. With any luck, mine will also compare item/monster/terrain names to the V pref file, and substitute V hex values for objects with identical names. Perfect? no. Better? hopefully.

PS. Hellband is the project I had in mind when I proposed this. Did you recognize the snippet, or just coincidence.

EDIT: Just one little bug. When MaxHex2 is reached it rolls over to 0, rather than StartHex2. Default vaules of 128, 128 and 255 wouldn't hurt anything either.
__________________
www.mediafire.com/buzzkill - Get your 32x32 tiles here. UT32 now compatible Ironband and Quickband 9/6/2012.
My banding life on Buzzkill's ladder.

Last edited by buzzkill; October 3, 2009 at 05:29.
buzzkill is offline   Reply With Quote
Old October 3, 2009, 05:56   #10
konijn_
Hellband maintainer
 
konijn_'s Avatar
 
Join Date: Jul 2007
Location: New York, the Big Apple
Age: 40
Posts: 351
Donated: $120
konijn_ is on a distinguished road
Quote:
Originally Posted by buzzkill View Post
It's alive! Thanks a lot. It works fine, churning through a whole file in a couple of minutes. After outlining my own project today, I came to the conclusion that it's a lot easier than I originally thought, and I didn't think it would be all that hard to begin with. I'm going to try to write one in C++, just as an exercise for myself. With any luck, mine will also compare item/monster/terrain names to the V pref file, and substitute V hex values for objects with identical names. Perfect? no. Better? hopefully.

PS. Hellband is the project I had in mind when I proposed this. Did you recognize the snippet, or just coincidence.
Pure coincidence, go figure..

Quote:
Originally Posted by buzzkill View Post
EDIT: Just one little bug. When MaxHex2 is reached it rolls over to 0, rather than StartHex2. Default vaules of 128, 128 and 255 wouldn't hurt anything either.
Well, its not a bug, its a feature I assumed hex1 is row , hex2 is column, so that if you reach the end of the row, you start the new row at column 0.

Since you are the only user so far, I modified it to start again with starthex2 and added your proposed defaults.

T.
__________________
* Are you ready for something else ? Hellband 0.8.7 is out! *
konijn_ 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
Reporter wanted pav Oook! 5 January 11, 2011 16:26
VC++ compiler help wanted. PaulBlay Development 6 April 24, 2009 17:29
Wanted: Coder help PaulBlay ToME 0 February 14, 2009 15:27
tips wanted will_asher AAR 4 February 15, 2008 00:31
[Un] Reviewers wanted andrewdoull Variants 0 November 25, 2007 06:06


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


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.