Coder Social home page Coder Social logo

Comments (9)

AJenbo avatar AJenbo commented on April 28, 2024 3

Looking at the save game there are 4 types of regions available in the save game data that could be used with varying degrees of backward compatibility BC.

  1. Alignment bytes. These are areas of a struct that exists simply to align data types in a CPU frindly way, they should always be 0 in a valinal savegame. There are 33 bytes in the singlplayer player data, 12 bytes pr monster, 3 bytes per missile, 6 bytes per object, 11 bytes per item and 3 bytes per quest. Adding data her should be safe as vanila Diablo will just leave it untouched.

  2. Values that never use all bytes of there type. The best example here is BOOL which is a 32bit value where only 1 bit is ever used. The downside of using the 31 remaining bits is that it can cause vanilla to incorrectly see the value as being TRUE/FALSE.

  3. Append to the end of the save game, this should also be fine as vanilla should stop reading once it hits the expected length. But it will overwrite our data if a save game is transferred back.

  4. Add a new file to the save game archive. The savegame is actually an MPQ-file containing several files. Again vanilla will probably discard any such data if a save game is transferred back to it.

I favor a mix of using 1 for basic/critical data that gets added to the related structs (like hellfire properties) and 4 for extending the game in any big way. Adding good support for 4 would also help any mod that needs to extend the save data.

Game difficulty would fall under 1 as it is present in Hellfire, but also because it's small and is preferable not to lose.

from devilutionx.

 avatar commented on April 28, 2024 1

Checkout loadsave.cpp. There's a ton of unused space in the save file. Should be something to the effect of:

ISave() = gnDifficulty;
gnDifficulty = ILoad();

from devilutionx.

AJenbo avatar AJenbo commented on April 28, 2024 1

You would have to select the difficulty each time you load a save game and having the game change difficulty in the middle of the game is not a good experience.

from devilutionx.

 avatar commented on April 28, 2024 1

What hellfire did was add the difficulty to the automap, so you can see for sure what setting you are on.

from devilutionx.

AJenbo avatar AJenbo commented on April 28, 2024

Yes this is something I plan to look into, the main issue is how to handle it in terms of save game, the method you refere to requires that you trigger the same glitch when loading a game. If we can fin an unused part of the save file to store this (for BC) then that would be ideal.

from devilutionx.

 avatar commented on April 28, 2024

This is weird . I originally allowed the selection of difficulties in the menu code.

I was pretty sure that just starting a new game and selecting a new difficulty was all that was needed. Am I wrong?

from devilutionx.

hyperagon avatar hyperagon commented on April 28, 2024

It seems to happen when entering lower levels (likely on dungeon generation), making it hard to notice and change back. Certainly not a good experience.

from devilutionx.

qndel avatar qndel commented on April 28, 2024

interesting!

from devilutionx.

AJenbo avatar AJenbo commented on April 28, 2024

d7ca28f

from devilutionx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.