Go Back   RunUO - Ultima Online Emulation > RunUO > Utility Support > Ultima SDK

Ultima SDK Support for the Ultima SDK.

Reply
 
Thread Tools Display Modes
Old 07-17-2004, 11:49 AM   #1 (permalink)
 
Join Date: Nov 2002
Posts: 15
Send a message via AIM to Kinetix
Default Paperdoll Generator using PHP (MyRunUO)

Hi, well... I have searched these forums thoroughly, and have checked out anything regarding MyRunUO. I have been unable to find any posts with any ideas on how to generate a hued paperdoll in PHP.

Any sites I have found in PHP who have a paperdoll generator, have been reluctant to release their code for it.

The closest I got to creating a paperdoll generator in PHP was writing code to read the hues.mul and get the 32bit RGB colors. I took a shot at reading the gumps, but had no success, it was a bit too complicated - seeing as how they had variable length, I just couldn't seem to get the correct properties from the IDX and get it from the MUL.

This whole problem is because my webserver is Linux-based, and therefore I cannot use ASP - let alone ASP.NET - pages on it. As I cannot use ASP, I cannot use the ultima.dll, since PHP cannot load it.

So I am here to ask if anyone has a paperdoll generator for PHP, and would like to release the code for it. I would greatly appreciate it, thanks for your time.
Kinetix is offline   Reply With Quote
Old 07-17-2004, 11:56 AM   #2 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

Its simple what you what doesn't exist, and to do it, won't be easy to make.
Phantom is offline   Reply With Quote
Old 07-17-2004, 12:35 PM   #3 (permalink)
Forum Newbie
 
Join Date: Nov 2002
Posts: 89
Default

Quote:
Originally Posted by Kinetix
This whole problem is because my webserver is Linux-based, and therefore I cannot use ASP - let alone ASP.NET - pages on it. As I cannot use ASP, I cannot use the ultima.dll, since PHP cannot load it.

So I am here to ask if anyone has a paperdoll generator for PHP, and would like to release the code for it. I would greatly appreciate it, thanks for your time.
Can you use C/C++ to get the gumps images back? Or do you require php process the mul files natively? If you just want a library that works on linux as well as windows to access the mul files, you may want to look at the valley library, located at http://www.sf.net/projects/worldmaker .
punt59 is offline   Reply With Quote
Old 07-17-2004, 07:01 PM   #4 (permalink)
 
Join Date: Nov 2002
Posts: 15
Send a message via AIM to Kinetix
Default

If it were in C/C++, it'd have to be a linux executable which I could pass parameters to, and it would create the images I require.

As of now, I'm just linking off-site to riven.ru's paperdoll gump generator. But the problem with this is that they only have their own hues, not mine. So the site generates hundreds of black gumps, as they do not have the same hues.

It has also come to my attention that you can load DLLs in Java. Anyone have insight to this?
Kinetix is offline   Reply With Quote
Old 07-17-2004, 07:08 PM   #5 (permalink)
Forum Newbie
 
Join Date: Nov 2002
Posts: 89
Default

Quote:
Originally Posted by Kinetix
If it were in C/C++, it'd have to be a linux executable which I could pass parameters to, and it would create the images I require.

As of now, I'm just linking off-site to riven.ru's paperdoll gump generator. But the problem with this is that they only have their own hues, not mine. So the site generates hundreds of black gumps, as they do not have the same hues.

It has also come to my attention that you can load DLLs in Java. Anyone have insight to this?
So I must not understand your question. There is a c++ library to get back image data, which workds under windows and linux. Are you asking now for an executable to be made as well? Your original complaint was with ultima being a dll, and not being usable under linux. I am saying there are other libraries that don't require windows. Even if you could have used ultima, you would have had to write a program to use it.

So I am confused.
punt59 is offline   Reply With Quote
Old 07-17-2004, 09:42 PM   #6 (permalink)
Account Terminated
 
Join Date: Sep 2002
Age: 26
Posts: 3,846
Send a message via ICQ to Phantom Send a message via AIM to Phantom Send a message via MSN to Phantom
Default

So you know

Mono as support for ASP

So there is an alternative, you can use mono/asp on linux.

And Ultima.dll should have no problems with Mono, or at least worth a try.
Phantom is offline   Reply With Quote
Old 07-17-2004, 10:04 PM   #7 (permalink)
Forum Newbie
 
Join Date: Nov 2002
Posts: 89
Default How could ultima work under mono?

Quote:
Originally Posted by Phantom
So you know

Mono as support for ASP

So there is an alternative, you can use mono/asp on linux.

And Ultima.dll should have no problems with Mono, or at least worth a try.
Unless mono maped the Bitmap class used by the ultima.dll to GTK+, then I don't understand how it would work (ultima.dll uses directx, which I don't think mono is doing).

Even then, he would have to write a program to use the dll. The issue isnt having available libraires to read the gumps on linux, there are. What isn't clear, is he expecting to have to write a wrapper program to translate it tosome image format, or is he expecting to do that in php ? It sitll isn't clear he he plans on manipulating the mul files from php.
punt59 is offline   Reply With Quote
Old 07-18-2004, 02:18 AM   #8 (permalink)
 
Join Date: Apr 2003
Posts: 32
Default

what i did is letting the runuo server create the images (you can use nearly the same code from the aspx file)

then my php code uses these generated graphics.
Iridath is offline   Reply With Quote
Old 07-18-2004, 10:35 AM   #9 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 485
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

Quote:
Originally Posted by punt
(ultima.dll uses directx, which I don't think mono is doing).
Are you sure about that? I don't remember seeing any references to it in the source code.
__________________
-----------------------
If your response will contribute nothing to this discussion except to insult me, or someone else in this thread, please do not post.
I am refering to specific individuals.
You know who you are.
Bradley is offline   Reply With Quote
Old 07-18-2004, 01:52 PM   #10 (permalink)
I R TEH POSTING!!1!eleven
 
Join Date: Jan 2004
Posts: 1,617
Default

The only system-dependent stuff it uses is in ProcessStream, and it's not even all that much.
__________________
Get your C# documentation today!

Quote:
Originally Posted by Thorax
WOW! that is EXACTLY how i feel, to the T. There is nothing more powerfull than a well worded ass kicking.
badger badger badger badger badger badger badger badger badger badger badger badger...mushroom MUSHROOM
abralka@doramail.com
Ignacio Vazquez-Abrams is offline   Reply With Quote
Old 07-20-2004, 10:39 AM   #11 (permalink)
Forum Novice
 
Join Date: Feb 2003
Posts: 171
Default

Do what OSI does.. A paperdoll background image and html layers for all item layers. You can download all images of all items from OSI's my.uo.com pages...
(Or maybe just create a script which connects to OSI's website, downloads an image and cache it to your website. So u can use it from your webspace in future if needed again..)
zebany is offline   Reply With Quote
Old 07-20-2004, 01:40 PM   #12 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Ultima.dll doesn't use DirectX. Also Krrios released the source for Ultima.dll so you could ultimately recode the parts on your Linux machine. As far as Ultima.dll on Mono, Ultima uses the _lread function which is a native windows API and therefore incompatible with Mono. I remeber that Ultima.dll uses _lread for the tile matrix, and if it uses it for gumps/hues as well you're out of luck. It might be worth a try though.
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 07-20-2004, 09:23 PM   #13 (permalink)
I R TEH POSTING!!1!eleven
 
Join Date: Jan 2004
Posts: 1,617
Default

Quote:
Originally Posted by Arya
I remeber that Ultima.dll uses _lread for the tile matrix, and if it uses it for gumps/hues as well you're out of luck. It might be worth a try though.
That's not what I saw. It uses streams so it should be fine, barring problems with Mono.
__________________
Get your C# documentation today!

Quote:
Originally Posted by Thorax
WOW! that is EXACTLY how i feel, to the T. There is nothing more powerfull than a well worded ass kicking.
badger badger badger badger badger badger badger badger badger badger badger badger...mushroom MUSHROOM
abralka@doramail.com
Ignacio Vazquez-Abrams is offline   Reply With Quote
Old 07-20-2004, 09:40 PM   #14 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 485
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

Quote:
Originally Posted by Ignacio Vazquez-Abrams
That's not what I saw. It uses streams so it should be fine, barring problems with Mono.
snipped from TileMatrixPatch.cs in Ultima.dll
Code:
namespace Ultima
{
	public class TileMatrixPatch
	{
		private int m_LandBlocks, m_StaticBlocks;

		[System.Runtime.InteropServices.DllImport( "Kernel32" )]
		private unsafe static extern int _lread( IntPtr hFile, void *lpBuffer, int wBytes );
It's bring in some windows specific functions from the windows kernel. MONO *minght* be able to pass this off to somethign like Wine, but i doubt it. There are also several kernel32 calls in Processstream. These would all have to be translated to something that MONO could handle.

There are actually quite a few windows specific API calls being made in ultima.dll. Most of them are for dealing with the client however, and could probably easily be stripped form the source code. Art and Gump Code doesn't seem to contain anythign windows specific, so that stuff should eb fine in MONO.
__________________
-----------------------
If your response will contribute nothing to this discussion except to insult me, or someone else in this thread, please do not post.
I am refering to specific individuals.
You know who you are.
Bradley is offline   Reply With Quote
Old 07-21-2004, 08:05 AM   #15 (permalink)
xir
Forum Newbie
 
Join Date: Jul 2004
Posts: 59
Smile

Why must one cling to the Ultima.DLL even when it adds unnecessary complications? Punt's library has a similiar interface and would be much better in this situation. All you need is his valley library and a library such as libjpeg/libpng (there are many more) to convert the parsed mul data to an image format. E.g. http://www.libpng.org You could then execute the binary from the php code to create the image (communicating by passing arguments to the executable). The native binary would be much more efficient/stable than what you can piece together with the DLL and the overhead of Mono. Even if you do decide to use the Ultima.DLL I think this is the only way you can approach it.

If this doesn't suit your needs, you could even create a php wrapper for the extraction of gump data with his library and use the php image functions to create/output the image, as php already has interfaces for the necessary image libraries - http://ie.php.net/gd . This technique would be more efficient in my opinion and I doubt you could do this with the DLL without adding yet another layer of code on top of mono to interface with the module components of php.
http://www.zend.com/apidoc/zend.creating.php documents how to make a module in php.

All this is well and good if you are trying to avoid messing with the mul files yourself, but both techniques require more than is needed than to actually just learn how to parse the gump mul file in the first place with php, which would be the best option. So just dig up the mul documentation, look at a few source examples from different libraries and get coding it in php


Of course the easiest option as I see it for your situation is just to load the parsed image data into a large database and extract as necessary as many times as you like. This would remove the overhead of converting mul format to image format (since its only done once and then stored.) The database size would probably be comparable to the mul size anyway, so you aren't actually using up any more space. With php's database and image extensions, it should be a doddle then to load an image and apply a hue.

They are my suggestions. Sorry for being so verbose, I do tend to get carried away. Anyway, good luck if you plan to give it a go and let us know what you come up with.
xir is offline   Reply With Quote
Old 07-21-2004, 08:36 AM   #16 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 485
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

Quote:
Originally Posted by xir
Why must one cling to the Ultima.DLL even when it adds unnecessary complications?
Cause it's written in .NET and doesn't have the overhead of calling into non-managed code.
__________________
-----------------------
If your response will contribute nothing to this discussion except to insult me, or someone else in this thread, please do not post.
I am refering to specific individuals.
You know who you are.
Bradley is offline   Reply With Quote
Old 07-21-2004, 11:22 AM   #17 (permalink)
xir
Forum Newbie
 
Join Date: Jul 2004
Posts: 59
Default

Quote:
Cause it's written in .NET and doesn't have the overhead of calling into non-managed code.
The "unnecessary complications" I was referring to was in regard to the hassle of getting the DLL to work under mono in Unix when a native library exists that can do the exact job and better under the circumstances available. It's a matter of looking at what is available and using what is best suited for the task at hand. I don't see the need to get something working on an incomplete framework just because you need to run unoptimised managed code. Of course if you feel you must then by all means do so, I am merely offering suggestions on an alternate approach to the problem.
xir is offline   Reply With Quote
Old 07-21-2004, 11:43 AM   #18 (permalink)
I R TEH POSTING!!1!eleven
 
Join Date: Jan 2004
Posts: 1,617
Default

Quote:
Originally Posted by Bradley
snipped from TileMatrixPatch.cs in Ultima.dll
Okay, I stand corrected. But the 2 calls to _lread() could easily be changed into stream read calls. In fact, I don't know why _lread() is used there at all.
__________________
Get your C# documentation today!

Quote:
Originally Posted by Thorax
WOW! that is EXACTLY how i feel, to the T. There is nothing more powerfull than a well worded ass kicking.
badger badger badger badger badger badger badger badger badger badger badger badger...mushroom MUSHROOM
abralka@doramail.com
Ignacio Vazquez-Abrams is offline   Reply With Quote
Old 07-21-2004, 12:41 PM   #19 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Quote:
Originally Posted by Ignacio Vazquez-Abrams
Okay, I stand corrected. But the 2 calls to _lread() could easily be changed into stream read calls. In fact, I don't know why _lread() is used there at all.
The _lread calls are there for performance reasons. This is my guess, but when I was writing the MapViewer control I encountered serious perfomance issues when using .NET streams to read large amount of data (such as the map/statics combo). The only way to make it faster has been to use the ReadFile WinAPI function (which I guess eventually uses _lread). Of course if performance isn't an issue for your application, relatively speaking, you can do just fine with .NET IO.
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 07-21-2004, 03:23 PM   #20 (permalink)
Forum Newbie
 
Join Date: Nov 2002
Posts: 89
Default What is the Bitmap then?

Quote:
Originally Posted by Bradley
Are you sure about that? I don't remember seeing any references to it in the source code.

Ok, perhaps I should have said windows. But art returns things in a Bitmap class, and this isn't C++. That is windows is it not? (showing my ignorance of windows here). I suppose it could have been converted, but my read of mono as them avoiding any windows display stuff.
punt59 is offline   Reply With Quote
Old 07-21-2004, 03:27 PM   #21 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 485
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

Quote:
Originally Posted by punt
Ok, perhaps I should have said windows. But art returns things in a Bitmap class, and this isn't C++. That is windows is it not? (showing my ignorance of windows here). I suppose it could have been converted, but my read of mono as them avoiding any windows display stuff.
I was refering to the DirectX part. There are no references to DirectX anywhere in source code for Ultima.DLL.
__________________
-----------------------
If your response will contribute nothing to this discussion except to insult me, or someone else in this thread, please do not post.
I am refering to specific individuals.
You know who you are.
Bradley is offline   Reply With Quote
Old 07-21-2004, 04:07 PM   #22 (permalink)
Forum Newbie
 
Join Date: Nov 2002
Posts: 89
Default The original problem...

Quote:
Originally Posted by Bradley
Cause it's written in .NET and doesn't have the overhead of calling into non-managed code.

Ok, now I am totally confused. The original problem stated, was accessing the data from php, on a linux server. So NET in this case, is really a foriegn entity, thus I am now very confused on unnecessarly complications, performance, etc, as this seems to just add to it on linux.

But what I am still no clear on, is the basic desire to build the images from the mul files in php? Access them from a database (I saw that posted, so then not sure what the dll has to do with anything), or interface to a C/C++ cgi that uses some library (ultima, etc) to return a png (or whatever format) image?
punt59 is offline   Reply With Quote
Old 07-21-2004, 04:16 PM   #23 (permalink)
 
Join Date: Mar 2003
Location: Near a lava pool
Age: 8
Posts: 1,012
Default

Ultima.dll has all the functions needed to manipulate the objects stored in mul files, converting them to objects that can be easily manipulated (such as bitmaps). Now he would like to use it on a Linux machine, probably because he's familiar with .NET. Someone suggested using a database to store the images, I personally think it's a waste of database space as you can efficiently access the mul files (either using Ultima.dll on a Windows system or on Linux with Mono - except the cases stated before). In ASP.NET this would be very easy to do, he probably wants to do something similar using PHP because it's Linux...
__________________
Oxygen should be regarded as a drug.
Arya is offline   Reply With Quote
Old 07-21-2004, 04:17 PM   #24 (permalink)
Forum Expert
 
Bradley's Avatar
 
Join Date: Oct 2002
Location: Hummelstown, PA
Age: 29
Posts: 485
Send a message via ICQ to Bradley Send a message via AIM to Bradley Send a message via MSN to Bradley Send a message via Yahoo to Bradley
Default

I'm not sure how well the database solution would work. The orriginal request also stated that the images need to have hues aplied to them. I guess that could be done on the fly also, but if you are going to go through the trouble of that, why not just read the mul file?
__________________
-----------------------
If your response will contribute nothing to this discussion except to insult me, or someone else in this thread, please do not post.
I am refering to specific individuals.
You know who you are.
Bradley is offline   Reply With Quote
Old 07-21-2004, 05:12 PM   #25 (permalink)
Forum Newbie
 
Join Date: Nov 2002
Posts: 89
Default

Quote:
Originally Posted by Arya
Ultima.dll has all the functions needed to manipulate the objects stored in mul files, converting them to objects that can be easily manipulated (such as bitmaps).

Ok, so can someone tell me, what is the Bitmap class a part of ? Is it not part of the windows api for display? I didn't peruse most of the ultima source, as it wasn't of much use for me. Is Bitmap one of the class that are part of the dll, and not part of the windows display system?

I have read the mono objectives pretty closely, they seem to have commited to gtk+ for their display system. So can one tell me where they believe mono has picked that up?

As for database, it is large. http://games.gimbo.org/~punt/sform.php is an example of the art work being in a database (the actua png images are stored as blobs). After that, it is all php. But that seems pretty wasteful, I would agree. Hueing to me would be about a wash, but I suppose that depends on if doing in C or php.

The other option, which would work, is just do the entire thing in php.
punt59 is offline   Reply With Quote
Reply

Bookmarks