[Code] My Hedgewars contributions

38 replies [Last post]
KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Some of you may noticed I started tinkering with the game's code and tried adding some features. Most of them were connected with themes, so I was posting it in the suggestion topic. However, it feels like it didn't get enough attention, so I'm making this new topic to keep a summary of my contributions.

List of my commits from the GitHub branch I created:
([X] means it was checked by a dev)
({A} means it was accepted for next release)

{A} Support for multiple inland rectangles
{A} Support for rising flakes
{A} Fixes to the two above
{A} Alternate sound paths
{A} Animated water
{A} Wind-mirrored flakes and clouds
{A} onVisualGearAdd/Delete and GetVisualGearType
[_] Locator system (alpha)
[_] Locator system (pre-beta)
[_] Locator system (beta)
{A} Objects on water
[X] Better placement
[_] Cofined spray areas
{A} onUsedAmmo hook

And the summary of features these add:
(notes are some code details)

Theme objects can now have multiple rectangles covered by land. Just add an additional number when defining object, which will tell how many of these rectangles there are.

Trivia: Both my theme editors are forward-compatible with this feature.

Example image allegedly wrote:

_

Flakes can now rise, not only fall. Previously, such flakes would fly forever and never appear again.
_

Sounds in themes can now be customized. Particularly, I allowed to replace splash and droplet sounds. If you replace them with silent sounds, you can remove water and make "abyss". Or replace splash with e.g. evil laugh or whatever, etc.
_

Water can be animated. Also, you can change the speed of water flowing. There's a new key for themes that does this:
water-animation = frames, frame ticks, movement speed
Default values are 1, 0, 1

Note: Sprites that use getDimensions flag have always initial height of 0. So using this fact, -1 means it's BlueWater and -2 is SDWater. Thanks to this, these sprites can be divided into given number of equal-sized frames. Also, new theme values for water animation are watFrames, watFrameTicks, watMove, watSDFrames, watSDFrameTicks and watSDMove.

Example image allegedly wrote:

_

You can add FlakeL and CloudsL images to your theme. These will display when the wind is flowing to the left.

Note: I added getSpriteByWind function. It looks neat, but I'm not sure about efficiency.

-

You can now track creation and deletion of visual gear, by using onVisualGearAdd(vgear) / onVisualGearDelete(vgear). Also, you can use GetVisualGearType(vgUID).

Note: I added the onVisualGearDelete for the sake of completion. I also don't know if they won't impact performance, as they are additional script calls, and visual gear is created/deleted more frequently than normal gear.

-

It's possible to provide URL downloads for your DLCs, so they are transferred if someone joins your room and doesn't have them.

-

You can make theme objects that stand on water. This can be achieved by making the first inland rectangle being 0,0,0,0.

Example image allegedly wrote:

-

Object/spray generation is changes, so they are distributed more equally across the map.

-

You can specify rectangles of LandTex within whose spray objects should generate.

Do it like:
spray = name, number, rect1x, rect1y, rect1w, rect1h, rect2x, ...
so basically just add four arguments for each rectangle. Sprays will be placed so they center is forced to appear inside random one of these rectangles.

Example image allegedly wrote:
Blue rectangles can appear only on red and black bars, centered vertically, but horizontally on the whole bar.
Purple circles can appear anywhere in white bars.

-

Added a LUA call when you make a complete action (onUsedAmmo).

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

UltiMaxKom
UltiMaxKom's picture
User offline. Last seen 41 min 42 sec ago. Offline
Joined: 2016-06-26
Posts: 271

KoBeWi allegedly wrote:

However, it feels like it didn't get enough attention.

Really ??? i think it was get "Great" Attention for the Contribution Big Grin
And these contribution is Highly, Support the game... bah ! im just talking XD
]{

My Favorite Point :
[ "We are Something That Come Out From Nothing" ]

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

UltiMaxKom allegedly wrote:
i think it was get "Great" Attention for the Contribution :D
I'm talking about my code changes. Sure, I got some help when I asked where to post this. But when I finally posted it, I got only one reply. 4 of 6 from my commits weren't commented if they are good or bad, to the point I made a triple post at the end. And it's like that for over a week.

Also, some devs posted on other topics at this time.
It's... heartbreaking.
Deagle! Heart

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

UltiMaxKom
UltiMaxKom's picture
User offline. Last seen 41 min 42 sec ago. Offline
Joined: 2016-06-26
Posts: 271

I maybe MUST NOT Make this "Long" Big Grin ... GL For the TRUE Help for Hedgewars Smile Heart

My Favorite Point :
[ "We are Something That Come Out From Nothing" ]

sheepluva
sheepluva's picture
User offline. Last seen 12 hours 57 min ago. Offline
Joined: 2009-07-18
Posts: 513

https://hg.hedgewars.org/hedgewars/rev/60c8bb8bc1d7
Thank you Smile

EDIT: Can you link me to the example theme using the multiple anchors theme objects? ^^

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

sheepluva allegedly wrote:
Thank you Smile

Np Wink Smiley

sheepluva allegedly wrote:
EDIT: Can you link me to the example theme using the multiple anchors theme objects? ^^
Here's one:
https://www.dropbox.com/s/if9q7gmq8gjxqpx/Factory.tar.gz?dl=1

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

sheepluva
sheepluva's picture
User offline. Last seen 12 hours 57 min ago. Offline
Joined: 2009-07-18
Posts: 513

https://hg.hedgewars.org/hedgewars/rev/7db5aef27e8d

Thanks again ^^

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Ok, I know this might be useless, but I added more visual gear handlers and they happen to work. You can now e.g. "disable" damage tags or speech bubbles using a script. Too bad there's no way to change text of speech bubbles (or is there?) Sad Smiley

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

My newest commit is out:
https://github.com/KoBeWi/myHedgewarsBranch/commit/af359f59843f709bad711582d75f8f71c31dcf3f
(ignore the change in visualGearsList)

This is the biggest commit I did so far.
It implements file transfer if you are missing themes/maps from net room.

The code is probably not perfect, and of course it's missing some features.
Firstly, it needs some cleanup. I couldn't rebuild the server for some reason, so I'm handling communication via special chat messages. These messages start with "hackyMessage,," and every instance of this hack is marked with comment //CHATHACK
The server handlers needed for this are LOCATOR_REQUEST and LOCATOR. First one needs to pass user nick and name of the resource, second one needs to pass user name, resource and the url for download. Of course this can be simplified, but I don't know if it's possible to e.g. respond directly to the specific client.

Secondly, I added some methods/hacks/modifications I needed. For example, there's getUser() in chat widget, which returns name of the current client. Also, I added amReady to PageNetGame to store ready status. The btnGo was remapped to btnGoPressed instead directly changing the ready state.

It is also possible that commit is missing the "download.png" icon. It can be found here: http://imgur.com/a/u2Xmw
It should go to QTfrontend/res

If there are other important notes I forgot about, I'll edit this. Or just ask if you find something strange.

BUT, most important is of course that this code works as expected ( ͡° ͜ʖ ͡°)

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

And another rather big commit: https://github.com/KoBeWi/myHedgewarsBranch/commit/ac6b4f0430bce848f8288da9b6a17a8b0fc6be47

This adds handlers for transferring the remaining resources. It's a bit more lacking in polish than the previous one, but gets the job done. I'm not finished yet, so cleaning is possibly coming too.

I had to add roomChief to newnetclient, because I didn't see other way to get the room owner. I also added cachedScriptName for GameCFGWidget, because I had to remember the script that failed to load. I hope these "hacks" aren't actually that bad. Just working with frontend requires changing things in many places at once, and I'm not that familiar with it.
Also, the missing icon is now included.

btw, more info on locators here: http://www.hedgewars.org/node/5957#comment-32520

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

It's done:
https://github.com/KoBeWi/myHedgewarsBranch/commit/9258f323b6a26e6bec18acbbb867c6c4607b27cc

File transfer works.
You can specify restrictions in options.
Map and theme updates on download.
Lots of bugs fixed.

It's now ready for testing, so if someone has time, he/she can try to break the system and report any bugs.

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

So, I just made my theme suggestion #7:
https://github.com/KoBeWi/myHedgewarsBranch/commit/2cc697ba790ce4edb7905692ab0f78c10dedd2f6

When object's first inland rectangle has x = y = w = h = 0, then it's y is forced at water level when trying to place. This allows for boats or anything on the water.

Fun fact is that game actually doesn't complain when rectangle has no size. It's effectively ignored while checking, so making an only one inland with no size allows for floating objects. However, it doesn't work good, because the object placement is biased.
I'm going to try to fix the placement, so it's not focused on one corner. After I've seen the algorithm, I now know why it looked bad for big maps.
Then I'll also try to make the Wuzzy's suggestion about sprays.

Also, screenshot:

Quote:

(that beanstalk to the right)

EDIT:

Ok, fixed.
This:

Quote:

vs this:
Quote:

As you can see, bottom-right corner on the first image is quite empty, while top-left is full of everything. On second image, both of them are somewhat equally populated.
Original algorithm started from top-left and moved slowly to bottom-right, stopping if found good spot.
After my modification, it randomly selects one of four corners and moves towards the opposite. Thanks to this, objects are distributed more equally across the map. However, the center is still quite empty Annoyed

Anyways, I'll do the same for sprays, but not today.

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

UltiMaxKom
UltiMaxKom's picture
User offline. Last seen 41 min 43 sec ago. Offline
Joined: 2016-06-26
Posts: 271

My Respones : "Wth a Great Job !!! I can't do that ;/ "
Is what can i say for these Outstanding Contribution Smile

Keep it up !!! Devs should happy see these Big Grin
And i should learn more from ye ;v

This what support might be (?) ... Vote + Rating 5 Stars + Like + Tag + And Subscribe these ...

]{

My Favorite Point :
[ "We are Something That Come Out From Nothing" ]

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

lol Ulti, you broke my 5 post combo XD

Anyways:
https://github.com/KoBeWi/myHedgewarsBranch/commit/0459c2645edb473e7322e117cb038bcbf2666e8b
This makes object/spray placement (possibly) better. There's also one change to my previous commit.

Now, onto the spray thing requested by Wuzzy.

EDIT:
Quick proof of concept.

Quote:

I managed to make cyan squares aligned to red lines. Right now everything is hardcoded, but I know it's possible at least.

EDIT2:

Quote:
Blue rectangles can appear only on red and black bars, centered vertically, but horizontally on the whole bar.
Purple circles can appear anywhere in white bars.

https://github.com/KoBeWi/myHedgewarsBranch/commit/7c16978aa400c67de6ac5f6f964bb2a894036e6b
Code uses my improved generation. Remove the dx/dy part if you want to use it with normal placement.

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

UltiMaxKom
UltiMaxKom's picture
User offline. Last seen 41 min 43 sec ago. Offline
Joined: 2016-06-26
Posts: 271

KoBeWi allegedly wrote:

lol Ulti, you broke my 5 post combo XD

ROFL XD !!!

Sorry then... have Send a Private Massage to you...

My Favorite Point :
[ "We are Something That Come Out From Nothing" ]

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

Quote:
onVisualGearAdd/Delete and GetVisualGearType

These are now implemented.

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

I added onUsedAmmo hook, which is called when you actually make a full attack, like two shotgun shots or such.
It can be maybe changed to even pass the ammo which was used, but I don't need it right now and it's not completely straight-forward, so it doesn't pass anything for now.

https://github.com/KoBeWi/myHedgewarsBranch/commit/de9bf6fa09976b19b1f72bed002333fb77b61e58

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

sheepluva
sheepluva's picture
User offline. Last seen 12 hours 57 min ago. Offline
Joined: 2009-07-18
Posts: 513

I have reviewed the wind-mirrored flakes code. Looks alright. I'll hopefully have a chance to test/merge it this evening Smile

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

I have tested the animated water. I think the idea is interesting, but I don't like the implementation so far. It needs some improvements before I would merge it.

Comments/observations:

  • The flowing speed seems to grow very fast (exponentionally?). This makes it pretty confusing to adjust. E.g. Speed 11 is WAY faster than speed 10. Why not making it linear?
  • The water doesn't move at all if flowing speed is >16
  • If the tick count is very low (0 or 1), setting the flowing speed has no effect. The animation tick should have no effect whatsoever on the flowing speed
  • Animation seems to work fine
  • Please don't put unrelated code (like indent fixes in uSound.pas) in your commits. It's not the end of the world and I could fix it on my own (obviously), but please just try to remember this for next time

I will test your other features soon.

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

OK, comments on your other contributions:

I've added onUsedAmmo. I changed it so that it also includes the ammoType as a parameter. I also fixed a bug in which it was called even if you didn't use any ammo (you press attack when you have no weapon selected).

Documentation of this function is here: https://hedgewars.org/kb/LuaAPI

I already commented on your Locator system earlier, you know my opposition to this.

Objects on water: This looks OK, but you said that it is not very good, so don't merge it for now, unless you change your mind. Could you please elaborate?

The balanced spray/object placement is a nice change, but I feel reluctant to merge it. This is a breaking change, it will break pretty much ALL old demos and random map seeds because the object positions of ALL random maps are changed. Sheepluva, nemo, unC0Rr, what do you think about this?

I would obviously love to merge the confined spray areas, but this commit depends on the previous thing. I also didn't test it so far.

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Wuzzy allegedly wrote:
The flowing speed seems to grow very fast (exponentionally?). This makes it pretty confusing to adjust. E.g. Speed 11 is WAY faster than speed 10. Why not making it linear?
I remember having some problems with how the water is flowing. It uses some strange formula I didn't really understand. I tried changing it so it's linear and easier to do, but it didn't work well. I'd have to look into it again.

Wuzzy allegedly wrote:
Please don't put unrelated code (like indent fixes in uSound.pas) in your commits.
Sorry about this Annoyed

Wuzzy allegedly wrote:
I already commented on your Locator system earlier, you know my opposition to this.
:(
The code for this could be done better tho.

Wuzzy allegedly wrote:
This looks OK, but you said that it is not very good, so don't merge it for now, unless you change your mind. Could you please elaborate?
My "it doesn't work good" part was not about objects on water, but flying objects. You can make nonexistent rectangles, so objects are placed on arbitrary position. However due to how the position is picked, it doesn't work well. My object placement fix might improve it, so we could have a totally flying objects. You could allow it, just for fun, but that requires some code.
Objects on water are actually fine.

Wuzzy allegedly wrote:
This is a breaking change, it will break pretty much ALL old demos and random map seeds because the object positions of ALL random maps are changed.
I think I wasn't able to run old demos in new HW, so it didn't matter to me, but maybe I'm mistaken >_>
It should be possible to keep the old code and execute it on old demos, so the generation would remain backward-compatible.

Wuzzy allegedly wrote:
I would obviously love to merge the confined spray areas, but this commit depends on the previous thing.
Well, you could change this one and remove the part from previous commit. It's quite easy to identify. If the fixed placement won't be able to be part of the game, I can even fix the confined thing myself, so it's ready to merge.

Anyways, thanks that someone looked into it finally. I'd really like to have these in game ASAP, so I could continue work on my new themes.

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

sheepluva
sheepluva's picture
User offline. Last seen 12 hours 57 min ago. Offline
Joined: 2009-07-18
Posts: 513

https://hg.hedgewars.org/hedgewars/rev/4d1250ca68ace6259d7d5e70b591b714d08ba8b8

Thank you.

What theme would you suggest to demonstrate this change?

Also: Any ideas by anybody regarding existing themes making use of this are welcome.

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Ok, here's the original formula for the water movement:

-TextureBuffer[3].X:= shift + ((LongInt(RealTicks shr 6) * Dir + dX) mod spriteWidth) / (spriteWidth - 1);

I'm not really sure why it uses shr function, and it's the one that gave me problems. I think I will try again to remove if and see if there is something wrong otherwise.

sheepluva allegedly wrote:
What theme would you suggest to demonstrate this change?
What do you mean exactly? >_>

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

KoBeWi allegedly wrote:

sheepluva allegedly wrote:
What theme would you suggest to demonstrate this change?
What do you mean exactly? >_>

Sheepluva wants to know if you have an idea which one of the existing theme (preferably one of the official ones) should be modified so it actually makes use of the flipped flakes or clouds.

For example: Halloween with flipped bats.
Sheepluva likes to see this feature in actual use in one of the official themes. But hasn't found any compelling use case so far.

It is not really important.

sheepluva
sheepluva's picture
User offline. Last seen 12 hours 57 min ago. Offline
Joined: 2009-07-18
Posts: 513

Wuzzy allegedly wrote:

KoBeWi allegedly wrote:

sheepluva allegedly wrote:
What theme would you suggest to demonstrate this change?
What do you mean exactly? >_>

Sheepluva wants to know if you have an idea which one of the existing theme (preferably one of the official ones) should be modified so it actually makes use of the flipped flakes or clouds.

For example: Halloween with flipped bats.
Sheepluva likes to see this feature in actual use in one of the official themes. But hasn't found any compelling use case so far.

It is not really important.

In this sentence I was also referring to KoBeWi's themes.
KoBeWi: Some of your themes use this feature, right? Which one would you recommend if someone wants to see wind-flipped flakes in action?

Oh and "shr 6" (shifting the value by 6 bit to the right) effectively is the same as "div 64".

  sheepluva <- me  my code stats -> 
a Hedgewars Developer


   <- where I'm from  what I speak -> 

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

sheepluva allegedly wrote:
In this sentence I was also referring to KoBeWi's themes.
Ah, so I was right.

sheepluva allegedly wrote:
KoBeWi: Some of your themes use this feature, right?
None of the ones I posted. However, I can make a pre-release of Beehive theme, right now. It doesn't use clouds though.

As for official themes, I'd recommend fish flakes for Underwater.

sheepluva allegedly wrote:
Oh and "shr 6" (shifting the value by 6 bit to the right) effectively is the same as "div 64".
Well, yeah, I knew this. I think my problem was the strange behavior of the water when changing speed. When I set it too high, the speed isn't reflected and the water flows slowly. Also, for some reason the game crashes on loading cfg when setting negative value.
In my previous commit I made it weirdly non-linear and assumed you should use values between 1 and 16.

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

Quote:
As for official themes, I'd recommend fish flakes for Underwater.

I quite like the jellyfish.

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Wuzzy allegedly wrote:
I quite like the jellyfish.
Oh, I thought it doesn't have flakes. Nevermind then.

Update on water:

(LongInt((RealTicks * waterSpeed) shr 6)
^ this doesn't work ;_;
That would be the simplest way otherwise.

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

Water objects are now included in Hedgewars, with a slightly changed code.
https://hg.hedgewars.org/hedgewars/rev/666e18b1ca32

It actually works out quite nicely.

Okay, KoBeWi. If you want the other things to get merged, just poke me when you have have reworked them in a usable state.

Can you also please try to rework the confined spray commit so it is independent from the rest? Ideally just make sure you work on HEAD.
That would make my life easier. Smile

EDIT:

And finally, can you please explain how the multiple in-land rectangles are supposed to work? Just give some example theme.cfg so I know the syntax. I want to update the HWKB entry (https://hedgewars.org/kb/Theme).

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Wuzzy allegedly wrote:
Can you also please try to rework the confined spray commit so it is independent from the rest? Ideally just make sure you work on HEAD.
That would make my life easier. Smile
https://github.com/KoBeWi/myHedgewarsBranch/commit/0ae705807028fa02f5d798c902ae3eec367e1242

Uh, I think I did it wrong. I still can't run 0.9.23 properly, so I reverted the code to older version and added new code on top of it. If you don't feel like copying these in correct places, I can make one more commit, but later ;_;
Also, I'm not sure if I did the border part right.

Wuzzy allegedly wrote:
And finally, can you please explain how the multiple in-land rectangles are supposed to work? Just give some example theme.cfg so I know the syntax.

Reupload of modified Factory theme: http://www.mediafire.com/file/5yfbzubdj7d7y2d/Factory.tar.gz

You just have to add one more number before you specify covered rectangle bounds.

EDIT:
btw Wuzzy, it's not that important, but you are merging my code under your name.

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

Quote:
btw Wuzzy, it's not that important, but you are merging my code under your name.

Oops. I will be more careful next time.

Sorry, I still don't get how or why multiple in-land rectangles work. Doesn't your change mean that all existing custom themes break because almost all of the existing numbers have to shift by 1 to the right?
Or is this number optional? But if it is optional, how does your code know the difference between X of first inland rectangle and the number of inland rectangles?

Just out of curiosity.

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Wuzzy allegedly wrote:
But if it is optional, how does your code know the difference between X of first inland rectangle and the number of inland rectangles?
It counts commas. 1 more number = 1 more comma = parity change.

EDIT:
Ok, I found the problem I had with water. Seems like the speed was loaded wrongly. It didn't accept -1 and did weird stuff above 9. My source build is totally messed up right now, but I should be able to fix this soon, so water-animation can be merged too.

EDIT2:
@Wuzzy
Here's the commit that fixes water animation:
https://github.com/KoBeWi/myHedgewarsBranch/commit/0f760a31f40df93c34145368b82bddb96a3d1b6d
Apply it to previous water animation code and it should work.

Water speed functionality has changed. 1 means normal speed, 2 is double speed, 3 triple etc. so it's now scaled linearly like it should in the beginning.

EDIT3:
And here's a theme, that shows the water feature well. (I didn't test it though) (also, theme has just land texture and water right now)

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

Animated water works great now. The water speed is now much more logical and practical to use.
This features has been merged into Hedgewars. Thanks for your contribution!

https://hg.hedgewars.org/hedgewars/rev/31184d9b9bfc
https://hg.hedgewars.org/hedgewars/rev/4d818abdc00f

The HWKB page has been updated accordingly.
https://hedgewars.org/kb/Theme

Note I have deleted some minor coding style changes from your commits (e.g. indentation in uSound.pas) as they were not relevant. I consider it best practice to keep "coding style commits" separate from "feature commits".

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

KoBeWi, your animated water fails badly when the Ocean world edge is used. The water animation is completely wrong at the edge.

Sad Smiley

Can you please reclone the current repository or just update your own repository and try to fix this bug?

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Any ideas how to fix my problem from that topic? It would be much easier for me to run the newest build, instead of juggling the code between versions Annoyed

EDIT:
Now that I think of it, you can make the water faster, but you can't make it slower. Maybe the value should get divided, so default one is 100 or 1000, so you can set a lower one? (if it's possible ofc)

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

This fixes water edge:
https://bitbucket.org/Tomasz_Chabora/random-hedgewars-branch/commits/ecb81cef0297a4a58afb8e6c7e80133c8b2d60f4

And this changes the way water speed works:
https://bitbucket.org/Tomasz_Chabora/random-hedgewars-branch/commits/420da2d7d064c069c3bd4a7e283c2b858acd81c8

It's now given in percents, so default value is 100. Ignore this commit if you don't want this behavior.

Also, ignore that I changed my repo to Bitbucket, while my account shouldn't really be used for stuff like Hedgewars, lol

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

Thanks. Both of these are merged.

I'll try to priotorize on important Hedgewars bugfixes from now on (the release is overdue), and less on new features.

Wuzzy
Wuzzy's picture
User offline. Last seen 1 week 2 days ago. Offline
Joined: 2012-06-20
Posts: 802

KoBeWi, if you want to really help us out, can you please try to fix a very annoying bug we have in the current developer version?

Flakes randomly flicker at cloud level. It's not fun to look at.

See here for more information:
http://issues.hedgewars.org/show_bug.cgi?id=157

I would really appreciate that if you could help here, I almost consider this bug to be a release blocker.

KoBeWi
KoBeWi's picture
User offline. Last seen 2 hours 37 min ago. Offline
Joined: 2010-12-25
Posts: 317

Does it block beta/pre-release though? I'll try to look into it this week.

EDIT:
Looks like I won't be needed: http://hg.hedgewars.org/hedgewars/rev/83131d0e747b

Theme Editor / Code contributions / WIP
"Official" themes:
Crystal | Belly | Dreamland | Sky | Factory
"Unofficial" themes:
Chalk | Bowser | GIRDERZZZ!!! | Mirage | Sudra | Zombie
Contributed themes:
Cyberspace

Copyright © 2004-2017 Hedgewars Project. All rights reserved. [ contact ]