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

Ducks are not spawning! #8584

Closed
deurklink opened this issue Jan 11, 2019 · 24 comments
Closed

Ducks are not spawning! #8584

deurklink opened this issue Jan 11, 2019 · 24 comments
Labels
bug Something went wrong.

Comments

@deurklink
Copy link
Contributor

OS: Windows 10
Version: 0.2.1
Commit/Build: 746feaa

Ducks no longer seem to spawn!

Steps to reproduce:

  1. Create large body of water (code says you need at least 25 tiles of water at same height in a 7x7 area)
  2. Wait forever
  3. No ducks seem to spawn
@Gymnasiast Gymnasiast added the bug Something went wrong. label Jan 11, 2019
@Gymnasiast
Copy link
Member

Heavens, no! We must fix this immediately!

@LordMarcel
Copy link

There are flying ducks but no swimming ducks
image

@deurklink
Copy link
Contributor Author

That's interesting, because I thought they always have a water body as target.. Could it be that the coordinates are somehow wrong?

@tomlankhorst
Copy link
Contributor

tomlankhorst commented Jan 18, 2019

The month must be <= APRIL, checked that? I've checked in Crazy Castle on devel and the ducks spawn fine.

if (month <= MONTH_APRIL && water_type != nullptr && water_type->flags & WATER_FLAGS_ALLOW_DUCKS)
{
// 100 attempts at finding some water to create a few ducks at
for (int32_t i = 0; i < 100; i++)
{
if (scenario_create_ducks())
break;
}
}
}

@deurklink
Copy link
Contributor Author

Yes I know that, I only check in March and April

@janisozaur
Copy link
Member

But april < april does not hold.

@AaronVanGeffen
Copy link
Member

But april < april does not hold.

april <= april does, fortunately. ;)

@janisozaur
Copy link
Member

I see the earlier comment got amended to fix that. Indeed, the code linked has LE, rather than LT, but I overlooked that.

@tomlankhorst
Copy link
Contributor

@deurklink But you haven't seen any ducks?

If you're building from source you could set a breakpoint at openrct2/scenario/Scenario.cpp:425 to see what happens when the game tries to create the ducks.

@deurklink
Copy link
Contributor Author

I know, and I already played a bit with that to see what would happen, but not enough to draw any conclusions from it yet

@tomlankhorst
Copy link
Contributor

Well, I wonder, does it ever come to line 465? Then it should draw ducks.
If it doesn't, but it comes to line 461, no (found) water is big enough.
,, ,, line 443, no (found) water height is zero.
,, ,, line 438, no (found) water is in the park.

Of course, it might be less simplistic than that but that should at least point out where the logical flaw is.

@ZehMatt
Copy link
Member

ZehMatt commented Jan 18, 2019

Another important factor is that the tiles are randomly selected if you don't have a lot of water then its less likely they will spawn.

@deurklink
Copy link
Contributor Author

One map I tested on was Leafy Lake.. That one should have enough water, right?

@ZehMatt
Copy link
Member

ZehMatt commented Jan 18, 2019

You still have to consider when I'm talking random tile it literally picks a random value for x and y within the range of the entire map not just within your park and that only happens once per game week, so yes and no?

@tomlankhorst
Copy link
Contributor

@ZehMatt, well, the current implementation spends a maximum of hundred tries to find a single suitable tile for spawning, so in practice, this should often be successful in a water-rich map.

@deurklink To be certain, you are looking for them on the closest zoomlevel, right? What's on line 9 of your object/rct2/water/rct2.wtrcyan.json in the data directory?

"allowDucks": true,

@deurklink
Copy link
Contributor Author

OK, i checked some more scenarios now.

Ivory towers: Spawns ducks
White Water Park: Spawns ducks
Leafy Lake: No ducks
Mega Park: No ducks
Forest frontiers had no ducks when i filled the entire map with water. When i used the own all land cheat however, ducks started to spawn in areas of land that were outside the normally owned land.
I think the function just generates very specific coordinates.. Gonna take a look at the coordinates it generates to try duck spawning.

@tomlankhorst
Copy link
Contributor

tomlankhorst commented Jan 20, 2019 via email

@deurklink
Copy link
Contributor Author

deurklink commented Jan 20, 2019

OK I think i found an issue.. The tile coordinates it generates are all between 64 and 255-64. To illustrate what that means in Forest Frontiers, the icy area is where the game will never check for water to create ducks at..
image

Also note that the land has to be owned by the player for a tile to be considered.

@deurklink
Copy link
Contributor Author

And here's Leafy Lake..
image
I think we've found the root of the ducks issue 😁

@deurklink
Copy link
Contributor Author

deurklink commented Jan 20, 2019

OK I replaced the original code for coordinate generation:

    x = (scenario_rand() & 0xFF) * 32;
    y = (scenario_rand() & 0xFF) * 32;

    //original code:
    //x = ((r >> 16) & 0xFFFF) & 0x7F;
    //y = (r & 0xFFFF) & 0x7F;
    //x = (x + 64) * 32;
    //y = (y + 64) * 32;

And look at that! A leafy lake full of ducks!
image

@tomlankhorst
Copy link
Contributor

tomlankhorst commented Jan 20, 2019 via email

@deurklink
Copy link
Contributor Author

Actually, it seems to be intended (hence the x+64 part). I just checked in vanilla rct2 and it looks like an original bug (or intended behaviour). In Crazy Castle, for example, the ducks only stick to a small corner of the map.

deurklink added a commit to deurklink/OpenRCT2 that referenced this issue Jan 20, 2019
@janisozaur
Copy link
Member

Nice job there @deurklink

Gymnasiast added a commit that referenced this issue Mar 4, 2019
The fix has been reverted because it caused other problems and no follow-up has yet been merged.
@Gymnasiast Gymnasiast reopened this Mar 4, 2019
@Gymnasiast
Copy link
Member

Reopening since the fix has been reverted (it caused crashes).

ZehMatt added a commit to ZehMatt/OpenRCT2 that referenced this issue Aug 6, 2019
ZehMatt added a commit to ZehMatt/OpenRCT2 that referenced this issue Aug 24, 2019
ZehMatt added a commit to ZehMatt/OpenRCT2 that referenced this issue Oct 2, 2019
ZehMatt added a commit to ZehMatt/OpenRCT2 that referenced this issue Oct 2, 2019
janisozaur added a commit that referenced this issue Oct 28, 2019
- Feature: [#9285] Remember current group in scenario list window.
- Feature: [#9918] Increase image list capacity by about 100k units.
- Change: [#1349] Increase the number of ride music played simultaneously from 2 to 32.
- Fix: [#4927] Giant screenshot cut off at bottom and top.
- Fix: [#7572] Queue paths connect to regular paths through fences.
- Fix: [#7690] Problem with guests freezing on certain tiles of path.
- Fix: [#7883] Headless server log is stored incorrectly if server name contains CJK in Ubuntu
- Fix: [#8136] Excessive lateral G penalty is too excessive.
- Fix: [#8584] Duck spawning function does not check tiles with x or y coordinate of 0..64 (Original bug)
- Fix: [#9179] Crash when modifying a ride occasionally.
- Fix: [#9533] Door sounds not playing.
- Fix: [#9574] Text overflow in scenario objective window when using CJK languages.
- Fix: [#9603] Don't render audio when master volume is turned off.
- Fix: [#9625] Show correct cost in scenery selection.
- Fix: [#9669] The tile inspector shortcut key does not work with debugging tools disabled.
- Fix: [#9675] Guest entry point limit can be bypassed in scenario editor.
- Fix: [#9683] Cannot raise water level if part of the tool's area of effect is off of the map.
- Fix: [#9684] Entering custom size for water/land tool allows confirmation with main enter key, but not numpad enter key.
- Fix: [#9690] The keyboard shortcut for rotating the game view can be set to Enter or KP Enter, but not both.
- Fix: [#9717] Scroll bars do not render correctly when using OpenGL renderer.
- Fix: [#9729] Peeps do not take into account height difference when deciding to pathfind to a ride entrance (original bug).
- Fix: [#9902] Doors/Portcullis do not check to make sure doors are open causing double opens.
- Fix: [#9926] Africa - Oasis park has wrong peep spawn (original bug).
- Fix: [#9953] Crash when hacked rides attempt to find the closest mechanic.
- Fix: [#9955] Resizing map in while pause mode does not work and may result in freezes.
- Fix: [#9957] When using 'no money' cheat, guests complain of running out of cash.
- Fix: [#9970] Wait for quarter load fails.
- Fix: [#9994] Game action tick collision during server connect and map load.
- Fix: [#10017] Ghost elements influencing ride excitement.
- Fix: [#10036] Do not allocate large chunks of memory for save file classification.
- Fix: [#10106] Ride circuits should not be used for modes that do not support it.
- Fix: [#10149] Desync in headless mode with rides that create smoke particles.
- Improved: [#9466] Add the rain weather effect to the OpenGL renderer.
- Improved: [#9987] Minimum load rounding.
- Improved: [#10125] Better support for high DPI screens.
XplosiveLugnut pushed a commit to XplosiveLugnut/OpenRCT2 that referenced this issue Apr 27, 2020
XplosiveLugnut pushed a commit to XplosiveLugnut/OpenRCT2 that referenced this issue Apr 27, 2020
- Feature: [OpenRCT2#9285] Remember current group in scenario list window.
- Feature: [OpenRCT2#9918] Increase image list capacity by about 100k units.
- Change: [OpenRCT2#1349] Increase the number of ride music played simultaneously from 2 to 32.
- Fix: [OpenRCT2#4927] Giant screenshot cut off at bottom and top.
- Fix: [OpenRCT2#7572] Queue paths connect to regular paths through fences.
- Fix: [OpenRCT2#7690] Problem with guests freezing on certain tiles of path.
- Fix: [OpenRCT2#7883] Headless server log is stored incorrectly if server name contains CJK in Ubuntu
- Fix: [OpenRCT2#8136] Excessive lateral G penalty is too excessive.
- Fix: [OpenRCT2#8584] Duck spawning function does not check tiles with x or y coordinate of 0..64 (Original bug)
- Fix: [OpenRCT2#9179] Crash when modifying a ride occasionally.
- Fix: [OpenRCT2#9533] Door sounds not playing.
- Fix: [OpenRCT2#9574] Text overflow in scenario objective window when using CJK languages.
- Fix: [OpenRCT2#9603] Don't render audio when master volume is turned off.
- Fix: [OpenRCT2#9625] Show correct cost in scenery selection.
- Fix: [OpenRCT2#9669] The tile inspector shortcut key does not work with debugging tools disabled.
- Fix: [OpenRCT2#9675] Guest entry point limit can be bypassed in scenario editor.
- Fix: [OpenRCT2#9683] Cannot raise water level if part of the tool's area of effect is off of the map.
- Fix: [OpenRCT2#9684] Entering custom size for water/land tool allows confirmation with main enter key, but not numpad enter key.
- Fix: [OpenRCT2#9690] The keyboard shortcut for rotating the game view can be set to Enter or KP Enter, but not both.
- Fix: [OpenRCT2#9717] Scroll bars do not render correctly when using OpenGL renderer.
- Fix: [OpenRCT2#9729] Peeps do not take into account height difference when deciding to pathfind to a ride entrance (original bug).
- Fix: [OpenRCT2#9902] Doors/Portcullis do not check to make sure doors are open causing double opens.
- Fix: [OpenRCT2#9926] Africa - Oasis park has wrong peep spawn (original bug).
- Fix: [OpenRCT2#9953] Crash when hacked rides attempt to find the closest mechanic.
- Fix: [OpenRCT2#9955] Resizing map in while pause mode does not work and may result in freezes.
- Fix: [OpenRCT2#9957] When using 'no money' cheat, guests complain of running out of cash.
- Fix: [OpenRCT2#9970] Wait for quarter load fails.
- Fix: [OpenRCT2#9994] Game action tick collision during server connect and map load.
- Fix: [OpenRCT2#10017] Ghost elements influencing ride excitement.
- Fix: [OpenRCT2#10036] Do not allocate large chunks of memory for save file classification.
- Fix: [OpenRCT2#10106] Ride circuits should not be used for modes that do not support it.
- Fix: [OpenRCT2#10149] Desync in headless mode with rides that create smoke particles.
- Improved: [OpenRCT2#9466] Add the rain weather effect to the OpenGL renderer.
- Improved: [OpenRCT2#9987] Minimum load rounding.
- Improved: [OpenRCT2#10125] Better support for high DPI screens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something went wrong.
Projects
None yet
Development

No branches or pull requests

7 participants