Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blueprints and Construction site #146

Open
simon987 opened this issue Apr 2, 2018 · 4 comments
Open

Blueprints and Construction site #146

simon987 opened this issue Apr 2, 2018 · 4 comments
Labels

Comments

@simon987
Copy link
Owner

simon987 commented Apr 2, 2018

Blueprints items should be found underground, from an artifact object #137. The blueprint can be digitized into Memory.

A digitized blueprint should take a fairly large amount of memory, and could represent a raw bitmap of the blueprint (which could be used later on with some sort of screen hardware/stucture).

To build a structure, the player has to specify the address of the digitized blueprint, which will create a construction site. When all the required materials have been inserted (with laser DEPOSIT) into the construction site, it is replaced by the final structure (which is saved as an attribute inside the construction site data).

The player will also be able to transfer energy to the construction site. (A typical construction site requirements might look like this: 10 copper, 2 iron, 3 biomass, 6000kJ. )

Previous discussion about construction: #109

@DBJ314
Copy link

DBJ314 commented Apr 2, 2018

How should the blueprint validation be handled? I imagine you don't want people to just look at the source code to figure out the blueprint.

I think the blueprints should be authenticated with by HMACing them with a secret key that is unique per map reset. A lot of useful information will be hard-coded into the blueprint data for each possible structure, but a valid HMAC will be needed for the blueprint to be valid.

As a side note, it would be a good idea to implement LASER_DEPOSIT so it can put things on the ground

@simon987
Copy link
Owner Author

simon987 commented Apr 3, 2018

Good point. I added an issue for the secret key.

As for LASER_DEPOSIT, I'll try to implement it when I have the time. Problem with it is that we have to validate where the items can be placed. The best way would be to make a world.canPlaceObject(x,y) method, which could be used for world generation events and prevent bugs like electric boxes spawning on top of portals etc.

@DBJ314
Copy link

DBJ314 commented Apr 3, 2018

you might need to make it a world.canPlaceObject(x,y,objectType) or something similar. Biomass can be placed on biomass, but copper shouldn't be placed on iron.

@simon987
Copy link
Owner Author

simon987 commented Apr 3, 2018

I think a good way to do it would be to assign an identifier for each possible structure ( "IRON_OBSTACLE", "ROCKET", etc), then hash them with something like sha1(identifier:secret key), place them in an HashMap<String, Blueprint>. Then, it will be easy to validate a blueprint from its hashed header. The rest of the plain blueprint data could be validated on a case-by-case basis

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants