Announcement: Be excellent to each other.


Caravel Forum : Caravel Boards : Development : DROD Display Engine PHP Clone (Boredom)
New Topic New Poll Post Reply
Poster Message
Insane
Level: Master Delver
Avatar
Rank Points: 154
Registered: 08-06-2005
IP: Logged
icon DROD Display Engine PHP Clone (+2)  
So I got bored the other day and decided to start work on this.
I'm aiming for a clone of DROD's room display engine, in php.

Idk what I'm gonna do with it other than have fun, maybe make a small utility to test .tims and styles and apply them to ingame rooms, or perhaps a full-fledged online DROD Hold Editor that outputs .hold files.

I'm not sure, anyway it's a start. I'm using the Silver's Ugly 3.0 mod (based on AlefBet's perl script), and Zch's Graphics Template for graphics as of now, until I can get Caravel permission to display the authentic DROD graphics.

If anybody wants to provide me with perhaps a more clean-looking style, feel free to tell me in this thread. Anyhow right now I've just got the basics done (loading generaltiles and .tim, displaying the room, displaying the walls and shadows correctly, basic room lighting).

Just thought I'd post my WIP here. If anybody wants the source I'd gladly upload it, although it's a bit messy.

Link: http://www.lenigasm.com/drodlib (A new image is generated on each request. Please don't abuse it)

Big Note: If the background of items appear solid, transparency doesn't work, or shadows display incorrectly or are too solid, I'm rewriting all of the loaders to support alpha transparency. You've caught me in the middle of updating.

[Last edited by Insane at 06-16-2009 07:06 PM]
06-16-2009 at 12:47 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts This architect's holds Quote Reply
Insane
Level: Master Delver
Avatar
Rank Points: 154
Registered: 08-06-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (+1)  
Okay, fixed all of the transparency-related issues, now it loads alpha transparency properly and uses a normal imagecopy() function instead of imagecopymerge(), therefore fixing the issue of it not correctly applying alpha transparency.

Now I can work on making pits display correctly, since the issue I had was alpha transparency not correctly copying over onto pits. :3

(That large gray blob you see is a pit, Zch's pits are solid gray. Again, this will look better if I can use different / Caravel's graphics, however I can't release the program with those yet.)

I also added a small performance indicator. The performance actually surprised me, given how many per-pixel floodsearches, copy routines and blending functions I'm performing. Guess I'll have to wait until I add per-pixel lighting to see the performance die a horrible death. ;)

Further notes:

I've also added some minor control, if not only to prove I'm actually generating the images you see.

http://www.lenigasm.com/drodlib/?quality=90&darkness=150

Quality: JPEG Quality, 100 = perfect, 0 = worst (defaults 85)
Darkness: Room darkness, 127 255 = black, 0 = none (defaults 0)

Lights and light sources however are not yet implemented (see my thread in Anything for further info). :3

[Last edited by Insane at 06-17-2009 09:51 PM]
06-16-2009 at 07:54 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts This architect's holds Quote Reply
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
I don't mean to put down your hard efforts, but perhaps you'd have more luck adapting DRODUtil (which this site uses) to display arbitrary images?
06-16-2009 at 11:45 PM
View Profile Show all user's posts Quote Reply
Insane
Level: Master Delver
Avatar
Rank Points: 154
Registered: 08-06-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (+1)  
Not fun imo.

Not really doing this to make something useful, merely doing it since I have too much spare time, and I want to get to know php's imaging functions better as well.

Just thought I'd kinda post the stuff here. :3

And yay I got mike's permission to use DROD's graphics, as long as they're in a protected directory (like they are).

Which means you can now see my ugly unfinished pits. (Commented out the section of the code relevant to the pit walls since I haven't finished any of it, having stopped when I realized I needed to fix alpha). :3

Oh btw,
I'm guessing I'll have to use per-pixel shading for lights and shadows cast by light sources, along with raytracing. I've been thinking at school about how to manually draw a shaded polygon per-pixel. The only methods I can think of involve intense use of trigonometrical calculations for every pixel. Shouldn't there be a fast, easy way to fill a triangle?

Also I think I'll need to use two layers for lighting, a shadow layer and a light layer. The shadow layer which initially takes on the room's global lighting level (black/white/gray for dark/clear/semitransparent), and holds stuff like shadows (black-er areas on the shadow layer), and a light layer which would start out completely transparent and contains the actual "lighting" be it white/red/green, so areas within the light end up tinted that color.

Hmm. Brb trying something on DROD to see how much my approach would differ from DROD's display engine.


..woah it worked. Red light + Blue light + Green light = White area in DROD. Hey cool, that means my implementation would actually be pretty close to DROD's.

Edit: Hmm.. another thing I wonder is how exactly lights affect the brick areas of walls. At first glance it looks like it simply treats these lower halfs as further "floor tiles", illuminating them accordingly, however sometimes the illumination on the walls go outside the normal radius of the light on the floor.

Ex:
 ###
L    (Light source with the weakest strength)


The circle of light seems to have a larger radius on the wall.

[Last edited by Insane at 06-17-2009 12:32 PM]
06-17-2009 at 12:10 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts This architect's holds Quote Reply
Insane
Level: Master Delver
Avatar
Rank Points: 154
Registered: 08-06-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (+1)  
Woohoo, pits work!

Edit: Except for the black line which I just realized DROD draws around the border.

Edit 2: Fix'd.

http://www.lenigasm.com/drodlib/?quality=100 looks like a screenshot taken directly out of the game.

[Last edited by Insane at 06-17-2009 07:34 PM]
06-17-2009 at 07:09 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts This architect's holds Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1228
Registered: 10-14-2006
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
http://www.lenigasm.com/drodlib/?quality=100 looks like a screenshot taken directly out of the game.
IIRC, the DROD client displays shadows more edgy than yours.

[Last edited by slimm tom at 06-17-2009 07:58 PM]
06-17-2009 at 07:54 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
Insane
Level: Master Delver
Avatar
Rank Points: 154
Registered: 08-06-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
JtRH does, TCB doesn't iirc.

(Came across that actually, the JtRH shadows are the edgy ones near the top of GeneralTiles.png, and the rounded TCB shadows are found at the bottom of GeneralTiles.png)

Edit:
Speaking of shadows, I've just finished implementing abovementioned shadow layer, allowing me to do things like apply antialiasing to the finished shadow layer before drawing it, and simultaneously murdering the performance of the script.

http://www.lenigasm.com/drodlib/?antialias=on
http://www.lenigasm.com/drodlib/?antialias=off
(defaults on)

Also note you can use
http://www.lenigasm.com/drodlib/?debug=on
to enable debugging mode (currently debugging my pit scripts)

Oh and full room darkness now takes on a value from 0 to 255, with 255 being completely pitch black.

[Last edited by Insane at 06-17-2009 09:07 PM]
06-17-2009 at 08:15 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts This architect's holds Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1228
Registered: 10-14-2006
IP: Logged
icon Re: DROD Display Engine PHP Clone (+1)  
Strange, I tried it out in the TCB editor and I got the edgy shadows.

EDIT: It depends on the style. City has the curved shadows, but all other styles.

[Last edited by slimm tom at 06-17-2009 09:05 PM]
06-17-2009 at 09:03 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
Insane
Level: Master Delver
Avatar
Rank Points: 154
Registered: 08-06-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
slimm tom wrote:
Strange, I tried it out in the TCB editor and I got the edgy shadows.

EDIT: It depends on the style. City has the curved shadows, but all other styles.

Oh dear, that isn't flawlessly consistent with my version!
Should I make the shadows edgy or use City graphics instead?
06-17-2009 at 09:10 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts This architect's holds Quote Reply
slimm tom
Level: Smitemaster
Avatar
Rank Points: 1228
Registered: 10-14-2006
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
I'd go with making them edgy, as you do not have permission to use the City style.
06-17-2009 at 09:17 PM
View Profile Send Private Message to User Show all user's posts High Scores Quote Reply
Insane
Level: Master Delver
Avatar
Rank Points: 154
Registered: 08-06-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
Done and do-- wait what?

It looked weird being edgy so I quickly loaded up TCB and looked at it using non-City styles (tried all), and I definitely get curvy shadows for all styles.

What version of TCB are you using? I tested using 3.2.1 Build 85, both in the editor and ingame.

[Last edited by Insane at 06-17-2009 09:43 PM]
06-17-2009 at 09:43 PM
View Profile Send Private Message to User Visit Homepage Show all user's posts This architect's holds Quote Reply
Banjooie
Level: Smitemaster
Avatar
Rank Points: 1645
Registered: 12-12-2004
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
NO

This thread is now about http://www.lenigasm.com/

And what the hell is going on on that website.

Okay maybe alternately its own thread but there has to be SOME reckoning here.

Edit: http://forum.caravelgames.com/viewtopic.php?TopicID=29396&page=0#287580 Okay I made a thread for this AND the other thing

we can handle both at the same time I'm too lazy to read two threads.

[Last edited by Banjooie at 06-18-2009 04:45 AM]
06-18-2009 at 04:05 AM
View Profile Send Private Message to User Show all user's posts This architect's holds Quote Reply
coppro
Level: Smitemaster
Rank Points: 1308
Registered: 11-24-2005
IP: Logged
icon Re: DROD Display Engine PHP Clone (+1)  
DROD should use the edgy shadows for non-City styles. I vaguely recall some issue surrounding the use of the demo and shadows, but maybe that was actually water edging.
06-18-2009 at 06:02 AM
View Profile Show all user's posts Quote Reply
mrimer
Level: Legendary Smitemaster
Avatar
Rank Points: 5058
Registered: 02-04-2003
IP: Logged
icon Re: DROD Display Engine PHP Clone (0)  
Yeah, there was one bug with the City (rounded) shadows being used for one or more other styles a while back, but that should be long since fixed.

____________________________
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.
06-23-2009 at 02:47 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
New Topic New Poll Post Reply
Caravel Forum : Caravel Boards : Development : DROD Display Engine PHP Clone (Boredom)
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.