Skip to content
This repository has been archived by the owner on Apr 18, 2022. It is now read-only.

Feature: Code Hot-Reloading #43

Closed
CooCooCaCha opened this issue Apr 3, 2016 · 19 comments
Closed

Feature: Code Hot-Reloading #43

CooCooCaCha opened this issue Apr 3, 2016 · 19 comments
Labels
diff: hard Achievable, but may require efforts from multiple experienced developers. pri: normal An issue that is causing a noticeable impact, but can be worked around team: engine type: feature A request for a new feature.
Projects
Milestone

Comments

@CooCooCaCha
Copy link

CooCooCaCha commented Apr 3, 2016

No description provided.

@ebkalderon ebkalderon added type: feature A request for a new feature. diff: normal Achievable by an reasonable experienced developer. If new to Amethyst, may need some guidance. pri: low Minor issue or cosmetic issue. Most users would not even notice. labels Apr 4, 2016
@ebkalderon ebkalderon added this to the 1.0 milestone Apr 4, 2016
@ebkalderon
Copy link
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
Copy link
Author

@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.

@ebkalderon
Copy link
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.

@CooCooCaCha
Copy link
Author

@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
Copy link
Author

Also, I don't think energy should be put into this feature until the amethyst architecture has settled.

@ebkalderon
Copy link
Member

Of course, but it will definitely be kept in mind for the future.

@thiolliere
Copy link

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...

@CooCooCaCha
Copy link
Author

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.

@lschmierer
Copy link
Contributor

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.

@CooCooCaCha
Copy link
Author

@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.

@fHachenberg
Copy link

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.

@jFransham
Copy link
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

@zakarumych
Copy link
Member

This issue is worked on in #266

@torkleyy
Copy link
Member

This issue is about the reloading of code, reopening.

@torkleyy torkleyy reopened this Sep 19, 2017
@AnneKitsune
Copy link
Contributor

I could see this work when modifying a system, but not really for any other code. Is this even possible in rust?

@torkleyy
Copy link
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.

@torkleyy torkleyy added diff: hard Achievable, but may require efforts from multiple experienced developers. type: task pri: normal An issue that is causing a noticeable impact, but can be worked around labels Apr 15, 2018
@torkleyy torkleyy added status: working and removed diff: normal Achievable by an reasonable experienced developer. If new to Amethyst, may need some guidance. pri: low Minor issue or cosmetic issue. Most users would not even notice. team: assets labels Apr 15, 2018
@khskarl
Copy link
Member

khskarl commented Aug 22, 2018

I believe it's better to make it explicit by renaming this issue to "Feature: Code Hot-Reloading" and prevent misunderstandings again.

@LucioFranco LucioFranco changed the title Feature: Hot-Reloading Feature: Code Hot-Reloading Aug 22, 2018
@AnneKitsune
Copy link
Contributor

thanks

@fhaynes
Copy link
Member

fhaynes commented Mar 22, 2019

Closing this due to age and lack of work on it. If there is demand for it, we'll put it on the roadmap.

@fhaynes fhaynes closed this as completed Mar 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
diff: hard Achievable, but may require efforts from multiple experienced developers. pri: normal An issue that is causing a noticeable impact, but can be worked around team: engine type: feature A request for a new feature.
Projects
No open projects
Engine
  
New
Development

No branches or pull requests