Sep. 22nd, 2020

Work Post

Sep. 22nd, 2020 07:00 am
relee: Picture of Relee Starbreeze, Wizard (Default)
7:00am - Finally slept during the night for a change. I guess that happens when you get up early two days in a row.

Anyways I'm feeling like working on the Godot Roguelike Toolkit again so I'm going to get to that.

7:23am - Well darn. I'd been looking at this method used in the RogueSharp library and I thought I was modifying it properly, but I was wrong. It looked like a method that was part of the HashSet class in C# but I kept thinking there was something off about it, and I went a while back to look it up in the code, but couldn't find it in the library, so I just shrugged and carried on thinking it was a C# hashset method.

Turns out it IS in the class I've been working on all this time. It's down at the bottom and I don't know why my search didn't find it previously. Very frustrating.

Anyways I'll have to modify all the shape functions I've written so far.

It'll be interesting to do, anyways, since there's a mix-up of pass by reference and pass by value in the languages.

In GDScript there's no operator to pass by reference. Arrays and Dictionaries are passed by reference automatically, while other types are passed by value.

The AddToHashSet method that I'm translating takes some variables as normal, but expects the Cell to be passed by reference, so that it can add the same reference to the cell to the hashset, rather than making a new hashset with new cells.

The method is also overloaded with three different versions, and GDScript doesn't do function overloading.

Here's the thing though. Because I'm not working with Hashsets but instead GDScript Arrays, I have to check the array to see if a particular cell is in there already, and I think that means the edge cases that the overloaded options cover are already covered in the method I use for testing.

Hmm... On double checking the functions I realzed that they're not adding the Cell to the Hashset, they're adding the position in a flat array to the hashset. I'm a bit confused about this.

8:00am - Yeah after analyzing it over and over I think I've figured it out. The functions that the method is used in use it to determine if the cell they're considering is already selected. So the way I've been doing it should work after all, except for certain ones where I was confused.

I'll have to fix them.

8:31am - Everything's fixed and I'm moving on to the next function. I wish I could test these as I make them but it'll have to wait until I've finished translating the class.

9:16am - Well the first copy of the Map class is done. I had to trim out some utility functions that are too different to translate or just don't make sense in GDScript, but the functionality should still be there.

Now to test it and see what happens.

9:39am - There's some sort of problem importing the class in another class. It says there's either a script error or a cyclic dependancy, and I don't see either in the Map class. So I'm not sure what's going wrong. I've tried restarting the Godot IDE but that hasn't changed anything. I'll have to go looking for help, I think, but first I need a break.

10:21am - Alright that was a break but I'm still feeling like working, so I'll see what I can do.

10:35am - Apparently it was a cyclic dependancy, since the class had a deep copy function that tried to make another Map class inside it, and GDScript doesn't allow that. Well I don't think the deep copy function is terribly neccesary in the GDScript implementation here.

Now back to testing.

11:31am - So far the tests are going well, but the get_cells_in_diamond() function isn't working properly. That is to say, it's not selecting the right cells. I'll have to check the logic on it compared to the original function. But for now I need a break again. This one will take longer so I'll end my work post here for now.

Work Post

Sep. 22nd, 2020 03:35 pm
relee: Picture of Relee Starbreeze, Wizard (Default)
3:35pm - Well I can't seem to bring myself to playing any of my games right now, so I can either work on my project or go to bed early. I think I'll keep working.

4:38pm - All of the functions in the Map class have been tested and fixed where malfunctioning. They all do their thing now.

Now I have to figure out which class to do next. I could do more MapCreationStrategies but I have one that's good for testing already and the others I think are more for samples.

4:43pm - I'm looking at the code while I try to decide what to do next and I keep thinking this would be a good time for a break. But I don't want to do anything else. XD

Yeah I guess it's time for another nap.

Profile

relee: Picture of Relee Starbreeze, Wizard (Default)
Relee Squirrel

July 2023

S M T W T F S
      1
23456 78
9101112131415
16171819202122
23242526272829
3031     

Most Popular Tags

Page Summary

Style Credit

Expand Cut Tags

No cut tags
Page generated Sep. 25th, 2025 02:31 am
Powered by Dreamwidth Studios