BluSunrize / ImmersiveEngineering

Wires, transformers, high voltage! Bzzzzt!
Other
789 stars 393 forks source link

Wire connector validation wacked up. #392

Closed theunkn0wn1 closed 9 years ago

theunkn0wn1 commented 9 years ago

Issue: Wire validation is... wonky

when attempting to connect two wire connectors of the same type together, there are quite a few scenarios where the LOS is clear yet "the connection is obstructed" I have attached several images below showing this.

image Unable to connect the HV Connector to the relay image image That last one works from one direction but not the other

image I had to remove the wall mount to allow the MV connectors, whom have LoS with the wall mounts in place, for the connection to validate image between the breaker and the first relay, <1 meter distance

running latest IE build, 0.6.0_pre c584f5f6af907554a718841a7dea0a14f33eb054

BluSunrize commented 9 years ago

Raytracing is a BITCH. Seriously, I have sunk so much time into it and it's still really wonky. Problem is that I dunno how to properly fix it, and I've tried quite a few things, so thsi is low priority for now

theunkn0wn1 commented 9 years ago

Idk what you did as of late, but its been more wonky than normal. I reported this because it got worse, not better/stayed same. Before it was acceptable, but a little twitchy. Now, its just got that itchy nope.avi finger on hotkey.

Barhandar commented 9 years ago

Which point of the connector block it's raytracing from?

theunkn0wn1 commented 9 years ago

as i understand its supposed to be the tip of the connector; the end opposite the mounting side. for relays its 'bottom' with a little offset. Its supposed to be the same point the cables render draws to/from Did i get that right @BluSunrize?

BluSunrize commented 9 years ago

You kinda did. Every IImmersiveConnectable can return its own specific raytrace offset. I usually specify these with a little leeway, to avoid colision inside the connector itself. THis is also what made this more wonky, because before I literally had a check that allowed connections to for when the raytrace connected with the object it originated from. Effectively allowing you to connect through walls because it said "All clear" at the start of the trace. xD

cobra commented 9 years ago

I know exactly why the connection checks fail in all of these cases. Minecraft's raytracing is completely idiot^W^Wa bit stupid for these use cases, but I have several ideas for solving the corner cases of hitting the starting (for the raytracing, the second one clicked) connector while still checking the rest of the distance properly without reimplementing the whole algorithm. EnderCore is doing the latter and finding all colliding blocks, not just the first one, but I don't like stealing and modifying vanilla MC code. Damn license issues. There's nothing usable yet, I'm still testing and experimenting - will report back when I've got reliable results.

Does anybody have a set of test cases which should and should not be able to connect?

BTW, @theunkn0wn1: your last test case (HV relay directly adjacent to a breaker) works only when connecting from the relay to the breaker, not the other way round. I'm a bit unsure whether your fourth example should be valid or not. Related: the MV connector bounding boxes are a bit too short when compared to the rest.

cobra commented 9 years ago

The first case (HV Relay to HV Connector at the same height) is now working, as well as some other cases of the wire going towards the base of the connector. The last case (Breaker and HV Relay) is also working in both directions. Connecting two connectors on the same block around the corner still needs some work. I'll push later, it's a small addition and shouldn't break anything.

Spoiler:

cobra commented 9 years ago

I'm getting somewhere. Nearly all test cases I came up with are working, I just need to iron out some inconsistencies (one direction works, the opposite one does not). Testing everything takes quite some time -_-

@BluSunrize do you have a date for 0.6 or testing 0.6 before releasing? I'd be happy get this into 0.6.

BluSunrize commented 9 years ago

Please PR it @cobra atm no date for 0.6 since my release hinges on me getting off my lazy ass and making the final changes+tests to the energy system and Unwritten wrapping up pipes+pumps

But yeah, if you can get it done within the next ~5 days or so, it'll probably be in =P

cobra commented 9 years ago

Should be absolutely doable. It's not much code, I'm just catching the case "hit block == starting block" and restarting the raytrace from a slightly different point to avoid hitting the the same block again. I still have to modify a bit of the logic selecting the direction to move, which isn't that easy when considering all the orientations of a connector and the offsets involved. Will work on that later this evening.

btw, my debugging world experienced partial(!) cable loss after updating my working branch from 94e3827 to c521543, which hasn't happened before. This might or might not be a sign of the lovely zombie bug #160. Also OT, just a heads-up: I've found some weirdness around disconnecting wires from HV connectors and not being able to attach a new one afterwards. This also happened before pulling in your massive changes, so it's not related to those. I'll test this a bit further to get a clear and reproducible test case.

cobra commented 9 years ago

Tested a whole lot of cases, couldn't find any bugs or inconsistencies, cleaned up and pushed to https://github.com/cobra/ImmersiveEngineering/commit/722b23c99db223583f82cd3fe9474cb6476c20c9 There could have been some other solutions:

I also made the bounding box and raytrace offset of MV connectors fit their model better (https://github.com/cobra/ImmersiveEngineering/commit/2872c90f0477748d585bc98eac3d18d6b0cfb59a), but this is independent of the raytrace change.

Please have a look and test it - everyone's invited to play around with it and comment.

OT: there are at least two really nasty show-stopping bugs in your current master branch, both related to the major changes you did during the last days. I'll write issues for them and the other bugs I found while working on this.

malte0811 commented 9 years ago

Answer to OT: I am going to pr some changes as well (probably this evening), these are fixes for stuff that broke because of these changes and the cme changes, mostly the wirecutter working sometimes, sometimes not at all and sometimes giving coils infinitly, also the existance of cables that are registered in one direction only. If those are the issues you found, i know fixes for them, so no need for a bug report.

cobra commented 9 years ago

@malte0811 yep, the wire cutter duping coils without ever disconnecting the wires is one of them. I haven't noticed any direction issues, but haven't used the wire for energy transfer yet. The other one looks like #160, but is definitely a regression (see above for the commit range). Are you working on that as well or should I investigate and write a report? The third one, maybe related, is HV connectors sometimes refusing any connections after removing an existing connection. I'm just building some test cases, but won't spend too much time on this then - you're more familiar with the energy net code than me, I think. Thanks for the information!

malte0811 commented 9 years ago

I am not working on the second issue, the third one will probably be resolved by my changes.

cobra commented 9 years ago

Final OT comment: I merged both PRs locally and tested again - everything is working (again) as intended, all the bugs I mentioned above are gone.

cobra commented 9 years ago

@BluSunrize you can close this now.