Tag Info

Hot answers tagged

14

Answers SRP - Secure Remote Password - This is based on Diffie-Hellman. The idea is that you can do a mutual password check without actually ever transferring the password or any information that can be used to derive it. Even though it's secure over the wire you should still hash and salt your passwords as your server must never store them in plain text. ...


7

Use the organization of the data to your benefit. You can always be expect the data in the same order, so you know what the next bytes belong to. For example (not specific to your data), when reading in the data, always expect two bytes for tile type, two bytes for lighting information and then two bytes for extra info. So it knows that after 6 bytes, it's ...


7

Two observations: Your condition system seems to have two orthogonal axes: temperature and poison. Represent them as such. When thinking about this you should separate transitions from states. COLD and HOT are transitions in the way you mention them, not states. Combining those observations would result in something like this: // These is the ...


6

When I need to use flags I usually do something along these lines. enum obj_state { NORMAL = 0x00000; DRY = 0x00002; HOT = 0x00004; BURNING = 0x00008; WET = 0x00010; COLD = 0x00020; FROZEN = 0x00040; POISONED = 0x00080; }; int objFlags; void DryOn() { objFlags |= DRY; } void ...


5

Without having read through all your code (or, indeed, being very familiar with .NET) and thus not knowing how appropriate this suggestion is: Make a wrapper around a class like MemoryStream, and add methods to objects that need to be serialized/deserialized. Don't just make a class that's an arbitrary bag of data. If you have a Widget class, it might read ...


5

Endianness matters when it comes to game consoles. The Wii, the PS3, and the XBox 360 all run big-endian, while all major desktop computers (as of the date I'm writing this answer) run little-endian. If there's a chance you'll want to compile your code for one of those game consoles someday, or if someone releases another popular big-endian desktop machine ...


4

What you ultimately end up using at runtime is going to be processed version of your exchange formats whether you do it offline or at runtime. The main differences are: If you do it at runtime then you're going to end up paying the processing cost repeatedly and You probably want to spend as little time processing and optimizing as possible so your load ...


4

There are lots of ways to handle the versioning problem; you can do it by having one load function per version, you can try to automate process by describing (via attributes usually) the transformation of the asset structure over time, you can do version-specific checks inside the load/save functions, et cetera. I like the "describe the changes" approach ...


3

What Byte56 says makes sense. I'm not sure why you need 2 separate coordinates (chunk coords and xy coords). But since a map is always square, the most basic representation is a 2D array of ascii chars ..,,.....@ ..,,@@@@@@ ...,,,...@ ......,..@ So there is the specification of a 4x10 map in 40 bytes. A 10,000 x 10,000 map would take 95MB, which isn't ...


3

Representing your states as bitmask like you write, you can just translate your descriptions of the constraints into code: if ( (state & HOT) && (state & COLD) ) { state &= ~HOT; state &= ~COLD; // reset both HOT and COLD flags if both are set } if ( (state & COLD) && (state & WET) ) { state &= ...


2

I think my last comment to Jonathan's otherwise excellent answer is worth expanding into an answer of its own: If you don't have a lot of crypto experience, you shouldn't try to design your own encryption layer if you can avoid it. If you do have a lot of crypto experience, you should know better than to design your own encryption layer if you can avoid ...


2

If you're concerned about performance, there's no reason to add additional operations to your setup. Especially operations containing hard disk read/writes as those are some of the slowest operations you can perform. Additionally, since it's running fine now, there's nothing to fix yet. You should start worrying about performance, when there's a performance ...


1

To answer the three of your questions with one answer: sure you could, but you wouldn't be able to use the default content manager. However, you can create custom content processors to output file data in a format that only you would immediately know. This would still allow you to use the default XNA content manager (this.Content in any Game-derived class) ...


1

Use a markup language with attribute-value pairs like XML or JSON. The parser can just ignore any attributes it doesn't understand or use defaults for any it doesn't find, which makes backward- and forward compatibility quite easy. Also, the format is human-readable so you can easily edit it with a text editor. When you use an established language like ...


1

I've implemented such offline format near month ago for my engine. The basic algorithm is: Write formal specification for output binary file in word processor. Header + data blocks. Data types, offsets, descriptions of each element of each block table. Write offline exporter from your 3D editor into C++ code text headers using embedded scripting language. ...


1

I would use something like ProtoBuf with RPC support.



Only top voted, non community-wiki answers of a minimum length are eligible