Yao-class-cpp-studio / GameX

0 stars 73 forks source link

[feat] Multiplayer network, actor removal bug fix, and too many ball logics, Close #4 #7 #63 #87

Open lemonchu opened 8 months ago

lemonchu commented 8 months ago

Close #4 Close #7 Close #63 Close #81

TL;DR

New Feature: Cross-Platform Multiplayer Network

Implemented Features:

  1. Mode Selection: we have room, client, and local mode.

room mode is for the host of a playground.

client mode is for connecting to the room to join the party.

local mode is for playing with the dead ball for practice.

Now GameBall can be played on Windows, Linux, and MacOS!

  1. Compressed Data Transfer: Credit to Yuchen Yang for designing a wonderful compression scheme for transferring user inputs.

Usage:

Room mode will automatically show room ip in the console

Caution: In client mode, port 1116 is reserved for banning 2 clients ball running on the same device. Want to override this restriction? Hint: use --res_port=***

Bug Fix: Actor removal

The is a bug in game_ball.cpp of misuse of map function. Now it is fixed.

Enhancements: Ball Jumping On Left Mouse Click

Implemented Features:

  1. Jump Activation via Left Mouse Click: The ball is now programmed to jump when the left mouse button is clicked.

  2. Grounded Jump Constraint: To add realism and challenge, the ball can only jump when it is in contact with the ground. This restriction prevents continuous mid-air jumps.

  3. Single Jump per Click: The ball will perform a single jump for each click of the left mouse button. Holding the button down won't cause multiple jumps.

  4. Consistent Spin During Airborne State: While the ball is airborne post-jump, its spinning motion remains constant. This detail ensures a seamless visual experience.

Enhancements: Ball Respawn

This mechanism is simply teleporting the fallen ball back to the playground.

Known issue:

  1. Client Quit Leaving Ball(Solved by fixing an actor removal bug): GameX still not have a proper scheme to erase the ball picture when the client quit. We fixed the bug in actor removal, and close this sub-issue.

  2. Seg Faults When Quitting(Temporarily Solved by removing some lock_guards): GameX has issue when exiting on Application::~Application() , it is about handling too many mutex_locks. I just remove some of the locks and it stopped showing seg_faults now! But it may be thread-unsafe.

Looking forward to feedback and suggestions!

lemonchu commented 8 months ago

Close #4, #7, #63

chenzunh23 commented 8 months ago

I can't agree more that the seg faults are still a problem! Even though I adopted EnderXie's method, I still encountered the same seg-faults this afternoon. It seems that functions associated with Render() have caused it after the ball was removed. Besides, after removing a player that is pushed off the edge of the block, I can still see the ball falling down. Maybe this problem is similar to your Issue 1?

lemonchu commented 8 months ago

I can't agree more that the seg faults are still a problem! Even though I adopted EnderXie's method, I still encountered the same seg-faults this afternoon. It seems that functions associated with Render() have caused it after the ball was removed. Besides, after removing a player that is pushed off the edge of the block, I can still see the ball falling down. Maybe this problem is similar to your Issue 1?

There is a bug in actors_to_remove makes removal of ball actors malfunctions. I have fixed it, and it maybe helpful to your works! I would greatly appreciate it if you would be willing to help me test and explore other secure ways of deleting the balls.

lemonchu commented 7 months ago

close #81 close #67