It is currently 16 Apr 2024, 05:58
   
Text Size

Drawcardlib revisited

Discuss Upcoming Releases, Coding New Cards, Etc.
PLEASE DO NOT REPORT BUGS HERE!

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

Drawcardlib revisited

Postby Korath » 12 Jul 2013, 19:04

So yeah. This is both a less and more ambitious project than Snacko's version here. I'm not attempting to rewrite from scratch like he did, instead working with a straightforward translation of Mok's version (about half of which was lifted untouched from the exe, I'm given to understand) into C so that I could get to writing Shiny New Features with as little time and effort spent beforehand as possible.

Right now, everything seems functional, though the Shiny New Features are still neither as shiny nor as numerous as I'd like. The stable version is distributed in the latest mainline patch. Known bugs in that version:
  • The ArtOutline options don't reliably draw their outline exactly on the edge of the art.
  • If image files specified in Duel.dat are missing, they're displayed one at a time at startup instead of all at once, and you can't abort the list.
  • Source code was omitted from the patch; it's attached below. (You don't need to download it unless you're curious how this all works, though.)
Features in the stable version:
  1. Most all of the hardcoded numbers can be changed in DuelArt/Duel.dat. (It should work fine with an unupdated duel.dat, though.) This includes positioning of all the card elements, text colors, shadow visibility, corner rounding radius, border color, you name it.
  2. Support for the power/toughness boxes in modern frames. The power/toughness numerals can be set to be drawn centered within their bounding box in duel.dat, and there's an option to display a color-appropriate background image whenever numerals are drawn. Since I'm not an artist, the included image is useful only as a proof-of-concept, and so is disabled in duel.dat.
  3. Text in fullcard titles and type-lines was either normal width, quite narrow, or unbelievably narrow, depending on whether it fit. I've added six more widths, three each on either side of quite narrow.
  4. Rarity/expansion symbols. These can also be drawn on smallcards (by default, they aren't), and the choice of which icon to display can be configured somewhat flexibly within the Duel.Dat file. This requires a file "expansion_symbols.pic" in your CardArt directory; as usual, it may be a Microprose .pic file, a bmp, a jpg, or a png, but has to be named as .pic. The one I've attached below is based on BaconCatBug's Set and Mana Symbol Megapack, Modern Style; any ugliness is solely my fault.
  5. Watermarks for the ten Ravnica guilds, Phyrexian, and Mirran. If someone wants the newer versions of the guild watermarks that were used in the Return to Ravnica block enough to make the imagery for them, let me know and I'll send you watermarks.pic's source psd. Getting them to look reasonably good without including a different version for each for every background they can appear on is a pain, though; I'm washing my hands of it.
  6. Lands are drawn according to the colors of mana they can produce - previously, only the five basic lands were colored, and all the rest were drawn the same. (The large mana symbols for basic lands are drawn the same way watermarks are. Though, obviously, they're a lot more opaque.)
  7. Horizontal blending for hybrid frames ( Gruul Guildmage ), two-color lands ( Rootbound Crag ), two-color artifacts ( Mage Slayer ), and two-color gold cards ( Apocalypse Hydra ). There's also options to draw all two-color multicolor cards with the hybrid frame (if, like me, you've always hated the gold frame), or to do so only with multicolor cards whose colors have changed from their default (like a red creature enchanted by Ghoulflesh - it would then be drawn like Ashenmoor Gouger instead of Acidic Sliver ).
  8. An experimental option to draw colorless non-artifact cards (like eldrazi) over the whole card frame, with a couple variants to try to make them look ok despite not having full card art for them (and no easy way to access it if we did).
  9. A similar option to do the same for face-down morph cards, which works a lot better.
  10. A couple different ways to draw artifact lands, so (for example) you can tell which ones have been affected by Memnarch. The default is to draw them like normal lands, the same way as Darksteel Citadel and the Ancient Den cycle were printed.
  11. Frames are drawn to the screen with bicubic filtering, so (especially at high resolution and with smallish images) we don't get the horrid artifacts from the nearest-neighbor filtering previously used. On the other hand, there's a bit of fuzziness (especially at high resolution and with smallish images).
  12. All frames (except for the orange frame for effect cards and, optionally, the translucent frame for colorless eldrazi) are composed of at least two source images, whose locations can be configured in Duel.dat. Besides reducing the total number of image files you need to store for the new variants, this will let you try out different mods without having to overwrite your current frames. I've included frame artwork based on Sonic's Manalink3 Makeover, which is what most people seem to use; it works very well for the modern frames, and not quite so well for the classic ones. (The textboxes for the green and black cards are difficult to deal with.) There's also a sample configuration that uses the previous imagery - this won't be able to handle all the new frame types (two-color gold cards will look like the three-color frame, for example), but it's fairly close.
  13. [FullCard]ArtFirst and [SmallCard]ArtFirst, which draws artwork behind the frames (which, obviously, need transparent holes cut into them) instead of on top of them, as a replacement for the mostly unfixable ArtOutline options.
  14. [FullCard]ColorlessAlpha, which, if TranslucentColorless is set, lets the transparency of CardOv_Colorless be adjusted in Duel.dat rather than having to edit the image.
  15. Any images specified in Duel.dat that don't exist are shown at startup, along with the option that tried to load them.
  16. Support for the tombstone icon used around the Odyssey block. If enabled for a frametype, it gets put on all cards with graveyard abilities (like Nether Shadow and Bridge from Below ), not just the handful it was actually printed on.
  17. Nyx frames for the Theros expansion, drawn on all permanents that are both enchantments and some other type (besides tribal). For now, cards that are printed enchantment/something-else are set in watermarks.csv so they can be found outside of the game (like in the deckbuilder).
  18. Simultaneous display of different frame types. I've got templates for classic, modern, Planar Chaos timeshifted, Future Sight futureshifted, planeswalker (missing loyalty symbols and horizontal dividers), and modern token (missing top plaque) frames so far. They're configured by adding frame-specific sections to Duel.dat: for example, planeswalker frames use any options set in [FullCardPlaneswalker], [SmallCardPlaneswalker], and [FramesPlaneswalker], falling back to [FullCard], [SmallCard], and [Frames] for options that aren't set. The [Expansions] section can't be customized in a frame type, since it determines what frame type to use; and the [fonts] section can't be overridden yet.
  19. [Expansions]ForceFrame option, which is primarily for testing, but can also be used to make everything use classic frames if you're so inclined.
Attachments
drawcardlib-src-PtT.zip
Drawcardlib source code, stable version, Portal to Theros
(41.74 KiB) Downloaded 616 times
Last edited by Korath on 16 Nov 2013, 17:45, edited 8 times in total.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: Drawcardlib revisited

Postby gmzombie » 12 Jul 2013, 23:26

I am excited to say the least!
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 857
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 200 times
Been thanked: 51 times

Re: Drawcardlib revisited

Postby Sonic » 13 Jul 2013, 10:13

gmzombie wrote:I am excited to say the least!
+1
Oh the possibilities... :partyman:
Working On: Life, the Universe, and Everything.
User avatar
Sonic
Apprentice
 
Posts: 827
Joined: 27 Feb 2010, 00:37
Has thanked: 3 times
Been thanked: 161 times

Re: Drawcardlib revisited

Postby Gargaroz » 13 Jul 2013, 13:54

Argh, I missed this ! Too bad, it'll go in the V2 or in the M14 patch, sorry guys.
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7097
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 595 times

Re: Drawcardlib revisited

Postby gmzombie » 13 Jul 2013, 17:19

its ok we can still use it. :)


edit: figured it out
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 857
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 200 times
Been thanked: 51 times

Re: Drawcardlib revisited

Postby Sonic » 13 Jul 2013, 18:59

gmzombie wrote:edit: figured it out
I'm on it. Got a working template up and running - currently working on the element positioning and resizing in the big card in the deck builder.
Small card stuff is a bit bit of a brain bender though - I'm not so hot on the maths.

Anyway, pics later.

Oh yeah, and by the way.

Korath ROCKS! :supz:
Working On: Life, the Universe, and Everything.
User avatar
Sonic
Apprentice
 
Posts: 827
Joined: 27 Feb 2010, 00:37
Has thanked: 3 times
Been thanked: 161 times

Re: Drawcardlib revisited

Postby gmzombie » 13 Jul 2013, 19:56

Sonic wrote:
gmzombie wrote:edit: figured it out
I'm on it. Got a working template up and running - currently working on the element positioning and resizing in the big card in the deck builder.
Small card stuff is a bit bit of a brain bender though - I'm not so hot on the maths.

Anyway, pics later.

Oh yeah, and by the way.

Korath ROCKS! :supz:
yea I just finished up the duel.dat for expanding out the art just a bit to make them look just like the modern cards now here is a pic. Now the fun part editing all the cardbk files. do you have any done yet sonic? i got 2 done so far. here is my modified duel.dat file now also

edit: got the cardart done. see if you like it.
Attachments
CardArt.rar
new cardart back
(989.76 KiB) Downloaded 578 times
Duel.rar
(3.31 KiB) Downloaded 580 times
screenshot.2.jpg
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 857
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 200 times
Been thanked: 51 times

Re: Drawcardlib revisited

Postby Sonic » 13 Jul 2013, 23:20

This is what I've got so far.

Image

I decided to completely redraw and resize the template. The images are now exactly the same size as the large card in the Deck Builder - so there's no resizing and the image is pixel sharp. Damn the file size. :wink:

I've had to alter the P/T box strip as well as it needs to be wider that the paper stock equivalent to accommodate the longest P/T text string - it currently correctly positioned, but the strip isn't colored yet.

Still have the text positioning and the expanding text to work on yet - but the overall look isn't too bad so far.
Working On: Life, the Universe, and Everything.
User avatar
Sonic
Apprentice
 
Posts: 827
Joined: 27 Feb 2010, 00:37
Has thanked: 3 times
Been thanked: 161 times

Re: Drawcardlib revisited

Postby gmzombie » 14 Jul 2013, 01:57

oh how i would like that. This is great ive been waiting for a remake of these. by the way what font are u using on titles cause it looks exact to the cards.
Also does that make the small pics look different on the top? you got a pic of that too?
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 857
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 200 times
Been thanked: 51 times

Re: Drawcardlib revisited

Postby Sonic » 14 Jul 2013, 04:04

gmzombie wrote:by the way what font are u using on titles cause it looks exact to the cards.
Also does that make the small pics look different on the top? you got a pic of that too?
It's the same font I posted with the interim templates the other day. It's based on the font used in the magic set editor, but I modified it due to the spacing being too large for the manalink templates and some of the glyph alignments being a little suspect.

No pics of the small card yet - having problems trying to get my head round these small card alignments. :-k
Working On: Life, the Universe, and Everything.
User avatar
Sonic
Apprentice
 
Posts: 827
Joined: 27 Feb 2010, 00:37
Has thanked: 3 times
Been thanked: 161 times

Re: Drawcardlib revisited

Postby gmzombie » 14 Jul 2013, 04:38

when i eyeballed it if you look at mine i just had open the duel.dat and kept saving then openeing up deck.exe to look at it,
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 857
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 200 times
Been thanked: 51 times

Re: Drawcardlib revisited

Postby Korath » 14 Jul 2013, 08:57

Sonic wrote:The images are now exactly the same size as the large card in the Deck Builder - so there's no resizing and the image is pixel sharp.
At what resolution, though? With or without the start menu bar at the bottom of the screen? If so, what height is your start menu bar, since it varies with different versions of Windows? And are you using anything to get rid of the window edges?

What's pixel-exact for you now won't necessarily remain so forever. And it almost certainly won't be for anyone else.
Attachments
edge.jpg
edge.jpg (9.8 KiB) Viewed 10553 times
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: Drawcardlib revisited

Postby Sonic » 14 Jul 2013, 23:21

Korath wrote:
Sonic wrote:The images are now exactly the same size as the large card in the Deck Builder - so there's no resizing and the image is pixel sharp.
At what resolution, though? With or without the start menu bar at the bottom of the screen? If so, what height is your start menu bar, since it varies with different versions of Windows? And are you using anything to get rid of the window edges?

What's pixel-exact for you now won't necessarily remain so forever. And it almost certainly won't be for anyone else.
Oh I realize that - it's just working WYSIWYG is somewhat easier when you're trying to work out exactly what's going on. And the fact I'm limited to working on an old 19" CRT I can't really tell what the templates will look like on a widescreen monitor anyway.

I know a few of the regular guys run the game at 1280x1024 in a window above the menu, so it seemed like a good place to start from.

Although, I suppose logically it would have been better to enquire from the guy who did the mod: Is there an optimum dimension/ratio for the card pics? O:)
Working On: Life, the Universe, and Everything.
User avatar
Sonic
Apprentice
 
Posts: 827
Joined: 27 Feb 2010, 00:37
Has thanked: 3 times
Been thanked: 161 times

Re: Drawcardlib revisited

Postby gmzombie » 15 Jul 2013, 03:31

how about the other question to Korath. is there any way to make that small card smaller? i dont know if you came across that or not in your modding of this as i seen you talk about a 800x1120 in the duel.dat. i dont know if there was anything to that automatic scaling of pics. anyways still great job so far im loving it.
can I maze of ith your snowstorm?

http://home.comcast.net/~gmzombie/index.html old stuff in here. don't use this stuff right now till I get time to get back into it and readjust.
gmzombie
 
Posts: 857
Joined: 26 Feb 2009, 01:05
Location: Wyoming, Mi
Has thanked: 200 times
Been thanked: 51 times

Re: Drawcardlib revisited

Postby Korath » 15 Jul 2013, 11:43

Sonic wrote:Although, I suppose logically it would have been better to enquire from the guy who did the mod: Is there an optimum dimension/ratio for the card pics? O:)
There really isn't.

Normally any source at least as large as the target area will do, but sometimes StretchBlt - the drawing function used in most places to copy an image to its destination, resizing it along the way - falls back to nearest-neighbor interpolation instead of bilinear, seemingly at random. (It's more likely if the source or destination are small, which is why ability icons that aren't the exact same size in Abilities.bmp as they're eventually displayed on-screen tend to look ugly.) A few things had already been rewritten to use the GdiPlus API, like the images in Manasymbols.pic, but I've left the prior calls alone for now.

What's important is that you test at as many different sizes as possible, so you can be sure that your positioning is rounded correctly when it's transformed from logical coordinates (the 800x1200 large cards and 800x1120 small cards I talk about in Duel.dat) to screen coordinates (e.g., 355x533 large cards and 194x194 small cards in the deckbuilder at 1980x1080 resolution).
gmzombie wrote:is there any way to make that small card smaller?
It's set in the exe. I haven't found where yet.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Next

Return to Development

Who is online

Users browsing this forum: No registered users and 20 guests


Who is online

In total there are 20 users online :: 0 registered, 0 hidden and 20 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 20 guests

Login Form