It is currently 07 Sep 2025, 08:07
   
Text Size

2000 cards limit

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

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

Re: 2000 cards limit

Postby gmzombie » 30 Nov 2011, 15:53

ill update the csv when I go home for lunch. do u hace an updated csv2dat u can upload so i can test this new csv so that i dont screw up the csv too much :)
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: 2000 cards limit

Postby Mok » 30 Nov 2011, 16:08

Gargaroz wrote:
Mok wrote:And a nitpick... get_id_by_name? whoa, really I imagine AI is not important but that thing is crazy :P)
I think you've misunderstood : that function is vital for us, as now we have 2 main versions (Costructed and Limited) and two "mod" versions (Golden Years and New Limited), and all share the 2000 card limited, so we need that function to know if a specific card "is there" and make all cards works nicely if they're moved from a version to another.
And I don't really see why this will bother the AI at all. For my part, I constantly working on improving the AI of the new cards coded in C.
Well, the AI is not really making any "decisions" it just attempts to "play" as many card combinations in a limited time (yeah, the time is constant) and then picks the one that got the highest "score". Imagine what happens when it has several cards that use your get_id_by_name, especially checking for the ones that are far in the list. A lot of time "thinking" is wasted by comparing your wanted card name with the whole card list. It's crazy in my opinion :) At least you could have used something like a hash of the name, comparing with a sorted list of hashes for all cards instead of a plain binary compare of each and every card... But as I said, it's just a nitpick :)
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby Mok » 30 Nov 2011, 16:14

gmzombie wrote:ill update the csv when I go home for lunch. do u hace an updated csv2dat u can upload so i can test this new csv so that i dont screw up the csv too much :)
Sure, but the new version is not really different as it only dumps the small coded cards struct for the number of actual cards instead of always 2000, the old one should work too (as far as converting).

Edit: small bugfix update for the converter.
Attachments
csv2dat_v3.rar
(1.87 KiB) Downloaded 356 times
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby Gargaroz » 30 Nov 2011, 16:41

Mok, you've to understant that when me and Jatill go further in the coding process of modern cards, we have no more than 25% of your info on the source.
For example, I had no idea that there was a "time" limit for the AI (a pretty stupid idea for the original programmers, but I guess it was OK for the time ).
So, we tried to do the best we could with the little we have. And I'm perfectly aware that a more expanded card list will render impossible to use the "get_id_by_name" function, but when we'll have an unique CSV, there will be no need to use it, as every card will have his own unique place.
And about this : what we could expect as limit for the expanded CSV ? 65536 cards (8 bit) ? Or more ?
----
- 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: 2000 cards limit

Postby Mok » 30 Nov 2011, 16:51

Gargaroz wrote:Mok, you've to understant that when me and Jatill go further in the coding process of modern cards, we have no more than 25% of your info on the source.
For example, I had no idea that there was a "time" limit for the AI (a pretty stupid idea for the original programmers, but I guess it was OK for the time ).
So, we tried to do the best we could with the little we have. And I'm perfectly aware that a more expanded card list will render impossible to use the "get_id_by_name" function, but when we'll have an unique CSV, there will be no need to use it, as every card will have his own unique place.
And about this : what we could expect as limit for the expanded CSV ? 65536 cards (8 bit) ? Or more ?
Aaaargh, sorry I really was only nitpicking not complaining. Computers at the moment are way faster than 10 years ago anyway and since you didn't notice anything I guess it's not important. But why do you say you have less info? I thought by now someone simply did what I did ie. run magic.exe thru ida and try to decipher it... I'm sure there's a lot of errors in my old code (both in my understanding of the original code and in my additions) as I never was a really good programmer and I hate C.

I think 30000 cards is a good start. I could make it unlimited (probably), but that would require a lot more changes to the code and since CT (card_data_t) was already relocated by someone and is sized for 30000, I'll leave it at that. It's going to be enough hassle to make it work initially :)
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby Gargaroz » 30 Nov 2011, 17:37

No problem, Mok, really, as I'm the completly opposite of you as a programmer : I don't understand a line of ASM and I like C, too bad I'm a n00b (I began programming in C with my first cards for Manalink on 2008). I recently got the decompiled "magic.c" from Jatill, but it's really too complex to understant for my skills.
30.000 cards will be like a dream, I hope we'll succeed !
----
- 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: 2000 cards limit

Postby Mok » 30 Nov 2011, 17:38

Gargaroz wrote:By the way, thanx a lot for the very useful infos, I think the stuff I requested you is either "CT_CardFlags2 dd" or "CT_PlayActivatePhases" in "card_data_t". What exactly they are for ?
TBH I don't remember :) CT_CardFlags2 is defined in your sources as extra_ability but only 1 byte of it while it's an int. I listed the values in my previous mail by mistake writing it's for "static_ability". These are CTF_*. A lot of cards use it for checking for example if a card is a mana source and so on... CT_PlayActivatePhases most likely is a bitfield telling AI when the card can be best used (played or activated)? Don't remember... it's been years.
; enum ACTPHASES (bitfield)
P_BEFORECOMBAT = 1
P_BEFOREBLOCKERS = 2
P_AFTERBLOCKERS = 4
P_AFTERCOMBAT = 8
A_BEFORECOMBAT = 10h
A_BEFOREBLOCKERS = 20h
A_AFTERBLOCKERS = 40h
A_AFTERCOMBAT = 80h
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby Mok » 30 Nov 2011, 17:46

Gargaroz wrote:No problem, Mok, really, as I'm the completly opposite of you as a programmer : I don't understand a line of ASM and I like C, too bad I'm a n00b (I began programming in C with my first cards for Manalink on 2008). I recently got the decompiled "magic.c" from Jatill, but it's really too complex to understant for my skills.
Hm. If someone wanted to decompile the exe to C (there was no decompiler at the time I started), the best bet would be to use original magic.exe from version 1.3 or 1.3.2. The original exe was compiled with no optimizations making a lot of code bloated and hard to read in asm and I ended up rewriting a lot of code or converting to asm macros. This surely looks like **** after decompilation since it was never compiled in the first place. While the original code is not really compatible with todays version, it may look a LOT better when decompiled as it was originally C. But you'd still need to rename/define all the structs/enums/labels before attempting it as the decompiled code with variables like a, b, c and so on is as readable as raw asm :)
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby gmzombie » 30 Nov 2011, 18:54

looks like i might not get a lunch today so with that I will jump on the csv as soon as i get home. as far as the original magic.exe to c I could produce it since i have ida with hex rays addon. i think i might have done this before but there is alot of errors in the data..but I will give it a check if needed. also im excited like a kid at christmas about finslly figuring this problem out
Last edited by gmzombie on 30 Nov 2011, 19:15, edited 1 time in total.
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: 2000 cards limit

Postby Mok » 30 Nov 2011, 19:07

gmzombie wrote:as far as the original magic.exe to c I could produce it since i have ida with hex rays addon. i think i might have done this before but there is alot of errors in the data..but I will give it a check if needed
Nah, I was talking in theory only. Just loading exe and decompiling it is useless without all the labels, function names, structs and enums. It will be hardly readable.
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby 0rion79 » 30 Nov 2011, 20:12

Guys, do you think that game's occasional freezings with AI "still thinking", or weird behavior where the AI doesn't play any card discards basic lands from turn 1, may be connected with get_id_by_name? Even if nowdays computers are much more powerful, the game is still old and hardly can use 100% of that power so maybe the two things may be related.
User avatar
0rion79
 
Posts: 1520
Joined: 24 Feb 2009, 18:33
Location: Italy
Has thanked: 94 times
Been thanked: 61 times

Re: 2000 cards limit

Postby Mok » 30 Nov 2011, 20:43

0rion79 wrote:Guys, do you think that game's occasional freezings with AI "still thinking", or weird behavior where the AI doesn't play any card discards basic lands from turn 1, may be connected with get_id_by_name? Even if nowdays computers are much more powerful, the game is still old and hardly can use 100% of that power so maybe the two things may be related.
I don't think so. Slow AI gets aborted early as there's a fixed time for AI calculation. It's more likely some card is buggy only in AI mode.
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby Mok » 30 Nov 2011, 22:00

gmzombie wrote:I dont know if it would help but i have your original modded deck builder that u made to test db's back then.
Edit: Disregard this. It seems I'm making a mistake somewhere.
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

Re: 2000 cards limit

Postby p0nk0 » 30 Nov 2011, 22:18

Just my 2 cents

First of all I'm not trying to undermine anyone's work on MTG cause everybody who has contributed some code is awesome. I just think since we already have a fast easy way of adding new cards to the system, wouldn't it be better to take the original magic.exe with the original cards mok added and remove the 2000 limitation from there and then add as many cards as we want. I'm not talking about the original version without the graphic improvements or changes that allow card implantations, i'm just talking about using the original card sets that came with mok's version and add on top of that. That way we'd keep less bugs because of errors and from 2001 we can add cards to our hearts desire.

Either way you approach this I am glad for all that you guys have been able to do so far.

I just want to take the oportunity to personally thank you Mok because by the time I discovered your updated version you were already gone from the scene.
p0nk0
 
Posts: 2
Joined: 11 Aug 2008, 23:40
Has thanked: 0 time
Been thanked: 0 time

Re: 2000 cards limit

Postby Mok » 30 Nov 2011, 23:07

p0nk0 wrote:First of all I'm not trying to undermine anyone's work on MTG cause everybody who has contributed some code is awesome. I just think since we already have a fast easy way of adding new cards to the system, wouldn't it be better to take the original magic.exe with the original cards mok added and remove the 2000 limitation from there and then add as many cards as we want. I'm not talking about the original version without the graphic improvements or changes that allow card implantations, i'm just talking about using the original card sets that came with mok's version and add on top of that. That way we'd keep less bugs because of errors and from 2001 we can add cards to our hearts desire.
No, it would require the same amount of work. If I had an intact IDA database from back then, I'd be tempted to port the changes to it and create a clean new exe, but that's impossible. Anyway, I haven't played the new version or even checked it properly... Are there any serious problems there? Checking the amount of added cards/code it seems it's doing great :)
Mok
Programmer
 
Posts: 163
Joined: 23 Nov 2011, 14:28
Has thanked: 1 time
Been thanked: 61 times

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 2 guests

Main Menu

User Menu

Our Partners


Who is online

In total there are 2 users online :: 0 registered, 0 hidden and 2 guests (based on users active over the past 10 minutes)
Most users ever online was 7303 on 15 Jul 2025, 20:46

Users browsing this forum: No registered users and 2 guests

Login Form