Monday, May 10, 2010

Open Source Project - Part 1

Making a program "open source" means that you allow the world the chance to download and peek-and-poke around your source code. (Having someone look at your source code is also very personal because it is easy to criticize someone else's code.) The advantage of this method is that maybe, just maybe you can recruit other people to help do some of the programming. This has happened with Forge. Forge started out as a one man project but now it has 5 or so active programmers.

By the way the current "lead developer" is Dennis and he is a great leader. He donates the most time and I admire his dedication. He also doesn't complain about my code, so he is a good guy in my book. :--)

Most open source project are just lumps of source code lying around with no documentation. Many projects never end up producing any code at all, they are just ideas that never get written, see SourceForge. Now don't get me wrong, there are also lots of productive, useful programs on SourceForge. Writing a program that someone else can use is actually very hard. (And if you wondering if I stole Forge's name from SourceForge, the answer is probably. I didn't sit down and try to think of a name, I just let my fingers type something and Forge just appeared.)

When I say that most open source projects are lump of code lying around with no docs, I mean it. Forge was the same way. Forge's saving grace was that it actually did something, so people could see it in action and get excited and want to contribute code. If a program doesn't do anything, people aren't going to get excited. Showing me some UML is great and all that but UML and other documentation is deadly boring. I mean people would rather hit themselves in the head with a rubber hammer than read UML or specifications. (UML is just line drawings which show how the major parts of a program fit together.)

Another good attribute of Forge is that the program is fun to use. It isn't a boring report generator; it is an actual, fun, interesting videogame. Yes, some people probably love working on the Linux or Apache but they aren't what most people would consider fun.

And truthfully I didn't think anyone else would ever take a second look at Forge's source code. Yes I'm the world 2nd greatest programmer and all that but why would someone actually slog through and read my code? And don't forget, Forge has no documentation. Yes, I tried to give objects and methods good names but it is still hard to figure out what a 500 line object does even if all of the methods are well named.

Open source software also has the "side effect" of being free which makes it popular. :)

12 comments:

wololo said...

Nice post!

I agree that in terms of open source, Forge is a success. Your project has been alive for several years now and seems even more active now than when you started. Most open source projects can't say the same!

Congrats to all the team and keep up the good work guys!

Depending how you count, Wagic is almost 3 years old, so Forge is like its grandfather in the world of programming :D . I hope my project will be as lively as Forge in 2 years!

Bruno Cardoso said...

I searched the google for Java + MTG software and found this blog.

I'm a Java Programmer for almost 7 years now. I coded several different types of applications. From Multi-User Dungeons, web applications or swing applications, I even did something in the area of graphics 2d with a couple of experiments, anyway, a little of everything but my main experience is on web and intranet applications which is what I do for living.

I'm a long time fan of MTG, i've even my fair share of sucessful tournament wins on the game. Long time away from the competition I always wanted to do something with Java and MTG.
My dream application is a complete engine to create TCG Games. Something like Firemox (if you know what is) but more generalist.

Anyway... this was a nice post about the open source experience. It certainly has pros and cons.

While I think you have a great project here, I also think there is still a lot of work ahead of you. Personally, I would focus more and having a better interface and a more challenging AI instead of trying to add more cards, maybe even a system that allowed non-programmers to create AI by XML or something. Maybe that would allow you to focus on other things and let others add more cards and decks.

Anyway, I just showed up here and I don't want to start by telling you what you should do. One thing is sure, we have two things in commom. Passion for Java and MTG so I'll definatly stick around and read every update you have.

Good work!

Unknown said...

I have to agree with Bruno here.
Adding cards is quite nice and fun, but I would much prefer a better AI and more bug hunting than extra cards.
Currently, I feel like the AI is pretty week with most decks.
I have been playing decks which I found quite awful, just to try the AI and gave him some decks I made which are pretty awesome.
This should have been sure win for AI, but I won 5 matches out of ... 5!
The big issues are that an AI fails to calculate a loss because of trample or exalted or double strike.
I've seen him assign a 3/6 to kill my 2/2 when I attacked also with a 8/8 which killed him (he had 8 pts left).
Also saw the cpu spend all his creatures to block a 4/4 double strike, loosing all failing to notice I would not take enough damage after half the defenders died at first strike.
Anyway, keep up the good work ;)

Unknown said...

The AI also completely stops attacking when low on life.
Even when his creatures have vigilence and I don't have strong defenders to kill them.
This eventually gives me enough time to switch the odds in my favor and ultimately win when this would not have been the case against a moderate player.

wololo said...

Reading Sven's comment I can see that Wagic and Forge share lots of their AI weaknesses :D

Sven, keep in mind the meaning of open source, especially since it's the subject of this entry: if you want things to be improved, start improving them yourself ;)

Unknown said...

Another great milestone for the open source project is "Derivative Works". Other projects have used parts of Forge's architecture and code.

Forge said...

The AI certainly has it faults. The attacking and blocking code just uses a "for loop" and doesn't do anything fancy.

The reason the AI doesn't attack when his life is low is because he is trying to save himself. The AI used to attack with full force and then get killed when you attacking, so now the AI is more cautious.

The AI isn’t perfect but it is better than nothing. Forge is basically one big prototype because it is hard to get something like Forge working at all.

Forge said...

Bruno - "One thing is sure, we have two things in commom. Passion for Java and MTG so I'll definatly stick around and read every update you have."

Thanks for reading. I don't really know anything about blogging but I try to remember what my English teachers have taught me nad to "stay on topic" which most bloggers don't.

I do like Java but I also don't mind writing hacky, duct tape code. If Forge was done perfectly, it would have never gotten done.

(Although I acknowledge that global, static variables that are never re-initialized will eventually make your program slow down because the function calls keep getting deeper, aka. the stack trace.)

DennisBergkamp said...

Improving the AI (especially combat-related) is tricky business... I will try to focus on this more though.

Some reasons I've been adding lots of cards instead of fixing the AI:

1. There have been a lot of bugs needing fixing.
2. There have been a lot of requests for new cards.
3. Adding cards is more fun.

Anyway, next version should have a better AI in terms of attacking/blocking, I've made some changes already. Another thing I've noticed is that it charges into multiple creatures that have first (or double) strike, netting free kills for the player.

Unknown said...

Fixing bugs, improving the AI, adding AI decks to quest mode, adding new features, including an updated fantasy quest mode … is, well, not easy. We have a small group of people that pitch in when they can. I often find myself in over my head. We all do our best. :)

There is that old saying, "On the outside looking in." This being an open source project means that anyone can step in at times and help with the project. Granted, not everyone can be a project head or a long term programmer. Anyone who is interested can usually find a niche to fill.

Viagra Online said...

men are you working to made a new magic the gathering simulator? if you need some help in the part of rules, cards and other things, please tell me, contact me ikujoha_379@yopmail.com, I'm player since about ten years.

rxmex said...

The game is really good. It is a pity that it has some flaws but I understand that they have the mmo version of the game so the cards there are btter.