Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - RyanPaul87

Pages: [1]
1
Feature requests / Re: Getting bounds for sf::View
« on: December 30, 2021, 04:30:43 am »
Did this ever get added?

2
Hi SFML community, and admin team!

I'm just delving into networking with sfml, and looked at a few boost tutorials. I realise this question has been asked a lot and some people don't follow this path to completion.

I'm currently signed off work long term with mental health ups and downs (nothing too serious) and have a year to myself essentially and want to help myself heal with a bit of coding (logic)

I wanted some 'pre' wisdom and advice before I go too far down the 'wrong' path.

I'd like to grab myself a book on c++ networking or some solid resource so in the next month or two I'm in a stronger position to look at designing an average (or at least a basic foundation) server / client architecture that will support a small 2d online game (upto 50-100 clients maybe, but then might be something I can adapt too over time.

It would be all the usual, sending some raw image data, player positions and player statistics, as well as getting some understanding on prediction models, so the server might predict where the player will walk and save on bandwidth, as well as other strategies. Can you suggest:

  • Any beginners (through to intermedia / advanced) books or tutorials that are relevant but also practical and current enough.

    Any goto source code you might recommend

    Any wisdom yourself

    The best libraries you might recommend.

    Any small / medium similar projects I should look at

Thank you.

3
Network / Re: Sending 'images' over in packets
« on: December 09, 2021, 07:59:12 pm »
Hi, thanks for this. I have a few questions on what you've said for clarity.

You said 'if youre already dealing with raw dats, it'd be easier to use TcpSocket::send(const void* data, size t, size t) etc, roughly speaking.

Do you mean, if I'm already doing it this way as opposed to packets, to just continue to do so.

From here, are you saying I can load it into and sf::image 'image' and then send 'image.' If so where does the image become raw data, can you show me a sample code if it's easy enough.

I appreciate you supporting me.

4
Network / Sending 'images' over in packets
« on: December 08, 2021, 06:43:20 pm »
I was wondering if some body could give me some starting points, for sending images (or the image data) to a server which would send it to a few dozen clients. Happy to do the work myself but just wanted a jumping point.

I understand I will overload the << >> operators, but, what's the best way to unpack an image (png for instance) into raw data then repack at the other end without losing data.

It doesn't need to be displayed by the server, but pass to other clients, obviously.

Thanks for your patience.

5
Network / Re: Sending Custom Class by packet (to different program)
« on: December 07, 2021, 10:12:06 pm »
Thanks for this, it was really helpful. For some reason I was doing this,

if (packet >> name >> age)
   {
      john.name = name;
      john.age = age;
   }

when it wasn't necessary. (the overloading already did this).

You've really helped me.

I wondered if you have any goto links for networking tutorials, ideally videos. There's not too many on youtube, although there's decent info about.

6
Network / Re: Sending Custom Class by packet (to different program)
« on: December 07, 2021, 03:08:58 pm »
As it stands, the best I've come upwith so far is creating the object again on the server side and instantiating with the data sent over in the packet.

   character john; // create new object on other exe.
   if (packet >> name >> age)
   {
      john.name = name;
                john.age = age;
   }

I wondered if there'd be another way such as a constructor, i.e

character john(packet) or
character john (packet >> name>>age>>location>>inventory);

etc.

Once again all help is appreciated, and / or other suggestions

7
Network / Sending Custom Class by packet (to different program)
« on: December 07, 2021, 02:40:08 pm »
Hi, thank you Laurent and others for the tutorial on overriding the << >> operators to be able to send classes.

Before I jump into this, I wondered how this would work on the other end. That is, the receiving program.

The receiving server would also be made myself, and so I can include the .cpp and .h of the class I will be sending over. But I just wanted to check this is necessary. I.e the class has to be defined on the other end / the other exe.

Essentially I will be sending character data for a handful of characters with their statistics.

I know how to override the << >> but just wanted a small bit of help with how I get it at the receiving end. a line or two of code,

i.e the tutorial states
Packet >> Bob;
How then do I make this an object on the receiving side etc. like class instance = packet >> bob (to give a bad psuedo code example).

You can probably see I am quite new to this, but enjoying it. Any comments on what I'm asking, or what you think I'm trying to achieve will be helpful.

Pages: [1]
anything