You are browsing as a guest. Sign up (or log in) to start making projects!

Storm

  • 8 Devlogs
  • 53 Total hours

A rules engine for MTG

Open comments for this post

4h 30m 6s logged

#8 Devlog (Sorry; last one is actually #7)
So I finally completed the rewrite my entire project now uses my new overengineered typing. Yay! Finally!! But that also meant that I had to change my library API to use all of those types. What you see below are just the function definitions for that + some minor input validation. And, yes, you could defnitiely make that a lot shorter with macros but it is 1am and I can’t be bothered to go learn how they work.

0
0
10
Open comments for this post

4h 6m 42s logged

#5 Devlog
Of course fixing stuff took longer than I thought (as always), but we are almost there. Only 16 more errors to go!

0
0
36
Open comments for this post

7h 25m 28s logged

#6 Devlog
You know the rewrite I talked about last time? I am STILL doing that. It changed so much more that I had expected. Now I have changed just about every function signature in the entire project. Also there were a million little problems that also needed attention. I think I am close to completing the rewrite though; the core types are all set, I just have to deal with the downstream effects of changing them. That shouldn’t (I hope) take too long

0
0
8
Open comments for this post

3h 24m 2s logged

#5 Devlog
I redesigned my engine (not implemented yet); It makes much more extensive use of generics now and has in general much better type-safety. This eliminates a ton of bounds checks and potential errors, because the compiler can prove at compile-time that the program is valid (or not).

Also kind of crazy that it says 3.5h for designing. I feel like I spent most of my time in the browser explaining my code to ChatGPT to understand it better myself (ChatGPT did little besides saying “Ah, yes, great idea” and explaining my idea back to me)

0
0
4
Open comments for this post

1h 33m 16s logged

#4 Devlog
I have been developing a new model for how cards on the “stack” (a zone for cards). This moves a lot of the verification and testing (“Is the card that is reference by this Id, the card I expect?, Is this card really in the correct zone?, …”) to compile-time and the compiler will simply refuse to compile if its wrong. And I am really proud of it, since this is by far the most advanced thing I have ever done with generics and it is beautiful. All these ifs are just gone

0
0
11
Open comments for this post

1h 4m 18s logged

#3 Devlog
I created a single method in this hour. I wanted to just have method that creates an Iterator over a collection of objects. But if you have different objects that becomes very messy very fast, because the concrete type of the iterator is also different then. Now the method only claims to return something that is an iterator, so it shouldn’t be a problem, right? Well it is, because the compiler doesn’t know at compile time what type will be returned and thus can’t do monomorphization. The solution: Make the types of all of the objects the same through static polymorphism BEFORE you construct the iterator by putting everything into an enum and implementing an access method.

You could of course avoid all of that and just use dynamic polymorphism, but who needs that. Also sorry for posting so little, I will try to post more often.

0
0
7
Open comments for this post

11h 8m 1s logged

#2 Devlog
I reworked how static abilities are applied - now they are (mostly) compliant with MTG comp rules. By far the hardest (and most time-consuming) part was coming up with a design that can actually accommodate all of the requirements the rules have. It’s madness; you can change abilities during resolution, partially apply abilities and the order of application is incredibly complicated. Once I had that figured out the implementation was pretty straightforward. Design is in the image below.

The second big thing is that I started creating a unified iterator interface to access my cards in a structured manner.

0
0
2
Open comments for this post

20h 4m 32s logged

#1 Devlog

So originally I didn’t even plan to put this here, it was just me trying some different ideas. But now that I have spent over 20h and the design isn’t complete trash anymore, I should probably put this here as well. It is still far from complete and actually not that much code for 20h due to a million rewrites. Still, it has a working model for spells, permanents and various effects, so some basic cards can already work. What still needs a lot of work is how to cast a spell, but it is so freaking complicated. Also sorry for no image, but it is a lib and far from runnable, so yeah..

0
0
6

Delete project?

Are you sure you want to permanently delete this project? This action cannot be undone.

All devlogs, followers, and associated data will be removed.

Followers

Loading…