Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upFeature: Hot-Reloading #43
Comments
ebkalderon
added
type: feature
diff: medium
pri: low
labels
Apr 4, 2016
ebkalderon
added this to the 1.0 milestone
Apr 4, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ebkalderon
Apr 4, 2016
Member
@CooCooCaCha This would be an awesome feature to have! Thank you for the suggestion.
To get your example compiling on my system, I had to change line 21 of main.rs from "libgame.dylib" to "libgame.so". Unfortunately, even then it doesn't quite work on my machine (64-bit Arch Linux). Please see this screencast for details.
|
@CooCooCaCha This would be an awesome feature to have! Thank you for the suggestion. To get your example compiling on my system, I had to change line 21 of main.rs from "libgame.dylib" to "libgame.so". Unfortunately, even then it doesn't quite work on my machine (64-bit Arch Linux). Please see this screencast for details. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
CooCooCaCha
Apr 4, 2016
@ebkalderon Yeah this was a quick and dirty example so I didn't test it beyond getting it to work on OSX.
My apologies, I should have probably done OS detection to make sure the right filename is loaded.
Also, when I look at your screencast I get a broken link with a bunch of porn ads lol.
CooCooCaCha
commented
Apr 4, 2016
|
@ebkalderon Yeah this was a quick and dirty example so I didn't test it beyond getting it to work on OSX. My apologies, I should have probably done OS detection to make sure the right filename is loaded. Also, when I look at your screencast I get a broken link with a bunch of porn ads lol. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
ebkalderon
Apr 4, 2016
Member
I am genuinely sorry about that. I have an ad-blocker in place, so I was unaware of all the ads. I had to find a place to host the screencast since GitHub issues do not allow WebM video attachments. I'll look for somewhere else to host it.
Update: I've changed the link above to point directly to the WebM file instead of the website. Please let me know if it works for you.
|
I am genuinely sorry about that. I have an ad-blocker in place, so I was unaware of all the ads. I had to find a place to host the screencast since GitHub issues do not allow WebM video attachments. I'll look for somewhere else to host it. Update: I've changed the link above to point directly to the WebM file instead of the website. Please let me know if it works for you. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
CooCooCaCha
Apr 4, 2016
@ebkalderon So this is actually working as intended. The issue you're getting in the screencast is because the dynamic library gets rebuilt and restarted for every file system event.
For some reason when a file gets saved the event channel gets a ton of events. I haven't looked into it much yet but I think there are easy ways to fix it. Namely 1) filtering events or 2) making sure the file contents actually changed.
CooCooCaCha
commented
Apr 4, 2016
|
@ebkalderon So this is actually working as intended. The issue you're getting in the screencast is because the dynamic library gets rebuilt and restarted for every file system event. For some reason when a file gets saved the event channel gets a ton of events. I haven't looked into it much yet but I think there are easy ways to fix it. Namely 1) filtering events or 2) making sure the file contents actually changed. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
CooCooCaCha
Apr 4, 2016
Also, I don't think energy should be put into this feature until the amethyst architecture has settled.
CooCooCaCha
commented
Apr 4, 2016
|
Also, I don't think energy should be put into this feature until the amethyst architecture has settled. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
Of course, but it will definitely be kept in mind for the future. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
thiolliere
Apr 5, 2016
this feature is great but seems hard to implement.
another feature is to watch yaml configuration file only.
on a change the shard or core part responsible is informed with the new configuration (through a trait)
And it's up to the shards or core part developer to implement as possible the reset.
it would be useful to be able to adjust game constant like character velocity in real time.
also some shard can implement it quite easily. even if some configuration change would (always?) need a the game to restart.
Well I'm not sure if it's that much useful as it is very easy to just restart the game...
thiolliere
commented
Apr 5, 2016
|
this feature is great but seems hard to implement. another feature is to watch yaml configuration file only. it would be useful to be able to adjust game constant like character velocity in real time. Well I'm not sure if it's that much useful as it is very easy to just restart the game... |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
CooCooCaCha
Apr 5, 2016
Being able to hot reload logic as well as data makes iterating on games much faster. I've come to value this immensely after playing around with unreal engine.
Personally I'd like to have both yaml and rust hot-reloading. For example, you could have AI logic units written in rust and configured in yaml. You could then load up the game, find an AI agent, and tweak it right there.
CooCooCaCha
commented
Apr 5, 2016
|
Being able to hot reload logic as well as data makes iterating on games much faster. I've come to value this immensely after playing around with unreal engine. Personally I'd like to have both yaml and rust hot-reloading. For example, you could have AI logic units written in rust and configured in yaml. You could then load up the game, find an AI agent, and tweak it right there. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
lschmierer
Apr 11, 2016
Member
This is awesome.
However, we need to somehow keep states over reload (e.g. graphics context and resources).
Or support hot reload for some parts of the engine (shards) like game logic only.
|
This is awesome. However, we need to somehow keep states over reload (e.g. graphics context and resources). Or support hot reload for some parts of the engine (shards) like game logic only. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
CooCooCaCha
Apr 12, 2016
@lschmierer I definitely think logic would be the best place to start. Data is much more difficult.
In a way, hot-reloading data is similar to a database migration. You are basically changing the schema of your components.
You also have to consider the dependencies between components and the systems that use them. Once a component changes, dependent systems will need to be recompiled along with the component.
Also, you would need to reload the entities that use the component. That way, the game logic could initialize the new component however it sees fit.
CooCooCaCha
commented
Apr 12, 2016
|
@lschmierer I definitely think logic would be the best place to start. Data is much more difficult. In a way, hot-reloading data is similar to a database migration. You are basically changing the schema of your components. You also have to consider the dependencies between components and the systems that use them. Once a component changes, dependent systems will need to be recompiled along with the component. Also, you would need to reload the entities that use the component. That way, the game logic could initialize the new component however it sees fit. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
fHachenberg
Sep 16, 2016
In a way, hot-reloading data is similar to a database migration. You are basically changing the schema of your components.
Why? In most cases you will just change - to stay in your analogy - the data within the table, not the schema. For example hot swapping a mesh or a texture seems much easier to me than hot swapping code.
fHachenberg
commented
Sep 16, 2016
Why? In most cases you will just change - to stay in your analogy - the data within the table, not the schema. For example hot swapping a mesh or a texture seems much easier to me than hot swapping code. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jFransham
Dec 16, 2016
Contributor
There has been some work on hot-swapping individual functions in Rust before, it's actually pretty impressive how simple it is, although I don't know if it only works with free functions or not. https://github.com/draivin/rust-hotswap
|
There has been some work on hot-swapping individual functions in Rust before, it's actually pretty impressive how simple it is, although I don't know if it only works with free functions or not. https://github.com/draivin/rust-hotswap |
ebkalderon
added this to New
in Engine
Feb 3, 2017
Xaeroxe
added
project: meta
project: assets
and removed
project: meta
labels
Sep 15, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
This issue is worked on in #266 |
omni-viral
closed this
Sep 19, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
|
This issue is about the reloading of code, reopening. |
torkleyy
reopened this
Sep 19, 2017
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jojolepro
Apr 14, 2018
Collaborator
I could see this work when modifying a system, but not really for any other code. Is this even possible in rust?
|
I could see this work when modifying a system, but not really for any other code. Is this even possible in rust? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
torkleyy
Apr 15, 2018
Member
Yes, it is and I already did some experiments with it. My plan is to solve this with the node system (vnodes), but I don't have time for programming for a couple of weeks.
|
Yes, it is and I already did some experiments with it. My plan is to solve this with the node system (vnodes), but I don't have time for programming for a couple of weeks. |
CooCooCaCha commentedApr 3, 2016
The idea is fairly self-explanatory. Reload pieces of the game while it is still running. Super useful for debugging and speeding up development.
I wrote a simple example showing how this is possible.
https://github.com/CooCooCaCha/amethyst-hot-reload
The example will compile, load, and run a simple amethyst example at runtime. It will also detect file-system events and reload the new code.
This isn't a fully fleshed-out idea so the architecture is still very much up in the air.