GithubHelp home page GithubHelp logo

egomeh / anno1800-scripting-api Goto Github PK

View Code? Open in Web Editor NEW
19.0 9.0 7.0 4.38 MB

A tool to make scripts for Anno 1800

License: MIT License

C# 0.03% C++ 21.90% C 77.05% Assembly 0.02% Objective-C 0.12% Objective-C++ 0.62% Shell 0.01% GLSL 0.01% CMake 0.02% Kotlin 0.01% Makefile 0.16% Batchfile 0.06% HTML 0.01% GDB 0.01%

anno1800-scripting-api's Introduction

Anno1800-Scripting-API

Disclaimer

This is a pet/passion/hobby project!

No guarantees and no promises.

I never coded anything of this kind before, so expect some limitations :P

Non-affiliated project !

This project is in no way affiliated with Ubisoft Blue Byte or Ubisoft

Also this might count as cheating, so be careful !

Finally, if you look through the code you will notice that many places are quite messy. Since I've never done this before and the game changes I cannot tell if certain techniques work or not. Much of the code could use a caring hand...

I would however love any feedback on any aspect of the code!

Introduction

A tool to make scripts for Anno 1800 The idea of the project is to implement a scripting interface with Anno 1800. The game itself allows users to control most things through UI and in addition, shipping of goods via trade routes. The goal of this project is to expose as much functionality of the game through a C# scripting API.

Requirements

  • Visual Studio 2019 (C++ and C#)

Getting started

How to install and use

I will probably change a lot when I'm happier with the code. But at current, following should work.

  • Clone the repo to a local folder
  • Build the Anno1800ScriptingAPI.sln solution file (in debug mode)
  • Run Anno 1800
  • Configure the debugging settings by specifying $(TargetDir) as the working directory, as can be seen in the following image doc/surveillancevan_debug_config.png Launch the solution (still in debug mode)
  • Run code using the monocle project (with administrator rights)

License

    This file is part of Anno1800-Scripting-API.

    Anno1800-Scripting-API is libre software: you can redistribute it and/or modify
    it under the terms of the MIT License as published by
    the MIT.

    Anno1800-Scripting-API is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the MIT License
    along with Anno1800-Scripting-API.  If not, see <https://opensource.org/licenses/> <https://opensource.org/licenses/MIT>.

anno1800-scripting-api's People

Contributors

brumiros avatar camillehbp avatar egomeh avatar seynax avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

anno1800-scripting-api's Issues

The program gets stuck at acceptedSocket.Wait(); (Telegraph.gen.cs#L63) and blockages related to the game update

Hello,

The program gets stuck at acceptedSocket.Wait(); (Telegraph.gen.cs#L63)

I tested your API by running the TestMonocle source code, but it doesn't work.
The program gets stuck at acceptedSocket.Wait();

acceptedSocket.Wait();

Problem with local IP address

I also got something that looks strange to me, the address returned by IPAddress "ipAddress = ipHostInfo.AddressList[0];"

IPAddress ipAddress = ipHostInfo.AddressList[0];
is ":::1", if I replace the line with "ipAddress = ipHostInfo. AddressList[1]", I get my local ip address as "000.0.0.0"

Thanks in advance,
Have a good day

Stand alone version

Hello, is it possible to release an .exe version of this? I really want to use this, but I don't know how to get it to run.

Thanks in advance

Impossible to use for someone not versed in the code

Hello!

I would like to understand how to use and contribute to this program, but it's impossible for me to understand how to build and use this. I've built something called GoodMinMax and Monocle but they all crash the game.

Would you be willing to setup a call, maybe on Jitsi, if you don't have the time to write all this? Otherwise just some quick info here on Github would already be nice.

I could afterwards take a few screenshots, write down my process, and make some kind of tutorial for those interested.

As of now, I think the project is unusable to anyone but you and the other contributors. It's a shame because it looks like a very nice project in which a lot of effort has been put. It's sad that it is missing only a little bit of doc to get the community to help you and try it on their own.

API doesn't seem to find all islands or can't determine their name

The API doesn't seem to find all islands the player owns, or all islands in general (by adding a method for that).

OR THEN, the API doesn't seem to be able to correctly determine the names of the islands, sometimes the error "[The name cannot be that long...]" seems to be thrown, but most of the time no error is sent, I checked the problem should start from here:

wchar_t* stringLocation = (wchar_t*)(address);
(knowing that according to my logs, the "IsLong" condition has never been met for me, yet).

It almost looks like (wchar_t*)(address); returns nothing, which makes wchar_t* stringLocation unusable.

[Question] Useable as a mod and more options than lua?

Hi :)
thank you for your work, it looks interesting.

Unfortunately I'm no programmer, so understanding anything from your work by looking at the code is not possible for me :D

But I'm currently "fighting" with lua scripts from Anno 1800 and every day hating the devs that they only exposed so incomplete stuff to lua ( 1) there is setPosition, but no getPosition. 2) I see no way to add/read out ObjectLabels that could be used to mark objects for usage in xml triggers Objectfilter, 3) there is no way to change owner of any object, just of selected, 4) no clue if it is possible to spawn an object in lua, there is a debugspawnobject, but no clue what arguments it expects ... and many many more missing important features).

So I wondered if there really is no better way to write nice scripts for Anno, than to struggle with this incomplete mess of lua :D
But it should be properly usable as a mod. So asking the user to install a separate program and to run it next to Anno is no option.
..
How does your project work? Would the things I listed above be possible with your scripting api in theory?
Would it somehow be possible to install it as a mod, at best with mod.io subscribe feature? Or at least with asking the users to put a custom dll into the games folder, like we did in the past with the modloader?

Btw. Taube lately found out how to calculate AreaIDs and OIDs from the SessionID,AreaIndex,IslandID,ObjectID. Not sure if you also needs such things in your scripting API or if you already knew how to do this.

What does the .exe file in releases do?

You have a .exe file in releases, the first and only one, and there is some talk about making it more user-friendly.

What exactly does, or well, is the .exe file supposed to do? From the description of the release, it can seem like a helper program to the script, and not the script itself?

I tried running it, seems to hook up to the game, but nothing happens. Does the script support moving resources between worlds btw?

On extractring demand data

Do you have any advice on how to extract trade information from the game for modding purposes? I am trying to create a system for controlling trade externally but the first step is that I need to extract the trade routes that are currently active and what they are shipping. After I unpacked the game RDAs I notice that the XML is effectively unreadable as the goods and ammounts and such seem to be just raw hex identifiers.

If you have any advice on parsing these / a table for converting the names of goods to their hex codes I'd very much appreciate it! My exact context is I'm trying to generate network graphs of a players trade network from save games.

API Insights

How did you obtain all the function offsets in TomCruise/dllmain.cpp : ComputeFunctionOffsets?
Would it be possible to extract more game statistics (e.g. number of factories on island, ship unload statistics - as displayed in the storage tab)?

Cannot get monocle to run

Hello,
I am very interested by this API & I would like to use it.
I followed the steps described in the readme but I'm having trouble to make it work.
More specifically:

  • Launch the solution (still in debug mode) : The only runnable project in this solution is SurvellianceVan so I set it as the project to run. I looked at the code & it appeared to me that it creates a server and waits for clients
  • Run code using the monocle project : When I run monocle, I get a bug at the line with the m_Socket.Connect in the Telegraph constructor. I tried changing the port to match the one indicated in SurvellianceVan without any success.

Can you please give more details on how to use it ?
Best regards.

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.