It is currently 16 Apr 2024, 18:13
   
Text Size

Writing Magarena-code ...

Moderators: ubeefx, beholder, melvin, ShawnieBoy, Lodici, CCGHQ Admins

Writing Magarena-code ...

Postby shogi4fun » 02 Nov 2011, 19:24

Hi,

I've read here, here and read at least the topic-name here, but don't got an answer, about the following: how are the Magarena-developers working?

Are there given different tasks to different persons, so not many persons doing the same work? And also I think it would be better, of only one person is changing one file at the same time, even I know, that diff would be also working with mixed changes? Are the others checking the code, if there are bugs, checking for good-style, or "only" testing by playing?

Reason for my questions: I've changed the code - my first Java-code. :D
BUT (!!!) I like NOT step deeper into it, taking time to understand the code to make bigger changes.
But maybe the answer could be interesting for others, more familar with java ...

And maybe (probably) a person who had already worked on ExplorerPanel.java could make the changes themself easier and faster, than checking my lines. :wink:

Nevertheless, here are my changes: only very little modifications on 3 parts. With it, card-count will also be shown for the Card Pool (like for the deck).

Bernhard
Attachments
BCM.txt
diff to ExplorerPanel.java (dc227eb3abee)
(558 Bytes) Downloaded 328 times
shogi4fun
 
Posts: 11
Joined: 14 Oct 2011, 05:46
Has thanked: 0 time
Been thanked: 0 time

Re: Writing Magarena-code ...

Postby ubeefx » 02 Nov 2011, 19:46

Hi Bernhard

I do not think anyone has to work on something specific, you can do what you like to improve the game.
Currently Melvin works mainly on engine improvements, beholder on adding cards and wait321 on the user interface.

Best is to ask for commit rights to Melvin and then use for instance TortoiseHg to commit your changes to the code.
That will be much easier than posting code snippets on the forum. You can use Eclipse or something else to edit the Java code.
This certainly looks like a nice way to learn Java.

Just have fun doing so, that is what matters! :)
User avatar
ubeefx
DEVELOPER
 
Posts: 748
Joined: 23 Nov 2010, 19:16
Has thanked: 34 times
Been thanked: 249 times

Re: Writing Magarena-code ...

Postby melvin » 03 Nov 2011, 02:05

Hi Bernhard,

Thanks for the patch, Bernhard. I've applied it to my source tree. I wasn't able to apply your patch automatically, so I had to type in your changes manually. Please help to double check if I've made the right change at http://code.google.com/p/magarena/sourc ... 43824a7ddc

As you can see, applying the changes manually can be rather error prone, that is why we recommend that you manage your source code with mercurial.

1. The easiest way to get started is to create a server side clone via http://code.google.com/p/magarena/source/clones and then push your changes to your personal clone.

2. Then make an announcement in the google group once you have a complete implementation of some feature/modification.

3. One of the devs with commit access to the main repository can then pull your changes to the main repo.

4. Subsequently, one of the admins will add you as a committer to the main repo so you can push your changes there directly.

Magarena is a fairly young open source project, we are still figuring out what is the best way to organize the dev community.

Are there given different tasks to different persons, so not many persons doing the same work?
Sort of, we self organize by discussing changes to be made in our developer mailing list on google groups.

And also I think it would be better, of only one person is changing one file at the same time, even I know, that diff would be also working with mixed changes?
We haven't had any trouble so far as mercurial allows us to work in isolated branches and merge changes easily and generally we work in different areas of the code.

Are the others checking the code, if there are bugs, checking for good-style, or "only" testing by playing?
Unfortunately we do not have any automated tests yet, so we mostly check by play testing.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times

Re: Writing Magarena-code ...

Postby shogi4fun » 03 Nov 2011, 09:12

Hi Melvin,
melvin wrote:Thanks for the patch, Bernhard.
I'm happy that you like it. :D
I still was wondering, why the count was only shown for decks and not for the pool. Maybe when it was first created, there were so less cards available, that you thought blaming to show the count. :wink:
I've applied it to my source tree. I wasn't able to apply your patch automatically,
Still it's absolutely unimportant, I like to know the reason for it.
(And while thinking best english translation for "Neugierig", do you plan about localization/translation of Magarena - not that I would need it?)

Testing it here (using cygwin) it works very well.
(patch ExplorerPanel.java < BCM.txt)

I assume the problem for you was the (neverending) thing with CR/LF.
Yesterday I'd downloaded the file from magarena.googlecode.com again (to have a clean version) and used diff - done all on Ubuntu.
EVEN I'd done all on this system, I recognize now that ExplorerPanel.java seems to has CR+LF, while the generated diff has only LF (even I can see the reason for it, it's not nice :( )
Maybe your patch-program isn't able to use LF-only files?
so I had to type in your changes manually. Please help to double check if I've made the right change at http://code.google.com/p/magarena/sourc ... 43824a7ddc
Can test it only at evening, but looking at it, all seems very well (still it's only a very little change).

There are only "cosmetic" things:
I'd put the sub "generatePoolTitle()" directly below (or directly above also okay) "generateDeckTitle(MagicDeck deck)", because this two subs are almost the same (I'd still thought using only one sub, where checking if the deck is the cardPool giving an other name, but than I thought that with "Deck" you are not speaking about "CardPool").

I see, you added "private".
I missed it, because the sub "generateDeckTitle(MagicDeck deck)" (which I copied to use as basic) also miss it. So it should be added there too. :wink:
1. The easiest way to get started is to create a server side clone via http://code.google.com/p/magarena/source/clones and then push your changes to your personal clone.
...
Thanks for the further infos.
shogi4fun
 
Posts: 11
Joined: 14 Oct 2011, 05:46
Has thanked: 0 time
Been thanked: 0 time

Re: Writing Magarena-code ...

Postby beholder » 03 Nov 2011, 11:00

Ah yes, I'm the one that adds cards and introduces bugs :) Anyway ...

The patch you provided was a text file when a .diff file was expected. That's why Melvin did it manually. The code changes look fine to me.
shogi4fun wrote:And while thinking best english translation for "Neugierig"
Das ist einfach, neugierig == curious :wink:

shogi4fun wrote:Are the others checking the code, if there are bugs, checking for good-style, or "only" testing by playing?
I do read most of the code changes that others submit and look for obvious errors. When I'm not certain about code I changed, I email one of the devs with a request for review.
I should play test more and program less, hehe.
If debugging is the process of removing bugs, then programming must be the process of putting them in.
User avatar
beholder
Programmer
 
Posts: 123
Joined: 17 Jul 2011, 17:56
Location: Netherlands
Has thanked: 16 times
Been thanked: 25 times

Re: Writing Magarena-code ...

Postby shogi4fun » 03 Nov 2011, 11:17

beholder wrote:The patch you provided was a text file when a .diff file was expected. That's why Melvin did it manually.
Ah, thanks for the info.
Still I initialy named it ".dif", but I was not allowed to upload files with such extension here :( , so I thought about zipping it, but decided first to try txt extension instead.
The code changes look fine to me.
Thanks.
My first java-lines. :D
But nevertheless I can't see any difference to C-lines in this case. :wink:
shogi4fun wrote:And while thinking best english translation for "Neugierig"
Das ist einfach, neugierig == curious :wink:
Danke.

Hört sich nach "kurios" an (was ebenso in der Übersetzung angegeben wird) und das wäre wohl nicht so passend. Vermutlich hat mich diese Tatsache daran gehindert dieses Wort zu verwenden, aber jetzt weiß ich es besser. :)
I do read most of the code changes that others submit and look for obvious errors.
Fine - good things.

I'd never known about coding in groups and asked, how this should work best, if "every" beginner can change code.
I should play test more and program less, hehe.
I know this also very well.
Still having fun in coding (but C/C++ :wink: ), I'd written code I don't need, only for fun.
shogi4fun
 
Posts: 11
Joined: 14 Oct 2011, 05:46
Has thanked: 0 time
Been thanked: 0 time

Re: Writing Magarena-code ...

Postby melvin » 03 Nov 2011, 12:32

shogi4fun wrote:I still was wondering, why the count was only shown for decks and not for the pool. Maybe when it was first created, there were so less cards available, that you thought blaming to show the count. :wink:
I think it could be because there is no limit on the card pool so its size is less important, but it is nice to have both the card pool and deck use the same format for the title.

shogi4fun wrote:Still it's absolutely unimportant, I like to know the reason for it. I assume the problem for you was the (neverending) thing with CR/LF.
I didn't check that but it sounds very plausible. The other issue with diff is the lack of attribution, date and other metadata. At the moment we just make a note in the comment who is the contributor. Mercurial has an "export" command that generates a diff that has necessary metadata which we can import directly into the main repo.
User avatar
melvin
AI Programmer
 
Posts: 1062
Joined: 21 Mar 2010, 12:26
Location: Singapore
Has thanked: 36 times
Been thanked: 459 times


Return to Magarena

Who is online

Users browsing this forum: No registered users and 21 guests


Who is online

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

Login Form