Jump to content

  • Log In with Google      Sign In   
  • Create Account

BeerNutts

Member Since 27 Jun 2001
Offline Last Active Yesterday, 09:59 PM

Posts I've Made

In Topic: PowerUp stuck

Yesterday, 01:27 PM

 

Edit: I Got it working.

                    if (paddle.powers.Count > 0)
                    {
                        foreach (var paddlePower in paddle.powers)
                        {
                            if (paddlePower.power == PowerUpses[i].power)
                            {
                               // paddlePower.reset();
                               Debug.WriteLine("paddle power is " + paddlePower.power);
                                paddlePower.OnRemove();
                                paddlePower.OnApplied();
                            }
                            else
                            {
                               
                                paddle.powers.Add(PowerUpses[i]);
                                paddlePower.OnApplied();
                            }
                        }
                    }
                    else
                    {
                        PowerUpses[i].OnApplied();
                        paddle.powers.Add(PowerUpses[i]);
                        
                    }
                  

Basically I used 2 list one for the paddle and other for the power up. I havent tested another type of power up yet

 

This looks wrong if you have multiple power ups.  While looping through the paddle's current power ups, you should not have an else if the power up doesn't match inside the loop, otherwise, for every power up that doesn't match, you'll re-add it and call OnApply().

 

Rather, you should do something like this:

bool isPowerFound = false;
foreach (var paddlePower in paddle.powers) {
  if (paddlePower.power == PowerUpses[i].power) {
    paddlePower.OnRemove();
    paddlePower.OnApplied();
    isPowerFound = true;
    break;
  }
}
// if we didn't find the power up on the paddle, add it now
if (!isPowerFound) {
  PowerUpses[i].OnApplied();
  paddle.powers.Add(PowerUpses[i]);
 }
...

In Topic: What About your compressed Audio Format?

24 June 2016 - 07:28 AM

if i'm correct UDP is when you use peer to peer architecture...in my case i'll use a client/server architecture so i think TCP is great in this case no?

 

No, that's not the case.  UDP is just a connectionless, unreliable protocol, so you can send a single packet to a destination IP address/port and you don't need to be connected to it, and you won't know if it gets there using UDP by itself.  TCP is a connection oriented streaming protocol, so it requires 2 IP addresses to connect, and the data sent is streamed and guaranteed to get there in the order sent.

 

Both TCP and UDP can be used with peer-to-peer, and both can be used for client/server.  Typically a game will include both TCP (for sending those must have data pieces ), and UDP (for sending the often updated states of players).

 

In your case, since you're doing interactive audio, you might want to use UDP since it will decrease communication time to/from others.  If you happen to drop a packet myou'll get a blip in the audio, but the other guy can just say, "What was that?"


In Topic: Peer-to-peer Massive Multiplayer Game

16 June 2016 - 07:53 AM

Also this whole peer-to-peer architecture would at most take me one day to write up, so it's really not that big of a deal.

 

MAYBE the initial structure you think will work will take a day.  Then, when you start to use it, you'll run into an issue.  then, when you get more users, you'll get more issues.  Then, when you have a lot of players, you'll be running into different issues all the time, all related to trying to use peer-to-peer, and you're time will be dedicated 100% to trying to find a solution for all the problems.  You'll fix one problem, and another will arise, all the while, you'll be hearing about cheaters doing this or that.

 

Obviously, with any networking solution you select you're going to have some amount of debugging you're going to run into, but, if you're trying to do peer-to-peer with any sort of game that requires sub-second communications amongst all the players, it's going to be 1000x worse.

 

With that said, if you're still going to write this peer-to-peer framework, I truly hope it does well, and you can come back with a synopsis of it and we can all learn from it.


In Topic: Peer-to-peer Massive Multiplayer Game

15 June 2016 - 08:42 AM

Wow, you're doing all this extra complex work just to


benefit of not having to purchase a dedicated server.

And, this is for a game with 50-100 players.  I think this is like a case of cutting off your nose to spite your face.  IMO, you're going to go through so much heart-ache, you'll be wishing you had spent a little money for that dedicated server.


In Topic: How to make spot lights in darkness for 2D games

14 June 2016 - 09:40 AM

For SFML, Let there be Light 2

 

A really good lighting system for 2d games, but it relies on SFML.


PARTNERS