EOSERV Forum > EOSERV > Hiding tilespecs from player's clients?
Page: << 1 2 3 >>
Hiding tilespecs from player's clients?
Author Message
Post #197936 Re: Hiding tilespecs from player's clients?
callum posted: (17th Sep 2015, 06:01 pm)

Cirras posted: (17th Sep 2015, 05:37 am)

callum posted: (16th Sep 2015, 10:55 pm)

Might be worth checking if the client has a player and if the player is an admin before removing the bytes, seems like something that might cause hassle if it can only be seen in editors.


Well, technically by removing the bytes, they can't be seen in editors or anything, since the file they're getting is modified. However, in my mind that wouldn't be a problem since mappers would be working with the original (serverside) map file that still has the tiles on it.

I think you miss understood what I meant, I meant it as in; If you're planning some sort of system using hidden tiles, why make it so it can only be seen outside of the game?

''Might be worth checking if the client has a player and if the player is an admin before removing the bytes, " Admins would be sent the original map, would save time sending out the maps to the admins who need them (multiple mappers).

I think I should have said it differently, I meant it like.. What if something went wrong with the system and your admins couldn't see that there was a tile system in place, it would just cause confusion. Also then only a mapper or level 5 would be able to see that there's a system in place and shed some light on the problem. If all trusty admins were able to see the original maps then I'm sure there's at least 1-2 admins who'd have the sense to check the file.

I might be way off point with this, if I am I apologise, but it just seems more practical to be able to work with this in-game too. Save the hassle of reloading maps every time.


I see what you're saying there, that might be smart!

Although I do have concerns that players would feel those admins have an advantage if they were to play in any Event Engine events that utilized these features and be able to see those tiles when they can't.
(That's uh, what this project is, by the way.)

---
Want to learn to pixel?
Pixelsource.org
8 years, 29 weeks ago
Post #197937 Re: Hiding tilespecs from player's clients?

Have you thought about keeping some maps separate? Maybe a list like the 'pkexcept' feature to exclude certain maps from being sent to the admins. That'd be an easy way to keep atleast some of maps hidden.


Edit: just re read what you said, no point hiding certain maps if the tiles are only going to be used for events. You could always limit it to certain admins like mappers, but tbh the easiest solution would be to stop admins participating in these events

8 years, 29 weeks ago
Post #198097 Re: Hiding tilespecs from player's clients?
Cirras posted: (17th Sep 2015, 06:20 pm)

callum posted: (17th Sep 2015, 06:01 pm)

Cirras posted: (17th Sep 2015, 05:37 am)

callum posted: (16th Sep 2015, 10:55 pm)

Might be worth checking if the client has a player and if the player is an admin before removing the bytes, seems like something that might cause hassle if it can only be seen in editors.


Well, technically by removing the bytes, they can't be seen in editors or anything, since the file they're getting is modified. However, in my mind that wouldn't be a problem since mappers would be working with the original (serverside) map file that still has the tiles on it.

I think you miss understood what I meant, I meant it as in; If you're planning some sort of system using hidden tiles, why make it so it can only be seen outside of the game?

''Might be worth checking if the client has a player and if the player is an admin before removing the bytes, " Admins would be sent the original map, would save time sending out the maps to the admins who need them (multiple mappers).

I think I should have said it differently, I meant it like.. What if something went wrong with the system and your admins couldn't see that there was a tile system in place, it would just cause confusion. Also then only a mapper or level 5 would be able to see that there's a system in place and shed some light on the problem. If all trusty admins were able to see the original maps then I'm sure there's at least 1-2 admins who'd have the sense to check the file.

I might be way off point with this, if I am I apologise, but it just seems more practical to be able to work with this in-game too. Save the hassle of reloading maps every time.


I see what you're saying there, that might be smart!

Although I do have concerns that players would feel those admins have an advantage if they were to play in any Event Engine events that utilized these features and be able to see those tiles when they can't.
(That's uh, what this project is, by the way.)


I suppose you could add a command that tells you if the map contains the special tiles or not for all admins, and have it give the special tile locations to the highest level admin only.
---
I not hacker

“Everybody is a genius. But if you judge a fish by its ability to climb a tree, it will live its
whole life believing that it is stupid.” - Albert Einstein : Really Great Quote Ramy!
8 years, 27 weeks ago
Post #198256 Re: Hiding tilespecs from player's clients?
Sausage posted: (16th Sep 2015, 03:44 am)

Cirras posted: (16th Sep 2015, 03:09 am)

Sausage posted: (16th Sep 2015, 02:44 am)

When the tile specs are read, store a list of byte offsets that you want to re-write in the Map class, then look at the code in eoclient.cpp at line 75 (just noticed there's a copy-paste bug in there) which over-writes 3 bytes in the map file to enable PK (offset 3 to 0xFF, offset 4 to 0x01, etc.), and change it to also apply your list of byte changes.


That makes sense to me and was the concept I was going for, I was just unsure of how to grab those byte offsets when reading the map, there's this SAFE_READ function that appears to be grabbing pairs of chars there.

Would you be willing to explain in slightly more detail about those byte offsets? My experience with the technical aspects of map files is a smidge limited and I find this interesting.


You'll want to use fgetpos to get the current file position (before the read on line 510 of map.cpp), add 1 to it, and you have the offset of the tile spec value for the current tile spec being read.

Hey Sausage, I'm afraid fgetpos only returns fpos_t, which is virtually useless outside of fgetpos() and fsetpos()/can't be converted to anything else.

So I tried using ftell(), with no success unfortunately. It compiles perfectly fine - There is absolutely no change to the maps though. Here is the code I've currently got for this.


What are your thoughts here?


EDIT: In case it was confusing, the red line is dividing the map load function from the modification of the map information being sent to the client.

---
Want to learn to pixel?
Pixelsource.org
8 years, 26 weeks ago
Post #198270 Re: Hiding tilespecs from player's clients?

I am guessing you are editing the server map load function here. What I think is happening is for a brief moment you are telling the server the tilespecs are gone. I am just going to make a rough guess here and say you need a single server function that appends your loaded maps and re-writes them to a seperate file from which the client would then receive them. I believe you are only editing the map from server memory which is possibly redundant at the very least.

8 years, 26 weeks ago
Post #198274 Re: Hiding tilespecs from player's clients?
Apollo posted: (5th Oct 2015, 09:43 pm)

I am guessing you are editing the server map load function here. What I think is happening is for a brief moment you are telling the server the tilespecs are gone. I am just going to make a rough guess here and say you need a single server function that appends your loaded maps and re-writes them to a seperate file from which the client would then receive them. I believe you are only editing the map from server memory which is possibly redundant at the very least.


All I've done in the server map load function is record the byte offsets of the tilespecs I wish to target.

What I am modifying (Adding to, more like) in the second half is the very same code which modifies the PK flag in a globalPK scenario, sending the map to the client as if it is a PK map. What is being modified is precisely what's being sent to the client when it requests the file, unless I'm mistaken.

---
Want to learn to pixel?
Pixelsource.org
8 years, 26 weeks ago
Post #198278 Re: Hiding tilespecs from player's clients?

You're comparing p + len with a single value instead of a range like the code above it. That's wrong because the conditions aren't checked for every byte in the file, but chunks of it (between 1 byte and 4096 bytes).

Copy the way the other code is written and it should magically works:

for (int offset : this->player->character->map->stored_offsets)
{
    if (p + len >= offset+1 && offset - p > 0) buf[offset - p] = 0x12;
}

Also you're storing the offset in an unsigned char where the first arrow is pointing. If your map files are longer than 256 bytes that's not going to work...

8 years, 26 weeks ago
Post #198279 Re: Hiding tilespecs from player's clients?
Sausage posted: (6th Oct 2015, 04:56 pm)

You're comparing p + len with a single value instead of a range like the code above it. That's wrong because the conditions aren't checked for every byte in the file, but chunks of it (between 1 byte and 4096 bytes).

Copy the way the other code is written and it should magically works:

for (int offset : this->player->character->map->stored_offsets)
{
    if (p + len >= offset+1 && offset - p > 0) buf[offset - p] = 0x12;
}

Also you're storing the offset in an unsigned char where the first arrow is pointing. If your map files are longer than 256 bytes that's not going to work...


Ah, I was wondering just what the meaning of those comparisons was - File editing isn't exactly my forte. I had originally been storing the offsets as long integers, but some random on the internet suggested using unsigned chars.

Let me give this a go.


EDIT: Well, it did something. Now if only that thing hadn't been to completely scramble any map that had these 2 tilespecs on it. On a larger map, it seemed to cut its width severely and elongate its length with full map graphics intact - that's just bizarre. On smaller maps there are just random patterns of locked doors and the graphics are black. Clearly I'm missing something here...

EDIT EDIT: It was my silly mistake - I changed the vector back to int and forgot to change the actual var I was pushing back into it back from an unsigned char.
It works perfectly. I really appreciate the help, Sausage. Thanks for the replies, everybody. This was quite an adventure.

---
Want to learn to pixel?
Pixelsource.org
8 years, 26 weeks ago
Page: << 1 2 3 >>

EOSERV Forum > EOSERV > Hiding tilespecs from player's clients?