It is currently 17 Oct 2019, 23:44
   
Text Size

Draft Development in ML 3.0

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

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

Re: Draft Development in ML 3.0

Postby Korath » 22 May 2015, 16:52

That (count != -1) should be (count < 150). I'm amazed it doesn't segfault. (It definitely will overwrite the stack if a player somehow gets more than 100 cards in hand.)

I'd suggest calling gtk_init() just before you first use it, with a static guard so it's only called once. Something like (warning, completely untested)
Code: Select all
int pick_expansions(void)
{
  static int once = 0;
  if (!once)
    {
      int argc = 0;
      gtk_init(&argc, NULL);
      once = 1;
    }
  // gtk_widget_init_template(GTK_WIDGET(win));
  // etc.
}
User avatar
Korath
DEVELOPER
 
Posts: 3412
Joined: 02 Jun 2013, 05:57
Has thanked: 482 times
Been thanked: 950 times

Re: Draft Development in ML 3.0

Postby foolosopher » 07 Jun 2015, 23:14

Thanks for the tip Korath,
I 'll try it as soon as I find some time.
Now, concerning Alara Reborn, the problem is that all cards in this set are multicolored, but code will not select first a multicolored card because it does not have both colours set for the deck, so it will skip it. But this in Alara Reborn will end up skipping all cards, thus resulting in the known error.
Problem is that if there are multicolored cards left in a pack that do not fit both selected colors, code will try to skip them, resulting again in error, but I'll see what I can come up with, but it will surely contain more IFs.
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Draft Development in ML 3.0

Postby foolosopher » 01 Sep 2015, 22:58

Only a few months to fix? a (not so easy?) bug. Anyway now cards with up to two colors will get selected even if player deck has no colors yet. Specifically applies to sets where cards have at least two colors. Tested a bit with Alara Reborn and seemed to work so far.
I got an Air Elemental in a pack from time to time though :?
Heres the code and fixed dll

Bug Hunter feedback welcome.
Any other bugs in draft came up?
Attachments
draft-v26b-two_colours-2015-09-02.txt
(31.98 KiB) Downloaded 133 times
ManalinkEh.zip
(1.95 MiB) Downloaded 134 times
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Draft Development in ML 3.0

Postby Aswan jaguar » 12 Sep 2015, 06:52

Foolosopher is draft gui.exe needed? Is there anything else needed for your changes to work besides latest draft.txt and Manalinkeh.dll?

I am asking because draftgui-v1.exe which seems to be the last when I run it asks at least for a libglib-2.0-0.dll which I don't have.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester
 
Posts: 6582
Joined: 13 May 2010, 12:17
Has thanked: 541 times
Been thanked: 281 times

Re: Draft Development in ML 3.0

Postby foolosopher » 15 Sep 2015, 19:54

No, you don't need draft_gui.exe. The gui has not been integrated yet. You just open magic and select to play draft. I only fixed the bug with having only dual coloured cards to select.
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Draft Development in ML 3.0

Postby foolosopher » 26 Sep 2015, 21:26

hi,
Korath, I tried to make src of Fate Reforged and it seems card_id.h is missing.
Also tried the snippet you suggested above to include gtk gui code in draft but I am still missing gtk libraries from makefile. Any chance that you include them in the make that you have created for manalink (too complex for me #-o ), when you have some time? I compile with

gcc -o draftgui-v1 draftgui-v1.c -mms-bitfields -IC:/gtk/include/gtk-2.0 -IC:/gtk/lib/gtk-2.0/include -IC:/gtk/in
clude/atk-1.0 -IC:/gtk/include/cairo -IC:/gtk/include/gdk-pixbuf-2.0 -IC:/gtk/in
clude/pango-1.0 -IC:/gtk/include/glib-2.0 -IC:/gtk/lib/glib-2.0/include -IC:/gtk
/include -IC:/gtk/include/freetype2 -IC:/gtk/include/libpng14 -LC:/gtk/lib -lgt
k-win32-2.0 -lgdk-win32-2.0 -latk-1.0 -lgio-2.0 -lpangowin32-1.0 -lgdi32 -lpango
cairo-1.0 -lgdk_pixbuf-2.0 -lpango-1.0 -lcairo -lgobject-2.0 -lgmodule-2.0 -lgth
read-2.0 -lglib-2.0 -lintl

thx
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Draft Development in ML 3.0

Postby Korath » 26 Sep 2015, 22:02

card_id.h gets built by running csv2dat.exe in the magic_updater folder. Then copy it over into src/.

All you really need for a one-target makefile like that is
Code: Select all
draftgui-v1: draftgui-v1.c
   gcc -o draftgui-v1 draftgui-v1.c -mms-bitfields #etc etc etc
but if you want something more structured:
Code: Select all
# Tools
CC = gcc

# Paths
GTK = c:/gtk
GTKSUBPATHS = include/gtk-2.0 lib/gtk-2.0/include include/atk-1.0   \
   include/cairo include/gdk-pixbuf-2.0 include/pango-1.0      \
   include/glib-2.0 lib/glib-2.0/include include include/freetype2   \
   include/libpng14
GTKPATHS = $(addprefix $(GTK)/,$(GTKSUBPATHS))
IPATHS = $(GTKPATHS)
LPATHS = $(GTK)/lib

# Libraries
LIBS = gtk-win32-2.0 gdk-win32-2.0 atk-1.0 gio-2.0 pangowin32-1.0 gdi32   \
   pangocairo-1.0 gdk_pixbuf-2.0 pango-1.0 cairo gobject-2.0   \
   gmodule-2.0 gthread-2.0 glib-2.0 intl

# Flags
IFLAGS = $(addprefix -I,$(GTKPATHS))
CFLAGS = -mms-bitfields $(IFLAGS)
LFLAGS = $(addprefix -L,$(LPATHS)) $(addprefix -l,$(LIBS))

all: draftgui-v1

draftgui-v1: draftgui-v1.c
   $(CC) -o $@ $< $(CFLAGS) $(LFLAGS)
User avatar
Korath
DEVELOPER
 
Posts: 3412
Joined: 02 Jun 2013, 05:57
Has thanked: 482 times
Been thanked: 950 times

Re: Draft Development in ML 3.0

Postby foolosopher » 07 Oct 2015, 20:50

That was fast thanks,
I will try to integrate this with the manalink makefile, otherwise I'll probably have to bug you again.
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Draft Development in ML 3.0

Postby foolosopher » 21 Apr 2017, 23:41

Hello hello,
The wind of development finally blew my way, so here I am. Managed to loosely integrate the above GUI that I created "draftgui.exe" in the zip file to provide a more decent GUI for the draft packs set selection.
In order to use it, you have to place the draftgui.exe in your Magic installation folder and replace your ManalinkEh.dll file with the one in the attached zip file.

2017-04-22-draftgui.zip
(2.3 MiB) Downloaded 152 times


This works for the Eldritch-Moon-v2 patch.
Needless to say that you better backup the original ManalinkEh.dll. You also have to install the gtk2+ libraries which you can find in the links below.
official:
http://ftp.gnome.org/mirror/gnome.org/b ... in32/gtk+/
http://ftp.gnome.org/mirror/gnome.org/b ... in64/gtk+/

better choose the latest, but you will have to check how to properly install them (I might provide instructions later if people really need them).
There are installers in the links below

https://sourceforge.net/projects/gtk-win/ x32
https://github.com/tschoonj/GTK-for-Win ... r/releases x64

explanations why the installers are not in the official ftp here:

http://tschoonj.github.io/blog/2014/09/ ... on-github/

How it works:
Once the player selects rarity the GUI is invoked. Then when the player presses the "CLOSE" button the ID of each selected set is written in "draft_selected_sets.txt" one at a row. The draft then reads the IDs from the
file, checks the ID validity and continues as normal. If the file draft_selected_sets.txt does not exist it is created.
In this version of the GUI the names of the sets are read from "menus.txt - @EXPANSIONNAMES" and fed into the GUI.
In the zip file you can also find the GUI code in "draftgui-v1.77-file-clean.c" and the altered draft.c

@korath: I noticed that in the Menus.txt after the label "@CREATURETYPES" there is an empty line and then the creature types are written. I guess this was done by mistake as there is no empty line after all other labels in the menus.txt, although it does not seem to create any problem (yet?).
The whole thing is not very much tested, but it did not cause me any problems. Anyway, I think there is a small corner in the bugs section for draft to report any trouble that you come across.

Finally, regarding the issue with lujo, well "stupidity has no bounds". I really hope that Korath comes back, he is as good as developers and teachers can be, always patient giving very explicit and understandable answers and needless to mention the quality of his work.

Hope everyone is well.
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Draft Development in ML 3.0

Postby Aswan jaguar » 22 Apr 2017, 13:50

Thanks for the new set selection gui foolosopher.
It seems that gui set selection reads from "menus.txt - @EXPANSIONNAMES" but the draft menu for card selection reads from expansions.h.txt and those 2 have different set numbering.So there is a contradiction and others are the sets you select and others the ones you draft from.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester
 
Posts: 6582
Joined: 13 May 2010, 12:17
Has thanked: 541 times
Been thanked: 281 times

Re: Draft Development in ML 3.0

Postby foolosopher » 23 Apr 2017, 22:47

Okay, that was quick. I guess this is what happens when a super tester is checking your programs :P . What was happening is that draft menu IS reading from menus.txt, not expansions.h, but he was starting to get the set names after the first 8 game formats, which he explains at @EXPANSIONCATEGORIES again in menus.txt. Anyway, this should be fixed in the attached zip file below (includes code as well).

2017-04-23-draft-gui-only.zip
(19.91 KiB) Downloaded 76 times
I long for the time where one man could make a difference...
foolosopher
 
Posts: 189
Joined: 19 May 2010, 20:53
Location: Greece
Has thanked: 13 times
Been thanked: 17 times

Re: Draft Development in ML 3.0

Postby Korath » 26 Apr 2017, 01:18

foolosopher wrote:I noticed that in the Menus.txt after the label "@CREATURETYPES" there is an empty line and then the creature types are written. I guess this was done by mistake as there is no empty line after all other labels in the menus.txt, although it does not seem to create any problem (yet?).
It's intentional, since the first valid subtype (SUBTYPE_ALLY) is defined in src/subtypes.h as 1, not 0.
User avatar
Korath
DEVELOPER
 
Posts: 3412
Joined: 02 Jun 2013, 05:57
Has thanked: 482 times
Been thanked: 950 times

Previous

Return to Development

Who is online

Users browsing this forum: No registered users and 1 guest


Who is online

In total there is 1 user online :: 0 registered, 0 hidden and 1 guest (based on users active over the past 10 minutes)
Most users ever online was 287 on 31 Mar 2019, 04:11

Users browsing this forum: No registered users and 1 guest

Login Form