This is a minor bug fix for the current shadowing algorithm to remove some pretty common artifacts. It would be possible (and easy) to make sure there are no artifacts by blindly recalculating everything from scratch whenever something changes, but thats computationally expensive, so I have tried to do something more selective but this can (and does) lead to artifacts. In doing this and accounting for all the weird and wonderful things that can go wrong I have learnt three things:
- The code is becoming ugly due to all the checks
- There are an arbitrary number of things that can go wrong, so there will ALWAYS be artifacts
- A fundamental re-design is required somewhere
I have decided on the redesign. I can change from using "sets" to "dicts" to store shadow info and this should lead to no artifacts (by adding shadow "depth" to each square instead of just seeing if it is in shadow). I will start coding that up now, but I thought I'd put up a minor fix to the current shadow algorithm.
One of the neat new things that shadow depth can do is differentiate between "completely visible" and "completely occluded", so Plague will be able to have things like smoke/bushes that gradually blocks LOS. Thats going to be pretty sweet.
It's actually been really good having these artifacts since it never would have occured to me to come up with this new implementation if I hadnt had to tackle them, and Plague likely never would have gotten partial occlusion. I was chatting with Tom Forsyth a few months back and he asked me if Plague could have partial line of sight through shrubs, and I said it would probably lead to spaghetti code (which is what I have now anyway due to artifact removal) or a redesign (which I wasnt keen on since I had no idea how to redesign it better at that time) and so I stored that idea in the "too hard basket". It's funny how things work out. I'm also now wondering if my new "additive" shadow solution is fairly well known to the games industry... anyone know?
- Changed the way the game checks for the addition and removal of shadows.

1 comments:
徵信社,尋人,偵探,偵探社,徵才,私家偵探,徵信,徵信社,徵信公司,抓猴,出軌,背叛,婚姻,劈腿,感情,第三者,婚外情,一夜情,小老婆,外遇,商標,市場調查,公平交易法,抓姦,債務,債務協商,應收帳款,詐欺,離婚,監護權,法律諮詢,法律常識,離婚諮詢,找人,追蹤器,GPS,徵信,徵信公司,尋人,抓姦,外遇,徵信,徵信社,徵信公司,尋人,抓姦,外遇,徵信,徵信社,徵信公司,尋人,抓姦,外遇,徵信,徵信社,徵信公司,尋人,抓姦,外遇,徵信社
Post a Comment