Nameless Voice on 17/12/2016 at 01:36
Urgh. As someone who hates the tiny combined taskbar icons option, one program taking up my entire taskbar with a dozen icons really bugs me.
Edit: Also, forgot to mention, it makes alt-tab much harder to use to switch between programs when half of the entries in the list are for the same program.
Renzatic on 17/12/2016 at 02:16
If you're on Windows 10, you could pile it all onto one desktop, and use the others for everything else.
That's pretty much why I swear by virtual desktops. It lets you partition everything, so they're easier to sort through.
Yakoob on 17/12/2016 at 03:09
I still use CS4 but agree I liked the interface of CS2 better. Tabs are annoying especially since there is no "close everything except this" option.
Quote Posted by icemann
When stuck on logic errors in code and you've been sitting there all day/night trying to figure it out, I find that taking a break away from it even for 10-20 minutes does wonders.
For me I go outside for a smoke (cigarette) and the answers have often come to me then. Might sound like an odd tactic but it's worked time and time again for me. Obviously if you don't already smoke then -insert other thing to give you a 10-20 minute break here-.
Yeeep that's a common advice and there's a lot of psychology to back it up. Our brains do a lot of compartmentalizing and post-processing when we stop thinking about a problem. The whole "coming up with a brilliant idea in a shower" thing.
Yakoob on 27/12/2016 at 03:09
Just wrote a new devblog about something I learned on my current project. Thought fellow TTLG makers might find it useful :)
Renzatic on 27/12/2016 at 06:42
I'll find it useful! :D
Though I've got a question. One that I might not be offering up enough information to answer wholly.
I'm doing a tutorial that has me building a little text based RPG. It's actually taught me quite a bit, but I've come upon something that has me stumped. Some way, some how, I've either forgotten to add something to a constructor, or messed something up. The problem is, I don't know
what. The tutorial has me doing something I haven't quite done before, so I'm at a loss as to how to troubleshoot it. I can only take vague guesses as to what it looks like, and go from there, but nothing I can find looks out of place.
To simplify it, I'm adding a number of items, weapons, and monsters to a list to be generated in the world. It all seemed pretty straightforward, but then I got to adding certain items that used a keywork that has me stumped. Specifically ItemByID. As in this..
Code:
giantSpider.LootTable.Add(new LootItem(
ItemByID(ITEM_ID_SPIDER_SILK), 25, false));
That ItemByID is always swiggled out, with the warning that the name doesn't currently exist within the current context. It looks like it's calling the constructor from the LootItem class it's inheriting from, which references the ID for that object (set as a class variable above), the drop percentage, and a bool to set it to the default item to be looted off that monster. Like this...
Code:
public const int ITEM_ID_SPIDER_SILK = 9;
It's using that as shorthand, so I don't have to call that specific number in my code. Though, rather strangely, it seems to be longer and more complicated than just calling the number itself. I guess the tut is trying to teach me good coding habits to get into.
Now the two classes it's referencing from are LootItem...
Code:
public class LootItem
{
public Item Details { get; set; }
public int DropPercentage { get; set; }
public bool IsDefaultItem { get; set; }
public LootItem(Item details, int dropPercentage, bool isDefaultItem)
{
Details = details;
DropPercentage = dropPercentage;
IsDefaultItem = IsDefaultItem;
}
}
}
Which in turn references Item..
Code:
public class Item
{
public int ID { get; set; }
public string Name { get; set; }
public string NamesPlural { get; set; }
public Item(int id, string name, string namesPlural)
{
ID = id;
Name = name;
NamesPlural = namesPlural;
}
}
}
The only thing I can figure is that the ID int is buried in the root class, which SHOULD be called with the Details variable in LootItems. But it's obviously not. I've never used the ItemByID code before, so I'm at a loss as to what I'm supposed to do to fix this.
edit: Okay, I figured it out. Got ahead of myself, thinking that the name was showing up as an error due to something I missed. Turns out, the guy writing the tutorial decided to add the class in towards the bottom of the tutorial, after all this was set up, rather than at the beginning.
Code:
public static Item ItemByID(int id)
{
foreach (Item item in Items)
{
if (item.ID == id)
{
return item;
}
}
return null;
}
...so I spent all this time spinning my wheels looking for the name of that reference, when I had yet to even be assigned to write it.
I dunno who's more dumb here. Probably me.
henke on 27/12/2016 at 13:07
Oh man that sounds good. If I had a VR headset I'd try it out.
Yakoob on 27/12/2016 at 20:08
Quote Posted by icemann
Wouldn't that have been better in a switch statement?
(The bit in the image)
Hmmm I didn't think that would work. I don't think you can iterate counter++ in a case statement like I did? Maybe I'm wrong.
(That and I prefer the else() {} structure to case blabla: break; visually. Just made reading the "data" easier to me).
EDIT: and aaaalmost done with trailer:
Inline Image:
http://i.imgur.com/auLeU2W.jpg
Pyrian on 27/12/2016 at 21:29
Case expressions have to be constants, so yeah, that wouldn't work as a drop-in. Generally speaking I prefer switch statements to if/else chains, but the latter can do things the former can't. Also, C#'s switch break is annoying
and pointless; the compiler won't
let you do the complex structures that make "break" useful in switch blocks in C/C++. The compiler should simply assume the presence of a pre-case break if there's code between cases, since it literally requires it (or an equivalent) to be there.
I also didn't want to faff around with data files for Glade Raid, so I used basically every workaround imaginable. There are a lot of big, fat constant arrays, some of which are imported from Excel. (At least one set I
wish was imported from Excel.) Levels are built from images; drawn in paint.net, imported into the project as textures, then the terrain in each hex is determined from the pixel data. A bunch of early stuff is in serialized data that I set in the Unity Inspector, but I stopped doing that because it's just not a very convenient editor. (It's pretty bad when your editor is worse than writing C# constants.) But the "grand" workaround has to be the Encounter data! I made a rather large set of custom constructors, so I can build each Encounter with just the data it needs. Each Encounter is constructed in code at startup and strung into a big ol' linked list. The list is iterated each time an Encounter needs to be selected, adding up the weights of every Encounter that can currently be selected, and then randomly choosing a single one to occur.
Here's an early example:
Code:
/// Beast battle
FirstEncounter = new Encounter("\"We're low on food,\" Kahir observed. \"Perhaps we should forage.\"\n\n" +
"Wordlessly, Darinya hands him a branch, which sprouts an abundance " +
"of plump berries.\n\n" +
"\"Could you conjure a shank of mutton?\" Barowen asks playfully.\n\n" +
"\"Would you settle for pork?\" Ruarc responded, scanning the mists.\n\n" +
"\"I do quite like...\" Barowen started dubiously. \"Aw, muck.\"",
FirstEncounter,
new Reqs(EvtFlgTypes.p0_Beasts, Overmap.SiteTypes.Bog, 0, EvtFlgTypes.Beast1),
3.0f, new EncRes(BattleData.BattleNames.PigFest));
FirstEncounter = new Encounter("Fell beasts have caught our scent, prodded on by Boggin herders.",
FirstEncounter,
new Reqs(EvtFlgTypes.p0_Beasts, new Overmap.SiteTypes[] {Overmap.SiteTypes.Forest, Overmap.SiteTypes.Glen, Overmap.SiteTypes.Lake, Overmap.SiteTypes.Wood}, 0),
1.0f, new EncRes(BattleData.BattleNames.BeastHerders));
FirstEncounter = new Encounter("Fell beasts have caught our scent, prodded on by Boggin herders.",
FirstEncounter,
new Reqs(EvtFlgTypes.p0_Beasts, new Overmap.SiteTypes[] {Overmap.SiteTypes.Cairn, Overmap.SiteTypes.Field, Overmap.SiteTypes.Hillock, Overmap.SiteTypes.Valley}, 0),
0.5f, new EncRes(BattleData.BattleNames.BeastHerders));
So here we have 3 "different" encounters that are all connected to the same mutually exclusive flag, p0_Beasts. You can only hit one of them in a single playthrough. The three encounters are differentiated by site type, with the Bog being the most likely (weight 3) and also having the most associated text (and a different enemy set - all Fell Boars). The fact that that particular text has been encountered is stored in the flag Beast1, so followup events can occur. ("You mentioned you wanted mutton...")
And that's a simple Encounter with no choices, branches, nor specific rewards! Encounter Resolutions "EncRes" can also have Requirements "Reqs" objects and weights, and so can be picked randomly from a set of possible outcomes.
EDIT: Localization would suck so hard.