Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : Turning Rooms into Text (I was bored this afternoon)
New Topic New Poll Post Reply
Poster Message
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged

File: TextRoom.zip (71.5 KB)
Downloaded 44 times.
License: Other
icon Turning Rooms into Text (+2)  
I was pretty bored today, so I decided to do something sooo stupid that I knew it would never get into DROD otherwise:

I made it output a room as a text file.

The text output is formatted as follows (this is an example):

OLAYER:
WWWWWWWWWWWWWWWWWWWWWWWWWWWW
W               O          W
W               O          W
W               O          W
G               O          W
WWWWWWWWWWWWWWWWWWWWWWWWWWWW

TLAYER:
                            
                       O    
                            
                            
                            
                            

MLAYER:
                            
 RRRRRRRRRRRR                
 RRRRRRRRRRRR                
 RRRRRRRRRRRR                
 RRRRRRRRRRRR                
                             

ORIENTATIONS:
44444444444444444444444444444
46666666666664444444444444444
46666666666664444444444444444
46666666666664444444444444444
46666666666664444444444444444
44444444444444444444444444444

ORBDATA:
2,5:2,8,2;5,23,1;

SCROLLDATA:
5,6:Hello, this is DROD at your service


OLAYER,TLAYER, and MLAYER represent the object on the respective layer. ORIENTATION contains the orientation of the object:
012
345
678

ORBDATA has one line per orb in the room, consisting of comma-seperated x and y values for the orb, followed by a colon, and comman-seperated x, y, and effect values for each door affected (effect is 1 for toggle, 2 for open, 3 for close). Each of these are seperated by a semicolon.

SCROLLDATA has a starting line for each scroll in the room, that is labeled with comma-seperated x and y values, followed by a colon. After that is the data from the scroll, terminated by the string "?%?" (this is in case of multi=line scrolls, so that a parser would know when to stop). On the next line is the next scroll.

Scripting could be handled with the upcoming script-to-text parser, and could easily be added to the end. The rest of the data is not of consequence (stairs would theoretically be automatically assigned to end hold, because when modifying rooms like this, it would be too unreliable). Entrances would not be stored at all (although there is a character for Beethro).

I won't bother saying here what all the characters are, because I have yet to add any sort of interface to the function, or to write the inverse (that turns the string into a room). As would be expected, the function is untested (due to my inability to actually get DROD to boot up when I compile it). Don't worry though, I already ironed out the errors. The modified files (DbRooms.h, DbRooms.cpp, TileConstants.h) are included here.

Oh, and in case it wasn't obvious from the files, they're under the MPL (apparently I'm supposed to say that here).

Oh, and can someone please tell me where TILE_MID is defined? I seem to have lost it!

[Last edited by coppro at 10-21-2006 05:16 AM]
10-21-2006 at 03:40 AM
View Profile Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5056
Registered: 02-04-2003
IP: Logged
icon Re: Turning Rooms into Text (0)  
Neat!
coppro wrote:
Oh, and can someone please tell me where TILE_MID is defined? I seem to have lost it!
DRODLib/TileConstants.h

____________________________
Gandalf? Yes... That's what they used to call me.
Gandalf the Grey. That was my name.
I am Gandalf the White.
And I come back to you now at the turn of the tide.
10-21-2006 at 04:58 AM
View Profile Send Private Message to User Send Email to User Show all user's posts High Scores This architect's holds Quote Reply
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged
icon Re: Turning Rooms into Text (0)  
That's what I thought. Thanks! I've put a version with that oh-so-useful array restored to former glory.

[Last edited by coppro at 10-21-2006 05:15 AM]
10-21-2006 at 05:10 AM
View Profile Show all user's posts Quote Reply
Alneyan
Level: Smitemaster
Rank Points: 622
Registered: 07-06-2004
IP: Logged
icon Re: Turning Rooms into Text (0)  
coppro wrote:
I was pretty bored today, so I decided to do something sooo stupid that I knew it would never get into DROD otherwise

That sounds pretty handy, actually... I dislike having to type all those orbs by hand when using an orb solver, and perhaps you could use the same sort of thing for other programs. I *want* an AI that can learn playing DROD!
10-21-2006 at 08:58 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged
icon Re: Turning Rooms into Text (+1)  
Actually, if you made a simple function:

ostream& operator<< (ostream& o, const CDbRoom& Room){
o<<Room.GetText();
return o;
}

Then it would be trivial to add a hotkey to output the current room's status via filestream.
10-21-2006 at 06:26 PM
View Profile Show all user's posts Quote Reply
halyavin
Level: Delver
Rank Points: 52
Registered: 02-20-2006
IP: Logged
icon Re: Turning Rooms into Text (0)  
Can someone transform this to a stand-alone application for dumping rooms?
11-08-2006 at 01:11 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Kevin_P86
Level: Smitemaster
Avatar
Rank Points: 535
Registered: 06-28-2005
IP: Logged
icon Re: Turning Rooms into Text (0)  
halyavin wrote:
Can someone transform this to a stand-alone application for dumping rooms?
How would this stand-alone application get access to the room data in order to dump it?

____________________________
+++++[>+++++<-]>[>+++>++++>+++++<<<-]>.>+.>-------.<++++.+++++.
11-08-2006 at 05:12 PM
View Profile Send Private Message to User Send Email to User Show all user's posts This architect's holds Quote Reply
Syntax
Level: Smitemaster
Rank Points: 1218
Registered: 05-12-2005
IP: Logged
icon Re: Turning Rooms into Text (+1)  
If it stood near or inside the rooms in question? :P
11-10-2006 at 12:17 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Banjooie
Level: Smitemaster
Avatar
Rank Points: 1645
Registered: 12-12-2004
IP: Logged
icon Re: Turning Rooms into Text (0)  
Kevin_P86 wrote:
halyavin wrote:
Can someone transform this to a stand-alone application for dumping rooms?
How would this stand-alone application get access to the room data in order to dump it?

Presumably, from the .hold file?
11-13-2006 at 08:42 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
halyavin
Level: Delver
Rank Points: 52
Registered: 02-20-2006
IP: Logged
icon Re: Turning Rooms into Text (0)  
Kevin_P86 wrote:
halyavin wrote:
Can someone transform this to a stand-alone application for dumping rooms?
How would this stand-alone application get access to the room data in order to dump it?
It can looks like a DROD but accept command from console and dump loaded rooms/levels.
11-13-2006 at 10:15 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged
icon Re: Turning Rooms into Text (0)  
That´s the problem. Caravel will not support any binary mods, and so I´d have to work on a separate utility in order to get something like this to work. For that, I´d have to have a working compilation, and probably I´d need to get DRODUtil up and working. So, for the time being, all you can do is cross your fingers and hope Mike puts this in somewhere.
11-13-2006 at 04:58 PM
View Profile Show all user's posts Quote Reply
Alneyan
Level: Smitemaster
Rank Points: 622
Registered: 07-06-2004
IP: Logged
icon Re: Turning Rooms into Text (0)  
More accurately, I believe (as in "I seem to remember") Caravel Games does not support binary mods on these boards, but has otherwise nothing against their existence. So, so long as said mod is kept outside those forums, it should be fine (the rationale was, more or less, "avoiding a bunch of problems with users toying with binary mods that make the whole thing go fubar"... which seems pretty reasonable, in my limited experience as makeshift hotline).

I'm not sure if that would be the case for a binary mod that prevents normal Drod play, or even a wholly different executable compiled from source. In the latter case, you would be missing CaravelNet (not a big deal here) and some content (not a big deal either, and "copy-paste" should be able to solve that). I don't think a separate executable has been offered for download here yet.

Of course, I'm not in any way or manner affiliated with Caravel Games, the opinions presented here are not endorsed by my current employer, university, or spouse, no warranties, massive disclaimers of irresponsibility, and nobody is pulling any strings. Nope.
11-13-2006 at 09:05 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged
icon Re: Turning Rooms into Text (0)  
Well, what they said is that they have nothing against them, but they won´t support them. Ergo, if you´re using a binary mod, then you better be prepared to remove it before you go crawling to them for help. And for simplicity reasons, I´m reluctant to hand out a full executable. Now, as I said, a utility to fetch rooms from a hold might be nice, but that is a future endeavor. Right now it´s just an exercise of the mind. Once The City Beneath is out, I might be more willing to try and get this working, but for now, I think the term ¨pipe dream¨ would be very appropriate.
11-13-2006 at 11:21 PM
View Profile Show all user's posts Quote Reply
michthro
Level: Smitemaestro
Rank Points: 679
Registered: 05-01-2005
IP: Logged
icon Re: Turning Rooms into Text (0)  
Alneyan wrote:
More accurately, I believe (as in "I seem to remember") Caravel Games does not support binary mods on these boards, but has otherwise nothing against their existence.
.
.
I'm not sure if that would be the case for a binary mod that prevents normal Drod play, or even a wholly different executable compiled from source.
Yes, there's a big difference between a mod you use to play the game, and a utility that happens to take the form of a mod. Especially if the utility prevents playing. I'm not Caravel either, but I don't see why they'd have a problem?

Anyway, the simplest way by far to do this room-to-text thing would be to modify the source. Everything you need (and you need rather a lot to get to the point where you can work with room data) is there. Plus you already have an interface. Add coppro's code and hijack a button on the restore screen. You click restore and instead of restoring, it dumps the room as text. (To some location specified in a text file somewhere, or if you feel like it, use the framework already included to pop up a dialog or something.)

Writing this from scratch or extracting only what you need is a major hassle. (I know, because I tried, when recovering progress from CNet for someone. In the end it was far easier to simply use the full source with a few changes.) Of course, if you feel like taking on a project, that's different, but if you have some utility in mind, and you want to get the job done, modifying the full source is the way to go. The only drawback is that the .exe then contains a lot of stuff you don't need, so it's unnecessarily large. Maybe I'm just lazy.
11-14-2006 at 10:48 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
eytanz
Level: Smitemaster
Avatar
Rank Points: 2708
Registered: 02-05-2003
IP: Logged
icon Re: Turning Rooms into Text (0)  
michthro wrote:
Yes, there's a big difference between a mod you use to play the game, and a utility that happens to take the form of a mod. Especially if the utility prevents playing. I'm not Caravel either, but I don't see why they'd have a problem?

I think the main issue is that Mike doesn't want to have to inspect the mod carefully in order to ensure that:

A - it has no hidden gameplay affecting features (or in this case, any hidden backdoors to the gameplay or something like that).
and B - it introduces no potentially serious bugs.

It's not about what a mod can or cannot do, it's about the fact that anything appearing on these forums can be taken to be not only tolerated but rather endorsed by Caravel, and it saves a lot of potential headaches to only have official support for the official development branch.

I'm not saying they're above making exceptions, especially in cases like this, but I think having a very strict policy makes sense.

____________________________
I got my avatar back! Yay!

[Last edited by eytanz at 11-14-2006 12:57 PM]
11-14-2006 at 12:56 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Alneyan
Level: Smitemaster
Rank Points: 622
Registered: 07-06-2004
IP: Logged
icon Re: Turning Rooms into Text (0)  
Just for the sake of clarity, Eytanz: your post only applies to binary mods, right? Or would Caravel Games ask for the non-distribution of separate executables on their boards as well?

Coppro: I could be interested in making said executable, one of those days when I'm feeling insomniac... The thought of having to glance at C++ code to do the actual changes doesn't appeal to me, though. I know I want to add an "export player file" command-line flag to Drod, though I can't work up enough will to hack through the code.

There might be *some* use for some sort of shebang "a bunch of little features thrown in DROD, with no apparant design or concertation, all packed up in a new executable". Or perhaps not.
11-14-2006 at 01:27 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
eytanz
Level: Smitemaster
Avatar
Rank Points: 2708
Registered: 02-05-2003
IP: Logged
icon Re: Turning Rooms into Text (0)  
Alneyan wrote:
Just for the sake of clarity, Eytanz: your post only applies to binary mods, right? Or would Caravel Games ask for the non-distribution of separate executables on their boards as well?

I'm not entirely sure what the policy actually is. You'll have to ask Mike or Erik. I was just pointing out that Caravel has a reason to disallow mods, even if they don't directly affect gameplay.

____________________________
I got my avatar back! Yay!
11-14-2006 at 01:29 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
Stefan
Level: Smitemaster
Avatar
Rank Points: 2119
Registered: 05-25-2004
IP: Logged

File: VerboseHold.zip (10.3 KB)
Downloaded 40 times.
License: All Rights Reserved
icon Re: Turning Rooms into Text (+2)  
Since I already had most of the code written for something like this, I quickly whipped together a program that dumps a room as text from a hold file.

Usage (case sensitive):
java VerboseHold <Hold file> <LevelID> <RoomX> <RoomY>
This will dump the room in a similar format to the one above. You will need to know the internal LevelID for the level the room is on. This information can be obtained by running
java VerboseHold <Hold file>
This will print a list of the levels in the hold.

Example usage:
$ java VerboseHold "Arena 3.hold"
11285: Arena 1
11286: Arena 3
11287: Arena 2
$ java VerboseHold "Arena 3.hold" 11285 0 1
This will (or at least should) print out Arena 1:1S as text.

Known issues:
- Serpent and rattlesnake bodies will not be shown.
- Tile information (OLAYER and TLAYER) for AE holds will not be shown.
- Scrolls with several paragraphs (with line endings) will not be printed correctly.
- All tile and monster information is numeric, so you'll either have to guess what the numbers stand for, or check the DROD source.
- For some levels (where the level entrance is not in the "standard location" (X=50=Y)) the room coordinates are shifted.
- Most error messages are completely useless.

____________________________
0.099³
11-14-2006 at 04:26 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
halyavin
Level: Delver
Rank Points: 52
Registered: 02-20-2006
IP: Logged
icon Re: Turning Rooms into Text (0)  
"Hold not user-made. Quitting." Why :~( ?
11-24-2006 at 08:39 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
halyavin
Level: Delver
Rank Points: 52
Registered: 02-20-2006
IP: Logged
icon Re: Turning Rooms into Text (0)  
Oh, I disassemble VerboseHold.class, remove this check and assemble it back. Now it perfectly works with non-user made holds.
11-24-2006 at 09:02 AM
View Profile Send Private Message to User Show all user's posts Quote Reply
Syntax
Level: Smitemaster
Rank Points: 1218
Registered: 05-12-2005
IP: Logged
icon Re: Turning Rooms into Text (0)  
I think you ought to pull your hacked version. There must have been a reason Stefan disabled it for non-user made holds. My guess is that the official holds are proprietary...
11-24-2006 at 12:03 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Stefan
Level: Smitemaster
Avatar
Rank Points: 2119
Registered: 05-25-2004
IP: Logged
icon Re: Turning Rooms into Text (0)  
halyavin wrote:
"Hold not user-made. Quitting." Why :~( ?
Well, perhaps I'm being overly cautious and protective of Caravel products, but I feel that official holds should receive some special treatment (Official holds have "Only You" editing privileges, so it's clear that Caravel doesn't want people poking around). Maybe it's not that important for this utility in particular, but if I release my utility that extracts data files from holds, I'd definitely put in a check that prevents extraction from official holds (such a utility could, for instance, lower the sales for "Deadly Music of Death").

Oh, and technically, you're not allowed to post that patch here (licensing!). I'm not going to force you to take it down, though, and if no-one from the dev team has any objections, I'll remove the check from the program.

____________________________
0.099³
11-24-2006 at 12:03 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
halyavin
Level: Delver
Rank Points: 52
Registered: 02-20-2006
IP: Logged
icon Re: Turning Rooms into Text (0)  
I think that text data isn't secret, because you can extract most of it manually. That's why I hacked the program and posted the patch.
BTW, my friend have a program which can extract all data from imported holds or change owner bits but it isn't user-friendly.
And have I already mentioned at this forum that DROD as a whole needs more copyright protection?
11-24-2006 at 12:36 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Syntax
Level: Smitemaster
Rank Points: 1218
Registered: 05-12-2005
IP: Logged
icon Re: Turning Rooms into Text (0)  
halyavin wrote:
And have I already mentioned at this forum that DROD as a whole needs more copyright protection?
Well... it *is* copyright protected. That's partly why posting binary mods isn't allowed.
11-24-2006 at 12:40 PM
View Profile Send Private Message to User Show all user's posts Quote Reply
Stefan
Level: Smitemaster
Avatar
Rank Points: 2119
Registered: 05-25-2004
IP: Logged
icon Re: Turning Rooms into Text (+1)  
halyavin wrote:
I think that text data isn't secret, because you can extract most of it manually.
If you know how to do it, yes, you can do nearly anything. However, that doesn't mean that you should make it easy for others to do the same.

____________________________
0.099³
11-24-2006 at 12:49 PM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
ErikH2000
Level: Legendary Smitemaster
Avatar
Rank Points: 2794
Registered: 02-04-2003
IP: Logged
icon Re: Turning Rooms into Text (0)  
Stefan wrote:
If you know how to do it, yes, you can do nearly anything. However, that doesn't mean that you should make it easy for others to do the same.
That sums up my position.

-Erik

____________________________
The Godkiller - Chapter 1 available now on Steam. It's a DROD-like puzzle adventure game.
dev journals | twitch stream | youtube archive (NSFW)
11-24-2006 at 06:55 PM
View Profile Send Email to User Show all user's posts This architect's holds Quote Reply
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : Turning Rooms into Text (I was bored this afternoon)
Surf To:


Forum Rules:
Can I post a new topic? No
Can I reply? No
Can I read? Yes
HTML Enabled? No
UBBC Enabled? Yes
Words Filter Enable? No

Contact Us | CaravelGames.com

Powered by: tForum tForumHacks Edition b0.98.8
Originally created by Toan Huynh (Copyright © 2000)
Enhanced by the tForumHacks team and the Caravel team.