mrlachatte: (Default)
[personal profile] mrlachatte
That feeling you get when you fix a bug and the entire program/library/etc comes together after multiple frustrating hours? I just got that. Magic: The Gathering now has unlimited smooth scrolling across the table, and you can drag cards wherever you want (did I mention it was smooth, too?) I haven't mentioned anything about this project before, I started it in Fiji after taking a look through my two Magic decks and thinking about how to represent them in code. After two weeks of work, averaging around 4-8 hours per day on the game, I have something to show for it. The program itself only contains minimal rules about running the game and giving priority to the appropriate player. Each card is a DLL (for now) which contains a bunch of exported functions, and the game loads every DLL it finds and fills up a structure that contains millions of function pointers. Now, the obvious security hole in this setup is that a card (Soulnova, for instance) could delete every file on your hard drive (although personally I think it would be amusing for Soulnova to grab a single random file and delete it). If this project goes anywhere then I'll switch to a scripting language like Lua, which has many obvious advantages over DLLs. Until then, the security hole stays.

Anyways, I have some basic turn logic in place (no combat yet, extremely basic card playing (the stack doesn't exist yet)) and I have written some nice video routines that make my life easier. I give you a delicious taste of what is yet to come:



So, in conclusion this new project is quite challenging and a lot of fun to work on. On the topic of solving bugs, I finally found the source of problems I've been having for the better part of a year. Turns out that I was drawing my lines for one element one pixel past the boundary, ergo overrunning the space given to the SDL pixel array. All it took was a -1, and every bizarre problem in SDL-GUI disappeared. Poof. On the bright side, that means I can keep adding in more GUI element types whenever I feel like it now, I used to be holding off until I discovered why it kept crashing :)

Man, code is \m/ I also highly recommend the new IDE Code::Blocks, it's like Dev-C++ but... better. I feel like a traitor now, but one of the Dev-C++ dev team is working on this new one with some other folks, and the result is a well-designed, wxwidgets-based, extensible IDE for C/C++. It's a 1.0 release candidate that's available, and while the class browser and code completion are still a bit wonky (surprisingly more wonky than the Dev-C++ ones), it's a wonderful program to work in. It lets me have workspaces and build targets, first of all. That means with my Magic: The Gathering project, I have the 'Release', 'Debug' and 'Cards' targets. Release has some compiler optimization settings ticked, Debug puts in all debug info and Cards runs a makefile I created that compiles every .cpp file in the /cards directory into a DLL. Did I mention that Code::Blocks integrates with 5 different compiler sets right out of the box? It's hot stuff.

Enough geekiness for one night. We'll see what happens tomorrow.
This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

December 2007

S M T W T F S
      1
2345678
9101112131415
16171819202122
23242526 272829
3031     

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 21st, 2025 06:57 am
Powered by Dreamwidth Studios