It seems to multithread pretty well (well, at least across 2 cores). That's cool.
I notice that you're lock-stepping the drawing with the simulation. If you copy the simulation into a buffer and draw things from the buffer, you can decouple the simulation and the graphics display. That way you don't have to pause the display to ramp up the sim speed. You don't even need everything from the simulation, just whatever you need to draw stuff.
Yeah, the multithreading is a bit... interesting. I'll leave it at that. The simulation does run in another thread and should actually be fairly easy to entirely decouple it, if you turn off drawing there is a significant speed increase. WPF really just can't handle what we were trying to do to it (at least in that manner), the whole drawing section of code probably should be rewritten.
If you can make a list of snags with Sunweaver while it's fresh in your mind that would be great. I'm not going to get it in to DB3 for a while.
- != does not parse think it had something to do with being an unrecognized type
- Duplication of DNA for reproduction. I implemented it as a cascading chain of copy constructors all the way from DNA down to codule, then did member-wise clones of the base-pairs
- For saving simulations: I just used serializable all the way down to the base-pairs, so I had to go though and mark stuff to not get serialized. (VMs mostly I think) this is another way to potentially do DNA duplication, probably should run some benchmarks
- Wanted some way to see current state of the DNA: passed a string builder around traversing through the children and finally appending basepair.ToString() to it.
- Way to read in a bot from a file (I did this in a quick hack sort of a way)
- Some of the stack modification commands seem to be missing (overbool, dupbool, can't remember what else)
- Some way of getting a list of sysvars into the simulation rather than hard coding them would be a really good idea
- EDIT: There were some bugs with string split and empty arrays, easily solvable by using StringSplitOptions.RemoveEmptyEntries and some length checking.
Those were the only changes I made directly to Sunweaver, some of those things are specific to what I wanted at the time, not sure how they should actually be implemented. I'll go through and fix the bugs I found at some point during break here. I'm also planning on running a profiler over the initial loading of the simulation; it is really slow, not sure if that is caused by Sunweaver or myself.
We use WPF for some stuff at work. What's it's main difference vs. winforms? I might look in to it at some point if I have time. I'm actually doing a bit of UI work for DB3 right now.
I would highly recommend using WPF over WinForms given the choice.