It is currently 27 Apr 2024, 10:02
   
Text Size

development questions

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

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

Re: development questions

Postby jatill » 01 Dec 2009, 19:43

Gargaroz wrote:Devour finally implementes properly. However, I was forces to do some tricks, so I don't think the AI would never be able to use it properly.
So far, Tar Fiend and Mycoloth are ready and kicking.
Now I'm going to make Open The Vaults.
Can I see your code? I'm always curious, and can probably offer some good advise. Since you're working on so much standard stuff, maybe you'd like to add the rest of M10 :) Also out of curiousity, were you building the Magical Christmas land deck?
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: development questions

Postby Gargaroz » 01 Dec 2009, 20:21

I PMed you the code, please be merciful.
As for M10, I'm sticking with a "best of" when I evaluate the cards to add. Also, I pretty hate Limited, so don't count on me for more stuff for Draft eheheh ;)
Lastly, can you plese give me the list of that Magical Christmas land deck ?
----
- 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: development questions

Postby jatill » 01 Dec 2009, 20:25

Gargaroz wrote:Lastly, can you plese give me the list of that Magical Christmas land deck ?
http://magicgameplan.com/blog/worlds-20 ... ley-woods/
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: development questions

Postby aww1979 » 18 Mar 2010, 10:39

Referring to http://www.slightlymagic.net/wiki/Codin ... C_Tutorial

Step 10: I don't have perl installed, so this step fails. ('perl' is not recognized as an internal or external command, operable program or batch file.) Is there a particular version I should get or anything, or somewhere I can get build.pl already compiled?
aww1979
Tester
 
Posts: 1717
Joined: 03 Mar 2009, 19:36
Has thanked: 0 time
Been thanked: 2 times

Re: development questions

Postby jatill » 18 Mar 2010, 12:07

Step 2 was:
Download and install Camelbox (http://www.softpedia.com/progDownload/C ... 05269.html)
This should have included perl. Try running build from camelbox/bin
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: development questions

Postby aww1979 » 18 Mar 2010, 17:25

Okay, I'll have to try that again then. I'm not sure what I did wrong yet :p

edit: Okay, installing the stuff at that link put perl on; maybe I didn't check the box while installing camelbox or whatever. Anyway, I have several errors that come up when I run perl build.pl, all found in cards.c They relate to 'step', 'STEP_DRAW', 'STEP_UPKEEP', 'target_player', STEP_MAIN1', 'STEP_MAIN2', 'STATIC_TRAMPLE'. There are also some warnings regarding 'vigilence' (spelled like that) and wilt_leaf_cavaliers.

Any ideas? If not, I can try and figure it out on my own, but I figured if you can spot my mistake in a few minutes, it might save me hours :p
aww1979
Tester
 
Posts: 1717
Joined: 03 Mar 2009, 19:36
Has thanked: 0 time
Been thanked: 2 times

Re: development questions

Postby jatill » 19 Mar 2010, 14:40

I would delete all your source files and put them back. If you happen to have old version of some files that never got delete, you'll have issues.
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: development questions

Postby aww1979 » 20 Mar 2010, 19:23

How do I know which of the source files are old? I deleted all the ones I'd put into the camelbox directories, and copied all the ones from my Magic directories, and I had exactly the same set of errors. All of the errors that came up were in the file cards.c, but if I remove that file, I get pages of errors because cards.c is including manalink.h which has a lot of functions, and without manalink.h, it doesn't know what any of them are and all show as errors. I have (to the best of my knowledge) the newest version of manalink (Valentine's Day Massacre)
aww1979
Tester
 
Posts: 1717
Joined: 03 Mar 2009, 19:36
Has thanked: 0 time
Been thanked: 2 times

Re: development questions

Postby Snacko » 20 Mar 2010, 21:08

20100222.zip version doesn't compile for different reasons. Mostly those are array out of bonds, as a[4] means there's only 0-3 items while you use 0-4. This means you overwrite some memory!

I've fixed those errors
Patch is available here
Full fixed source here
Snacko
DEVELOPER
 
Posts: 826
Joined: 29 May 2008, 19:35
Has thanked: 4 times
Been thanked: 74 times

Re: development questions

Postby jatill » 22 Mar 2010, 12:29

Thanks for the fix. Any idea why I never got those errors when compiling?
Also, can you point me to one specific place there was an error? Thanks.
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: development questions

Postby Snacko » 22 Mar 2010, 15:35

Patch file has line numbers and + / - when something was added or removed.

Are you sure you use the same Makefile as the perl script uses that to compile the whole thing, and that's where compiler flags to detect coding errors are.


Code: Select all
-                    if( instance->targets[19].player < 0 ){
-                        instance->targets[19].player = 0;
+                    if( instance->parent_controller < 0 ){
+                        instance->parent_controller = 0;
                     }
targets has only 19 elements 0-18; this works as the 2 variables that come after the array have the same composition, but you shouldn't do it this way

Code: Select all
-            int scores[2];
+            int scores[2] = { 0 };
             score += 1
You shouldn't reference undefined arrays as they don't have to be zeroed!

Code: Select all
-    int mana[4];
+    int mana[5];
 
     for( x = 0 ;x < 5;x++){
         mana[x] = 0;
Need 5 items from 0-4. Here you reference out of array memory, so basically you overwrite some other data!
Snacko
DEVELOPER
 
Posts: 826
Joined: 29 May 2008, 19:35
Has thanked: 4 times
Been thanked: 74 times

Re: development questions

Postby aww1979 » 24 Mar 2010, 18:19

Using those files didn't fix any of the errors I was getting. If I can actually figure out how to get the stupid thing to compile, I'd be interested in doing some coding. If I cannot get it to compile, I could just study the functions that have been written and write some code for cards, but someone else would have to actually compile it to make sure it really works.
aww1979
Tester
 
Posts: 1717
Joined: 03 Mar 2009, 19:36
Has thanked: 0 time
Been thanked: 2 times

Re: development questions

Postby jatill » 25 Mar 2010, 12:01

Specifically what errors do you get?
jatill
DEVELOPER
 
Posts: 2118
Joined: 24 Feb 2009, 16:35
Has thanked: 5 times
Been thanked: 17 times

Re: development questions

Postby aww1979 » 26 Mar 2010, 22:58

I don't remember anymore... there were about a dozen of them, where it either couldn't find or found multiple copies of things like STEP_UPKEEP, STEP_DRAW, VIGILENCE (spelled like that) and a few others.

Anyway, the reason I don't post the exact errors now is because I got it to compile :p I went here: viewtopic.php?f=25&t=2400 that stassy posted and downloaded the one called 'code', deleted camelbox/bin/card and bin/function, put card & function from 'code' in their place, and put the yasm and makefile and all that stuff into the bin directory, ran perl build.pl, and no errors/warnings were given :D

So, my guess is that Jatill was right when he said I had obsolete source files somewhere, but I was completely unable to determine which ones they were, since they are also in my magic directory. Stassy's 'code' file let me start from scratch and that solved it.

I'm pretty sure I can figure things out on my own now; this was the hardest part, in my mind :p I have coded in C++ before, so I won't be a complete n00b, though I'm hardly an expert at it.
aww1979
Tester
 
Posts: 1717
Joined: 03 Mar 2009, 19:36
Has thanked: 0 time
Been thanked: 2 times

Re: development questions

Postby aww1979 » 30 Mar 2010, 05:44

A few questions regarding the coding of level 0 cards:

1) Can I use a text editor to just delete a whole bunch of cards to make room for practice cards I want to create, or are there additional steps I'd have to go through? I couldn't follow the steps exactly because all the csv slots are filled, so I wanted to make room. (Step 3 says to find the highest ID and go to the next one, but there is no next one; I just tried to overwrite Raging Goblin instead)

2) This is probably because all 1998 slots are filled, but step 28 in coding level 0 cards says "Now for the odd part. Search for the card with the ID one less than your card's ID. Scroll down one more spot on the left and you should see 'Dummy'. Singleclick 'Dummy'. " and when I do this (for instance, Raging Gobin is ID#1122, I go back to 1121, and that is Pyroclasm.) Dummy is not there. There are a *lot* of ID#916:Dummy at the bottom, should I use one of those instead for this step?

3) This might be because of my failure in 1) and 2), but none of the changes I make seem to stick, even though I save them. I tried purposely messing up Air Elemental's stats in the csv, but it still had the proper stats ingame. This is quite possibly related to...

4) When I run csv2dat.exe, I get an error as follows:

ERROR at offset 0xD754B! (it also makes a beeping sound and closes the dos window very fast; I used a screen capture and pasted the image into paint so I could actually read it :p)

I don't know what this means, but it is not the same hex number as the code pointer for Raging Goblin.
aww1979
Tester
 
Posts: 1717
Joined: 03 Mar 2009, 19:36
Has thanked: 0 time
Been thanked: 2 times

PreviousNext

Return to Development

Who is online

Users browsing this forum: No registered users and 39 guests


Who is online

In total there are 39 users online :: 0 registered, 0 hidden and 39 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 39 guests

Login Form