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

Update func_vehicle for multiplayer #737

Closed
wants to merge 6 commits into from
Closed

Update func_vehicle for multiplayer #737

wants to merge 6 commits into from

Conversation

UnrealKaraulov
Copy link
Contributor

@UnrealKaraulov UnrealKaraulov commented Mar 15, 2022

  • new CVar: mp_legacy_vehicle_block.

Video desc:

@UnrealKaraulov UnrealKaraulov changed the title Update func_vehicle for multiplayer. Added mp_legacy_vehicle_block cvar. Update func_vehicle for multiplayer: Added mp_legacy_vehicle_block cvar. Mar 15, 2022
@SergeyShorokhov SergeyShorokhov requested a review from s1lentq March 15, 2022 13:00
@SergeyShorokhov SergeyShorokhov added Type: 🚀 enhancement Improvement or addition of a new feature. Priority: 🕒 low Low priority tasks that can be postponed for the future. labels Mar 15, 2022
@UnrealKaraulov
Copy link
Contributor Author

@s1lentq Хотим на сервер карт с машинами залить типа big_city2 всем нравятся карты, даже пусть физика у машин не самая лучшая)))

но вот некоторые проблемы сильно мешают использовать такие карты на сервере!

В общем на картах с машинами невозможно играть по двум причинам...

1 - это убийство своих.
2 - убийство врагов без отображения кила.

Тут все решается.
Записал два видео.

@SergeyShorokhov SergeyShorokhov changed the title Update func_vehicle for multiplayer: Added mp_legacy_vehicle_block cvar. Update func_vehicle for multiplayer Mar 15, 2022
dist/game.cfg Outdated Show resolved Hide resolved
regamedll/dlls/game.cpp Outdated Show resolved Hide resolved
Unreal Karaulov and others added 2 commits March 15, 2022 16:25
Co-authored-by: Sergey Shorokhov <[email protected]>
Co-authored-by: Sergey Shorokhov <[email protected]>
@UnrealKaraulov
Copy link
Contributor Author

UnrealKaraulov commented Mar 15, 2022

Так же если заметили отключил m_pDriver = nullptr когда игрок отключает управление машиной, что это дает, видно на последнем видео.

@SergeyShorokhov
Copy link
Member

SergeyShorokhov commented Mar 15, 2022

Так же если заметили отключил m_pDriver = nullptr когда игрок отключает управление машиной, что это дает, видно на последнем видео.

I am not sure that these changes will be the correct behavior for the entity. Because, in actuality, the entity ALWAYS does not have a driver after the player has left the vehicle. And this is the correct behavior for GameDLL.

If you want the gameplay to consider a kill from the vehicle after the player has left it, you need to handle this as a specific case.

@SergeyShorokhov SergeyShorokhov self-requested a review March 15, 2022 13:39
@UnrealKaraulov
Copy link
Contributor Author

UnrealKaraulov commented Mar 15, 2022

Так же если заметили отключил m_pDriver = nullptr когда игрок отключает управление машиной, что это дает, видно на последнем видео.

I am not sure that these changes will be the correct behavior for the entity. Because, in actuality, the entity ALWAYS does not have a driver after the player has left the vehicle. And this is the correct behavior for GameDLL.

If you want the gameplay to consider a kill from the vehicle after the player has left it, you need to handle this as a specific case.

In multiplayer need known who is latest driver for give frag him.
Now fixed default behavior, added check for behavior cvar.

Ну смысл данного квара что бы сделать все иначе чем в оригинале, в общем если я правильно понял включил проверку на mp_legacy_vehicle_block в данные изменения, теперь все устраивает ? :(

Так же заметил что при выходе игрока m_pDriver не устанавливался в NULLPTR и добавил это в ClientDisconnected. Правильно ли я сделал? Или это избыточная проверка и ничего не случилось бы?

(Допустим игрок пишет disconnect во время разгона, и автомобиль убивает что-нибудь, m_pDriver все еще будет указывать на этого игрока. И не знаю к чему это приведет, по этому на всякий случай добавил очистку в ClientDisconnected, хотя ее изначально нет в GameDLL)

@hajimura
Copy link
Contributor

Допустим игрок пишет disconnect во время разгона, и автомобиль убивает что-нибудь, m_pDriver все еще будет указывать на этого игрока. И не знаю к чему это приведет, по этому на всякий случай добавил очистку в ClientDisconnected, хотя ее изначально нет в GameDLL

I think, there shouldn't be a problem with it. Just in case we could add has_disconnected check

@UnrealKaraulov
Copy link
Contributor Author

UnrealKaraulov commented Mar 15, 2022

@hajimura but m_pDriver is not nullptr! This check not works in this case, because m_pDriver not nullptr if player disconnected.

@wopox1337 Now all okay or need some more changes ?

@hajimura
Copy link
Contributor

but m_pDriver is not nullptr!

we could add has_disconnected check

@UnrealKaraulov
Copy link
Contributor Author

UnrealKaraulov commented Mar 15, 2022

we could add has_disconnected check

has_disconnected not require valid CBasePlayer struct ? or this class not deleted after player disconnect?

@SergeyShorokhov
Copy link
Member

Waiting for @s1lentq review

@hajimura
Copy link
Contributor

hajimura commented Mar 15, 2022

this class not deleted after player disconnect?

Yep. Slot that was released after player disconnect still has CBasePlayer class, just sets FL_DORMANT flag (https://github.com/s1lentq/ReGameDLL_CS/blob/master/regamedll/dlls/cbase.cpp#L844-L854) and he updates after player connect

@UnrealKaraulov
Copy link
Contributor Author

UnrealKaraulov commented Mar 15, 2022

@hajimura if player disconnected, but in this time, connected another player ?

yes, this is very rary case, i think your variant is better

@hajimura
Copy link
Contributor

🚢

Thanks to #737 (comment) help!
Copy link
Contributor Author

@UnrealKaraulov UnrealKaraulov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think all okay

@SergeyShorokhov
Copy link
Member

The new functionality needs to be introduced in a different way. At least this way:

  CFuncVehicle::m_hLastDriver;
  EntityHandle<CBaseEntity> m_hLastDriver;

and need to think better about the CVar name

@UnrealKaraulov

This comment was marked as off-topic.

@UnrealKaraulov

This comment was marked as abuse.

@UnrealKaraulov

This comment was marked as resolved.

@UnrealKaraulov

This comment was marked as resolved.

@rehlds rehlds deleted a comment from UnrealKaraulov Mar 17, 2022
s1lentq pushed a commit that referenced this pull request Dec 6, 2022
* Update func_vehicle for multiplayer. Added mp_legacy_vehicle_block cvar.

* Update dist/game.cfg

Co-authored-by: Sergey Shorokhov <[email protected]>

* Update regamedll/dlls/game.cpp

Co-authored-by: Sergey Shorokhov <[email protected]>

* Fix default behavior

* Optimization

Thanks to #737 (comment) help!

* Update README.md

Co-authored-by: Sergey Shorokhov <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: 🕒 low Low priority tasks that can be postponed for the future. Type: 🚀 enhancement Improvement or addition of a new feature.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants