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 - rotenKleber

Pages: [1]
1
SFML projects / Re: Road to Zero - The Microgrid Management Game
« on: February 18, 2024, 01:06:48 am »
Fun little game - I liked the old school terminal aesthetics. After a couple tries I managed to easily win with a couple +1 and +2 tiles near my start. It seems like it's the first 20-40 months that are hard due to low credits and CO2, but if you survive that, spamming wind turbines makes the rest of the game just a matter of turning on and off turbines to avoid overproducing. Overall nice work!

2
Network / Re: Receiving random data
« on: October 10, 2017, 11:06:50 pm »
Thanks for the reply! I appreciate your work, by the way.

How would I print the raw data of the packet without disassembling it?

I tried using Packet::get_data(), but I'm not sure what to cast the void pointer to. I tried this with strange results:

std::printf("Data before sending: %d\n", *(reinterpret_cast<const long long*>(data.getData())));

The output being
Code: [Select]
73728
But that const long long* was a wild guess and it changes drastically depending on what I cast it to, not sure if that's the best indicator. Either way, I figured out that the error is occurring when attempting to pull the tiles out of the packet with

for (unsigned int x = 0; x < size; x++) {
    for (unsigned int y = 0; y < size; y++) {
         sf::Uint8 type;

         data >> type;

         printf("Type: %d\n", type);

         map[x][y] = (tile) ((int)type);
     }
}
 

3
Network / Receiving random data
« on: October 10, 2017, 09:47:41 pm »
While trying to send map tiles from a server to a client, I noticed that there were other values interspersed throughout the packet that really should not be there.
The data at the top is the map that should be sent. The data near the bottom is the data that was received. I have highlighted some of the anomalies



To clarify a bit, I am trying to load the entire map onto a single packet, with this bit here
(click to show/hide)

When pulling out the code, I just do the opposite, extract the "code" telling the client what to do with the info, grab the size of the map, then load all the tiles sent into the map. The issue occurs when there are numbers in the received data that shouldn't be in there, as seen in the image.

Has anyone else experienced this? Does anyone know what this data is / how it gets into the packet or received / how to remove it or prevent it?

Pages: [1]
anything