Facepunch / sbox-issues

175 stars 12 forks source link

Hotreload button #5682

Closed MD485 closed 4 months ago

MD485 commented 4 months ago

For?

S&Box

What can't you do?

I've been having hotreloading issues for a quite a while, while I am perfectly content with making an issue and helping ziks figure out what's going on, it seems to simply not work a majority of the time and the times it does work it's for a short duration and doesn't work consistently.

E.g. It won't hotreload on the changing of a value on a variable, or changing a comment to effect how a tooltip shows in sbox, but if I make a fake method I won't use it'll hotreload correctly.

And having to close and reopen my project every time I add a Log.Error and having to wait 30ish seconds is so frustrating I just don't feel like doing anything.

I know people like John CO have their own scripts for this in the discord, but we shouldn't have to do that. image

I suggest a button just somewhere in the UI you can push, similar to the recompile all shaders button, which I can't seem to find anymore?

How would you like it to work?

image Probably just slot it here under "Open Solution".

What have you tried?

Opening nothing but sbox on my pc and opening the visual studio project through the Open Solution button then making code changes, it just doesn't seem to work.

Additional context

I understand the official position on this issue will likely be "We don't want to add this button because it masks the issue, we'd prefer it if people simply reported hotloading issues so we could deal with them", and while I understand the position, having a button just seems like a good fall back option.

Members of the community such as myself and John CO and possibly others prove we'll just ignore these issues rather than deal with them, but there's also other considerations.

If an issue that's hard to pin down prevents hotloading for the live builds for an extended period of time, having no fall back functionally could halt all development.

If what Facepunch has decided should trigger hotloading in terms of code changes isn't the same as something the developer wants to test, for example me wanting hotloading to trigger on a comment change, which facepunch as an organisation might deem too trivial to force a hotload.

As well as just varying user environments. I don't have a strong understanding on how file handles/watches are implemented on an OS level, but I imagine there are theoretical circumstances, like maybe files in a drop box folder that are constantly getting synced, that might interfere with the hotloading process. Causing there to be a narrow use case you guys won't/cannot fix due to some problem or other, that functionally prevents someone's workflow from being possible.

Metapyziks commented 4 months ago

E.g. It won't hotreload on the changing of a value on a variable, or changing a comment to effect how a tooltip shows in sbox, but if I make a fake method I won't use it'll hotreload correctly.

Assuming the compiling notification still appears at the bottom left, this sounds like an ILHotload (fast hotload) issue. We do that if only the body of a method changes since it's a lot faster, but it's more experimental.

In case you didn't know, you can force a full hotload on any code change with:

hotload_fast 0

This will apply until you restart the editor.

However, and you knew this was coming: please please please tell me about the cases where hotload doesn't work! 😄 It'll mean everyone can benefit from it, and you don't need to keep doing an annoying workaround.

MD485 commented 4 months ago

Hotload fast is very helpful, I'll try some varations wth it and without it and different scenarios enough to be able to make another issue. Hopefully we'll be able to track down the cause.

The bottom left pop up doesn't occur even when creating entirely new classes to the project, so I do suspect that given a bit of time to make sure my environment is properly controlled we will likely find things that are actual bugs in the system.

I do still think there's some use of this button though which is why I opted to make this issue first. I remember using Unity in it's earlier days and hotloading issues occuring on and off were quite common, and the C# project configuration I think was more simple than sbox's current iteration, so they likely were less likely to run into these issues.

That and it's way less effort than making a real hotreload issue where I have to find all the unique repro condtions.

I'll @ you in it when I've tried enough different stuff and made an issue.

handsomematt commented 4 months ago

Nope. If hot loading isn't working lets fix that instead. But we can not fix it with no information, a few people posting on Discord isn't helpful

Retroeer commented 4 months ago

How can we find information on a hotload bug? Sometimes the hotload takes upwards to 60 seconds to succeed/fail for me, but theres seemingly nothing im doing that makes the hotload bug appear, and the console isn't particularly helpful in those instances This is rare enough for me to not have made an issue on it, but its also rare enough that I just can't find any information on it because none makes sense

MD485 commented 4 months ago

There isn't much information because people aren't making issues. Ziks I presume would try fixing them if they were fully aware when the bugs occur.

Right now we're aware of one bug, #262, where installing visual studio on different drives to your sbox install seems to cause problems. And I've also made an issue for discussing this specific topic since 262 doesn't effect me, #5683 , if you have any anedcotal experiences you can share there I'm sure Ziks would appreciate more data to try and find out what the issues are.

Even if you can't give an overwhelmingly good description, so long as you can give as much detail as possible it might help them collate some problems from multiple anecdotal accounts.