Export Room to XML?

Started by Clarvalon, Wed 15/04/2009 14:49:01

Previous topic - Next topic

Dualnames

Can I beg? Man, would I love to see HHGTG on Xbox or anything! ;D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

subspark

That or sektor13's infinity string!

Sparky

Clarvalon

@Denzil:  Brillliant - I'm blown away with how quickly you produced the plugin.  It's exactly what I was looking for.  I've had a few minutes to play with it and these are my initial thoughts:
  • It doesn't export the xml unless you export it to the same directory as the *.crm files.
  • It would be preferable to have the background images exported as .png files as opposed to embedded in the xml.
  • Is it possible to also export the walkable areas, hotspots etc. as .pngs?

Do you have any objection to me playing around with the source code to overcome these minor issues?  The thought occurs that using the Plugin I could automate a whole lot more of the pre-conversion preparation, which would make things even simpler/quicker.  Many thanks for your help!

@DN:  Whilst it would be possible to convert your Hitchhikers game to the Xbox, and to distribute the *.ccgame to others with the Creator's Club membership, you will almost certainly be prevented from releasing it to Xbox Live due to copyright issues.  However, nothing would stop you from creating a Silverlight version for playing online.
XAGE - Cross-Platform Adventure Game Engine (alpha)

Denzil Quixode

Quote from: clarvalon on Fri 09/10/2009 10:36:29
  • It doesn't export the xml unless you export it to the same directory as the *.crm files.
That's odd. I can't think of any reason why. Maybe a permissions thing?
Quote
  • It would be preferable to have the background images exported as .png files as opposed to embedded in the xml.
Sure. Change this bit:
Code: ags
for (int j = 0; j < room.BackgroundCount; j++)
{
	using (Bitmap bmp = new Bitmap(room.Width, room.Height))
	using (Graphics g = Graphics.FromImage(bmp))
	{
		editor.RoomController.DrawRoomBackground(g, 0, 0, j, 1);
		using (MemoryStream pngStream = new MemoryStream())
		{
			bmp.Save(pngStream, ImageFormat.Png);
			output.WriteStartElement("Background");
			output.WriteAttributeString("ID", j.ToString());
			byte[] buf = pngStream.ToArray();
			output.WriteBase64(buf, 0, buf.Length);
			output.WriteEndElement();
		}
	}
}

...to something like this (untested):
Code: ags
for (int j = 0; j < room.BackgroundCount; j++)
{
	using (Bitmap bmp = new Bitmap(room.Width, room.Height))
	using (Graphics g = Graphics.FromImage(bmp))
	{
		editor.RoomController.DrawRoomBackground(g, 0, 0, j, 1);
		bmp.Save("room" + room.Number + "-bg" + j + ".png", ImageFormat.Png);
	}
}

Quote
  • Is it possible to also export the walkable areas, hotspots etc. as .pngs?
Oh, I forgot about those. Hmm. Yes, but with a bit of a complication - that function I'm using above to draw the room background (editor.RoomController.DrawRoomBackground) has some optional parameters at the end I'm not using that add those things - but unfortunately it looks like you can only have them drawn on top of a background image, not just on a black background, so you would have to manually separate the background, which gets even more complicated if your background happens to use the exact same colour as one of the regions...
QuoteDo you have any objection to me playing around with the source code to overcome these minor issues?  The thought occurs that using the Plugin I could automate a whole lot more of the pre-conversion preparation, which would make things even simpler/quicker.  Many thanks for your help!
Please, feel free. I hereby release that export plugin source code as public domain.

Clarvalon

Awesome, you've really helped me out.  I'm not too concerned about WalkableAreas at the moment, as I may just try to use the plugin to export them in an XAGE friendly format (XAGE uses geometric walkboxes rather than masks).

Cheers for releasing the source.  One thing - is there any way of actually debugging the plugin in Visual Studio, or do I have to just keep copying the updated dll to the AGS folder and hope for the best?   
XAGE - Cross-Platform Adventure Game Engine (alpha)

Denzil Quixode

If you have the full version of Visual Studio, you should have an "Attach to Process..." option in the Debug menu. If you compile a Debug version of the DLL, drop that to the editor folder, run the editor then use "Attach to Process..." to attach to AGSEditor.exe, that should let you set breakpoints and stuff. (On the other hand if you're like me and only have the free "Express" edition, you don't have that "Attach" option.)

Knox

Geeze, this is absolutely amazing!

Once this is done, will the AGS community be able to use this? I really really am interested :)

A DS port would be great also...lots of adventure games are being developped on the DS I believe.
:)
--All that is necessary for evil to triumph is for good men to do nothing.

Dualnames

I do know, due to copyright it won't be apossible,but I jsut want to see it on another platform.. :D
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Clarvalon

@Denzil:  Thanks for the clarification.  Unfortunately I've been using Express, though I'll figure something out.  You've given me a lot to work with.

@Knox:  Yes, XAGE will be freely available and completely free to use for non-commercial games, most likely requiring a small license fee for commercial products (or alternatively some sort of profit-share).  As for the DS, I don't know a huge amount about it.  I can understand the appeal of a DS port, but given the legality issues of the homebrew scene and the lack of c#/xna support it's extremely unlikely to happen.

@DN:  I'm happy to try a conversion on one of your Hitchhiker's demos, if you were happy to send me the source.  It might be a while before I get a chance, but I could similarly capture a quick vid of it on the xbox and send you a link to the Silverlight version (as I have done with Ben).  The same goes to anyone else - each conversion improves the process and provides new insights, although the quality of the conversion may vary substantially from game to game.
XAGE - Cross-Platform Adventure Game Engine (alpha)

Dualnames

Quote from: clarvalon on Fri 09/10/2009 15:56:24
@DN:  I'm happy to try a conversion on one of your Hitchhiker's demos, if you were happy to send me the source.  It might be a while before I get a chance, but I could similarly capture a quick vid of it on the xbox and send you a link to the Silverlight version (as I have done with Ben).  The same goes to anyone else - each conversion improves the process and provides new insights, although the quality of the conversion may vary substantially from game to game.

If you can convert it, you can convert about anything in AGS.(NoI'm not bragging about it,it's that it has so many modules and various stuff, and it's a rather large game, that it contains mostly more than the basic AGS script.
Worked on Strangeland, Primordia, Hob's Barrow, The Cat Lady, Mage's Initiation, Until I Have You, Downfall, Hunie Pop, and every game in the Wadjet Eye Games catalogue (porting)

Clarvalon

Quote from: Dualnames on Fri 09/10/2009 16:30:09If you can convert it, you can convert about anything in AGS.(NoI'm not bragging about it,it's that it has so many modules and various stuff, and it's a rather large game, that it contains mostly more than the basic AGS script.

In that case, it sounds like it would be a good candidate in a month or two, when XAGE is a bit more mature. 
XAGE - Cross-Platform Adventure Game Engine (alpha)

Calin Leafshade

What about support for third party plugins?

Will they easily port since they are just windows DLLs?

Also I'd be happy to send you the source to McCarthy if you'd like it.

Clarvalon

Third party plugins are a problem in so far that they are specific to AGS (I'm guessing).  Also Xna has some pretty strict requirements regarding managed code, so it doesn't like anything that isn't written in C#.  Modules should be ok however.

At this stage I've a lot to be getting on with, and I'd like to focus on getting Awakener as robust as possible.  Having said this, I'll be very keen to try out other AGS games in the near future.  To anyone who is interested - feel free to drop me an email clarvalon@live.co.uk and I'll be in touch when I'm in a position to do so.
XAGE - Cross-Platform Adventure Game Engine (alpha)

Ryan Timothy B

Quote[..]I may just try to use the plugin to export them in an XAGE friendly format (XAGE uses geometric walkboxes rather than masks).

I sometimes wonder if geometric walkboxes would be better for ags than masks.  Less information loaded, and probably much easier to calculate walking areas.  It would also be easier for 'us', as the game makers, to readjust the walkable areas if the geometric vertices were movable.

Chrille

This project sounds just fantastic. It's going to be very interesting to see the progress. Good luck!
GASPOP software
http://www.gaspop.com

Wonkyth

Quote from: clarvalon on Fri 09/10/2009 18:22:48
Also Xna has some pretty strict requirements regarding managed code, so it doesn't like anything that isn't written in C#. 

Does that mean that plugins written in C# are okay?
"But with a ninja on your face, you live longer!"

Clarvalon

Probably not, no, come to think of it.  The Xbox360 and Silverlight builds require that all libraries are compiled specific to their platform.  I honestly haven't put a great deal of thought into plugins for XAGE, though it's something I plan on looking at more closely when v1.0 is (finally) out.
XAGE - Cross-Platform Adventure Game Engine (alpha)

RickJ

Sorry to hijack the thread - a little bit ;)  But I just came across a thing called RAGE, Ruby Adventure Game Engine that I thought may be of some interest to folks interested in this thread.  It seems to be an abandoned open source project.   

It's interesting in that if Clavaron is successful with XAGE then it may be possible to do the same or similar thing using Ruby which is cross platform and runs on web servers. I haven't had a chance to download and look at it yet but there is a demo game also.   I don't know if RAGE runs only on the desktop, from a web server, or both?    Anyway her is the link in case anyone is interested.

http://rubyforge.org/projects/librage/


Denzil Quixode

It looks to me like it must be desktop-only, because it says that it uses SDL for graphics and that is not something that works over the Web. (The Ruby language has actually been around since 1995 as an obscure general-purpose scripting language, it's only in the last couple of years that someone said "hey, we could use this to power web applications" and that shot it to fame.)

Clarvalon

AGE, DAGE, J-AGE, XAGE and now RAGE.  We seem to have hit upon a popular naming convention.

In essence, yes, the Export to XAGE plugin could be used to convert the AGS sources to any adventure game engine that was capable of mapping some/all of the functionality.  It pulls the required info from the proprietary formats and stores it in lovely xml & png.  And whilst Silverlight v3.0 isn't quite ubiquitous it allows XAGE to go some way to provide cross-platform browser-based play.

Quote from: Denzil Quixode on Fri 09/10/2009 11:44:04Oh, I forgot about those. Hmm. Yes, but with a bit of a complication - that function I'm using above to draw the room background (editor.RoomController.DrawRoomBackground) has some optional parameters at the end I'm not using that add those things - but unfortunately it looks like you can only have them drawn on top of a background image, not just on a black background, so you would have to manually separate the background, which gets even more complicated if your background happens to use the exact same colour as one of the regions...

I've been looking  at this and have encountered RoomController.GetAreaMaskPixel(), which looks like it will help me pull out hotspots etc., although it will not be able to indicate when hotspots overlap.  I'm not yet sure whether this is ever likely to be a problem.  A more thorough way would be to compare the background bitmap with the background + hotspot bitmap, as you mentioned, though it's a rather expensive.  I'll see how I get on.

XAGE - Cross-Platform Adventure Game Engine (alpha)

SMF spam blocked by CleanTalk