Git Product home page Git Product logo

Comments (15)

mjbarker avatar mjbarker commented on August 12, 2024

Interesting request, I'd not thought of generating output in the game's house protocol format. What sort of tools are you thinking of? How would you use the house data?

Frustrated with the lack of options to capture my house designs, I wrote a (Python) translator for the house protocol so I could view them in CastleFortify (I have a local server running). It would render my scripts almost obsolete if CF supported it natively...

from castlefortify.

Zegnat avatar Zegnat commented on August 12, 2024

I am currently in the process of writing my own custom server, mostly so I don’t have to run a separate ticket server (and reflector) and anything that can be used to easily view and edit houses in the browser would be great.

As you say you currently need your own parser to go between a Castle Doctrine server and the CastleFortify system. If CastleFortify could implement the (well documented) native house map format we can establish a good baseline for other applications as well.

What sort of tools are you thinking of? How would you use the house data?

While I am currently not planning to make any player-side programs it is not hard to see how you could write one. The first thing done by the game is booting into your house (start_edit_house in server-speak), it would be trivial to create your own software that follows exactly the same steps to login (check_user, check_hmac, start_edit_house) and then allows you to paste in a house map to submit to the server. Of course this program could just take the JSON input and convert it, but it would be so much easier if CastleFortify natively supports importing and exporting in the ASCII format.

A tool like that would mean that people can more easily download complex house designs and start using them. They will no longer need to rebuild something tile by tile. Cheating is fairly impossible due to server-side checks of the submitted house map anyway.

Maybe someone will even come along and write a completely new version of the game engine? Maybe one in 3D? Possibilities are endless. But they are all going to need to use the ASCII format if they want to communicate with the server, so I feel like CastleFortify should as well.

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

Yes! This is totally in line with what castle fortify is about and MUST get in there. Being able to import and share designs direct from castle doctrine would kick ass. Gonna try to get this in for the next version - thanks so much for bringing this up!

Also being able to import these designs into a 3d environment like the unity engine would be incredible.. Someone get on that!

Mjbarker - do you have that python code anywhere online?

from castlefortify.

mjbarker avatar mjbarker commented on August 12, 2024

No, it's not online. I could publish it if you like so you could see how useful it would be. However, it's a bit rough and currently only supports conversion from game format to JSON, not the other way around, though it could probably be easily extended.

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

Would be cool to check it out - curious to know how you solved the challenges of converting it - and would be helpful to guide me when I'm adding this feature!

from castlefortify.

Zegnat avatar Zegnat commented on August 12, 2024

I think the easiest for CastleFortify would be not to write a converter at all but build its core on using the same IDs as Castle Doctrine. Currently you seem to identify different objects by their name. Instead you should identify them by their ID and then you would pretty much be done.

Identifying objects by their ID is a good idea anyway, because Castle Doctrine support translations (meaning names could be variable).

For your reference (I don’t know if you are running a server) here is a view displaying all the objects with their IDs and names:

Castle Doctrine objects: their IDs, prices, and names.

Maybe I will have some time this weekend to fork CastleFortify and give it a go, but don’t count on it too much. I rather work on my private server.

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

Interesting - I need to look more into what the deal is with these identifiers and if that's the way to go for storing maps - thanks for bringing this up!

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

Made some progress on this, but need some more time to make sure all items are accounted for, and then to actually test it.

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

@Zegnat Hey that initial code you posted, was that ripped directly from the game files? If so, where?

I've implemented the conversion to the castle doctrine format, but the freshly baked map isn't looking right:
screen shot 2013-05-12 at 7 09 35 pm

Does it draw from bottom to top? Even if I do that, the vault doesn't end up on the same line as the entrance.

I imagine this protocol.txt file you speak of could help me figure this out - but I couldn't find that in the Castle Doctrine folder structure either. Where'd you find that?

Also, it would be awesome to test this out on some more maps before I bring it live. I'll get it up on the dev site shortly. Thanks so much for bringing this up and posting that freshly baked map!

Update:
Here's the latest version on the dev site so anyone can test out their Castle Doctrine encoded map and see how it translates:
http://dev.castlefortify.com/

from castlefortify.

Zegnat avatar Zegnat commented on August 12, 2024

that initial code you posted, was that ripped directly from the game files? If so, where?

Yes. Check the cd_newHouseForUser-function in server.php (line 4364). It’s in the same folder as the protocol.txt file (see below). The house looks like this in full:

    // default house map, 32x32 map
    // impenetrable walls around exterior
    // goal in place
    // default state for each cell (no ":state" part)
    $house_map =
        "998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
      "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".


        "0#0#0#0#0#0#0#0#0#999#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#$pickedSon#0#$pickedWife#0#$pickedDaughter#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
        "998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998";

The game server uses variables for the son, daughter, and wife. This is because the different sprites have different numbers:

Variable Value 1 Value 2 Value 3 Value 4
$pickedSon 1020 1021 1022 1023
$pickedWife 1010 1011 1012 1013
$pickedDaughter 1040 1041 1042 1043

Where’d you find [this protocol.txt file you speak of]?

Right where the arrows point:

CastleDoctrine_v5_UnixSource.tar.gz
|-- CastleDoctrine
|    |-- build
|    |-- documentation
|    |-- gameSource
|    |-- reflector
|    |-- server
|    |    |-- namesSource
|    |    |-- test
|    |    |-- footer.php
|    |    |-- header.php
|    |    |-- HowToInstall.txt
|    |    |-- index.php
|    |    |-- namesDaughter.txt
|    |    |-- namesFirst.txt
|    |    |-- namesLast.txt
|    |    |-- namesSon.txt
|    |    |-- namesWife.txt
|    |    |-- passwordHashUtility.php
|    |    |== protocol.txt  ←     ←     ←     ←     ←
|    |    |-- server.php
|    |    +-- settings.php
|    +-- configure
|-- minorGems
+-- runToBuild

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

thanks!

On Mon, May 13, 2013 at 1:30 AM, Martijn van der Ven <
[email protected]> wrote:

that initial code you posted, was that ripped directly from the game
files? If so, where?

Yes. Check the cd_newHouseForUser-function in server.php (line 4364).
It’s in the same folder as the protocol.txt file (see below). The house
looks like this in full:

// default house map, 32x32 map
// impenetrable walls around exterior
// goal in place
// default state for each cell (no ":state" part)
$house_map =
    "998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
  "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".


    "0#0#0#0#0#0#0#0#0#999#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#$pickedSon#0#$pickedWife#0#$pickedDaughter#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".

    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#0#998#".
    "998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998#998";

The game server uses variables for the son, daughter, and wife. This is
because the different sprites have different numbers:
Variable Value 1 Value 2 Value 3 Value 4 $pickedSon 1020 1021 1022 1023

$pickedWife 1010 1011 1012 1013 $pickedDaughter 1040 1041 1042 1043

Where’d you find [this protocol.txt file you speak of]?

Right where the arrows point:

CastleDoctrine_v5_UnixSource.tar.gz
|-- CastleDoctrine
| |-- build
| |-- documentation
| |-- gameSource
| |-- reflector
| |-- server
| | |-- namesSource
| | |-- test
| | |-- footer.php
| | |-- header.php
| | |-- HowToInstall.txt
| | |-- index.php
| | |-- namesDaughter.txt
| | |-- namesFirst.txt
| | |-- namesLast.txt
| | |-- namesSon.txt
| | |-- namesWife.txt
| | |-- passwordHashUtility.php
| | |== protocol.txt ← ← ← ← ←
| | |-- server.php
| | +-- settings.php
| +-- configure
|-- minorGems
+-- runToBuild


Reply to this email directly or view it on GitHubhttps://github.com//issues/1#issuecomment-17793466
.

from castlefortify.

dalleck avatar dalleck commented on August 12, 2024

Hi Seth. Love the dev version of fortify, but you indeed have it upside-down. The very first block of the native house format is the bottom left one, so your imports come in mirrored.

Also when I imported, the middle row (entrance) was moved over by one place and I assume this is because the native entrance is simply an empty tile following the exterior wall --> ' #998#0# ' and thus gets drawn as if it is a tile.

Oh and yes, the entrance is a row out, which you know, and this is due to the fact that the entrance is the 15th row from the top, but 16th from the bottom, and because the map is drawn upside-down it appears wrong.

When you draw the map correctly the entrance will be in the right place.

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

@dalleck Awesome, thank you! Saves me a bunch of bumbling around. Should get this up this week!

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

@dalleck @Zegnat @mjbarker Alright, I think I've ironed all the bugs out! Here's a save of the opening state of castle doctrine:
http://dev.castlefortify.com/?id=535a503

Look good? I'll go with live with it if there's no more issues.
Thank you both for bring this up and helping me work out the kinks!!

from castlefortify.

SethArchambault avatar SethArchambault commented on August 12, 2024

It's live! Thanks all!

from castlefortify.

Related Issues (6)

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.