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
Planet Scanner equipment type (ideal for newcomers) #3287
Comments
hey Laarmen, just letting you know I haven't dropped off the face of the earth. I'll be in touch... |
Hello laarmen, Kind regards, Pieter |
@cccpxx78 Hi! We'd love to have you on board. As far as I know, @CmdrBugbear has dropped off the face of the Earth, so as far as I know this is up for grabs. (You can also find us on IRC.) |
@impaktor @laarmen Hi all, I pushed some code to my fork of pioneer. Could someone have a look to see if what I'm doing is going in the right direction or is even in correct part of the code? If general idea of what i'm doing is somewhat OK it is definitely not working code at this point, I know that at least these issues need to ironed out on a c++/project level (the logic and how it will be used is far from finished): Some questions at this point
know issues in this version for me to investigate/fix:
|
Equipment are handled in Lua nowadays (used to be in C++), so the idea was to implement it in data/libs/Equipment.lua I think. @laarmen correct me if I'm wrong. Otherwise, great to see that you've worked on this. And Lua is easy. Just some minor pitfalls for C/C++ coders, like table index starting on 1 (by default), and how |
Ok thanks for the feedback, I had the impression that what I was doing was wrong. |
Yeah. The rule of thumb for this task is that if you open a cpp file, Welcome, and kudos for picking this up. Le dim. 10 mai 2015 à 17:17, cccpxx78 notifications@github.com a écrit :
|
OK, so. In my opinion the first step is to add the new slot "sensors". This should be a one liner in EquipSet.lua, plus maybe some adjustments in the ships json definitions (a scout should have lots of sensor slots). As a side note, this issue is just about providing the equipment frame for the sensors. @impaktor, have you made an issue for your side of the story yet? :-) |
@laarmen sorry I couldn't make it to IRC yesterday. I will make sure to join the channel when I'm working on this but I can't be on irc all the time (maybe in the future when I set up a VM-screen-ircII-ssh session I can be online more). Thank you for the input, I have taken the first step as you mentionned and pushed to my fork. creating a sensor (BodyScanner) in Equipement.lua? I will try some things and push them to show the direction in which I'm thinking. I will clean up the commits when needed. |
No problem. So, this was the easy part. Now, the hard part: the design. In any case, your BodyScanner object will have more methods than the typical EquipType. You have two choices.
Ordinarily I would very much prefer the second way, but this issue has run a bit too long, so I'd suggest to just go with the quick 'n easy way, we merge that, and after that have another take at it and do it the "generic" way. |
I cleaned up the commits and pushed to a new branch 'sensor'. Next steps could be:
|
Sure, go for it. I don't think we have up-to-date documentation anywhere on the Web, but an old version can be found at http://eatenbyagrue.org/f/pioneer/codedoc/files/LuaBody-cpp.html About the coding style : we're a bit fuzzy on that front, esp. for the Lua side. Just try to mimic Equipment.lua coding style and you should be fine :-) The Lua target version is 5.2. If you can write it to also be 5.3 compatible without sacrificing readability, go for it! |
Hi @laarmen, I did some style cleanup in the lua. Something else I was thinking is that now the altitude is calculated to the center of the body (I think) should I compensate for the radius of the body? This is important maybe when the scanner has a max_range and the surface is in range but the center isn't for example. next actions for the first step are? are there any test I should write? for the second step, the general class:
This is probably not within the scope of this issue anymore, and I also think I did it the wrong way but is was a good exercise: I need to dive into the documentation some more, any tips for some relevant wiki pages for me to read? |
My comments below are without looking at the code, nor even at the (oh, and I might be slightly sleep deprived) Quoting cccpxx78 (2015-05-21 19:54:26)
I'm guessing you made the right call. The specs were mostly a guideline
No, altitude is calculated from the surface, otherwise it would make If it ain't, I would file a bug.
Writing tests is something we are generally not good at. I think the (Usually, people contribute more to Pioneer when in vacation.
I don't have any concrete example off the top of my head, although I'm I'd write something along the lines of that (once again, without your bodyscanner = SensorType.New(
{mass=1,
....,
measurement_interval=5,
onScanStart = function(self, ship)
self.targets[ship] = {planet=ship:getClosestBody(),altitude=ship:getAltitude()}
end,
hasProgressed = function(self, ship)
local target = self.targets[ship]
return target[1] == ship:getClosestBody() and target[2]/ship:getAltitude() < 0.05 ;; Allow a 5% margin of error
end
})
As I said, if you write C++ you're doing it wrong ;-)
About the UI? I don't think we have any documentation. From what I |
I told @cccpxx78 to do the meter bar in c++, as well as the on/off button, since that is where all other code is that does the same, so just duplicate what we have. To go into new-ui territory is asking too much I think since none of the in-house devs cracked that nut yet, we should not scare @cccpxx78 away. |
Quoting Karl F (2015-05-22 09:42:17)
Oh ye of little faith! |
ok, got it. I added an OnClear function too. |
Feel free to open a PR for the equipment part even if you don't consider your work as ready. It will allow us to review it in a more efficient fashion (I'll tag it as WIP and assign it to myself). The UI part should go into another part, and I'm designating @impaktor as volunteer for that one ;-) |
This is a feature asked for by @impaktor. I was supposed to write it, but it occurs to me that it would be a nice way to start contributing to Pioneer. I have ironed out a specification document, and I would of course be willing to mentor anyone interested.
Here's a quick dump of the specs (it was written quickly on a PiratePad, so it lacks a bit structure.)
Design document for the scout thingy.
Goal of the document ?
For me (laarmen): design an API that is generic enough so that we wouldn't have to reinvent it every time a similar request comes along.
Usage:
A general equipment that draws a progress bar. -> The equipment shouldn't draw the bar, only provide the data needed to draw it.
Problem: the client needs to check that the object is actually our thingy, otherwise it would call a nil value, which results in mayhem.
Proposal:
Bonus points:
The text was updated successfully, but these errors were encountered: