Now I was thinking maybe I'd code a market

Need help testing contributed art or code or having trouble getting your newest additions into game compatible format? Confused by changes to data formats? Reading through source and wondering what the developers were thinking when they wrote something? Need "how-to" style guidance for messing with VS internals? This is probably the right forum.
Post Reply
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

ABOUT CARGO IN VS :
All the cargo types used in the game are defined in master_parts_list.csv.
Each type of cargo has its own row, which includes a filename, category name, base price, mass, volume, and description. The mass and volume entries don’t appear to do anything—if they’re changed, nothing changes in the Commodity Exchange, and there’s no obvious difference in ship handling characteristics.
Category name maps to the “Cat” entry in units.csv. The price is the base price for that cargo type; units.csv contains modifiers for the price, depending on base type.
src : http://wiki.vega-strike.org/HowTo:Add_Cargo

What was in red is a part of gameplay that i want to create with the market lib .
Stick it somewhere .

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

_ Time implementation
As it stands now, the answer would be 'no'. Time, as far as the economy is concerned is discrete. One sets up ones 'orders' to the factories, and during the 'tick', all cargo conversion happens. For the purposes of creating a 'better' economy (then we have now) for vegastrike, this seems to be enough. With this we can create human and AI trade, monitor interesting events (e.g. starvation because food shipments keep failing to show up, planet starvation, one can try to completely corner the market of self sealing stembolts, and so forth.

Turning it continuous is deceivably tricky. Fortake starters, you are already aware that wallclocktime and vegastriketime do not go at the same rate. At least in single player, time is also able to freeze. In multiplayer, one may need to know the situation at milisecond 10, whilst the last three requests were about something that happened milisecond 900. Though this is all addressable in various ways, but I doubt the advantages outweigh the problems at the moment.

It may prove easier to have one factory per 'base' and lock access to it using your own time structures.
_ Workers implementation
Given this is a simulation of planet wide "factories", in an universe where people do not really exist gameplaywise save a few npc's, 'automated factories' and 'robot workers' seem to be commodity items, I figured it safe to assume enough 'workers' are available.

For your own purposes, workers could easily be a "Cargo" (this is probably the thing that should be templated) resource that, unless you plan a fixed number of accidents during production, has the same amount in input as output. The amount of money you pay them can easily be modelled as cargo as well, which obviously does not appear in the factories output.

At the moment, each factory works 'in turn', taking and creating their output. So if you do this directly, you only need to have the amount of 'worker' available which the most worker intensive factory needs. It shouldn't be too hard to turn 'ticks' into two phase processes where first all cargo is removed from the common pool, and only after that the production is put back. You can make different ProductionOptions where different counts of workers result in different amount of outputs. Would this work for you?
ZDIT : CMAKE not working
Could you post the log? The two points you mention (cppunit, pkgconfig) are evident to me that they failed. However, neither should've resulted in no project being built. The logfile may provide me the information I need to remedy the problem. Possibly something else popped up you overlooked. I am glad expat apparently worked out well though.
I was wondering how treat a Market base in vegastrike , and the Unit class seemed to be
the best choice
Pretty much everything is an unit in vegastrike, so i can see how you can come to that conclusion. However, for the sake of vegastrike, it may prove beneficial for the market components to explicitly not be a Unit. 'Refactor Unit' is already on the high priority list for vegastrike. Taking out all trading related components and replacing them with market (or market and vegastrike specific bits, depending on the situation) may prove handy given how they seem to touch little of the capabilities of the unit class.

To take your example code, a 'base' is a unit that has the flightgroup 'base' that is not a 'sun'? That really doesn't really sound like the way it should be defined. Still, I agree these are probably the things things that need to (somehow) link to economy. I'm beginning to think it may be best to find an 'ID' of sorts for the vegastrike bases in order to link them with their economy equivalent. Possibly something like starsystem/flightgroup/name can be that.

If one could add (economy) Bases which one can later get the Cargo from, this would be an minimal interface between vegastrike's Unit mess and its economy. Especially since vegastrike proper and its economy will pretty much only interact through the players buy screen for the forseeable future. Going this route, the best way to create the economy would be for it to be defined base for base by the python script. It shouldn't be too hard to have python interact with c++ classes. I need to look up how that worked again.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

I am glad expat apparently worked out well though.
ah ah ah !
I have set them manually .

I need to read 1 or 2 time your last post for some details , but for the most part " what you
see i can see . "

The kind of ' ID' is possible , i'm looking at the core of milkyway.xml the definitions of planets and
moons , and i notice we got their radius , location in space.
With that information i could derive a simplified geolocalisation system to store regions , citys , bases .
Perhaps create a new .xml file that keep the records of regions and bases in the planets .

Or simply add to the actual file one variable for the market lib object name or ... UNIQUE_ID.

Like planets or moon are listed , we could list the bases in files or sql/sqlite tables .
But before go ahead , i need to fully understand ( and test ) the fonctions that are in use today .
And see if the data is copied in memory or read from file only when docked .
I think they are in memory in a vector of units , loaded by sectors/systems .

I need to verify that point too .

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I am coding a market

Post by ezee »

I have finally taken the decision to change my project's name , because of his purpose that differs
from Nido's project .
New project name is DEFG ( not the sexiest name of the world , but with a kind of logic inside ^^ )

I will certainly apply my ideas in the actual Nido's framework that is good but don't fit yo my needs .
The updated project page : https://github.com/Ezeer/Dynamic-Economy-For-Games

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I am coding a market

Post by nido »

ezee wrote:I have finally taken the decision to change my project's name , because of his purpose that differs
from Nido's project .
New project name is DEFG ( not the sexiest name of the world , but with a kind of logic inside ^^ )
Okay, that kinda came from left field, but if you think this is best, that is up to you. I would still like to see the cmake log though.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

in the Build folder :

Code: Select all

# This is the CMakeCache file.
# For build in directory: c:/vegastrike-market-master/Build
# It was generated by CMake: D:/program files/cmake-2.8.11-win32-x86/bin/cmake.exe
# You can edit this file to change values found and used by cmake.
# If you do not want to change any of the values, simply exit the editor.
# If you do want to change a value, simply edit, save, and exit the editor.
# The syntax for the file is as follows:
# KEY:TYPE=VALUE
# KEY is the name of a variable in the cache.
# TYPE is a hint to GUI's for the type of VALUE, DO NOT EDIT TYPE!.
# VALUE is the current value for the KEY.

########################
# EXTERNAL cache entries
########################

//Semicolon separated list of supported configuration types, only
// supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything
// else will be ignored.
CMAKE_CONFIGURATION_TYPES:STRING=Debug;Release;MinSizeRel;RelWithDebInfo

//Flags used by the compiler during all build types.
CMAKE_CXX_FLAGS:STRING= /DWIN32 /D_WINDOWS /W3 /GR /EHsc

//Flags used by the compiler during debug builds.
CMAKE_CXX_FLAGS_DEBUG:STRING=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1

//Flags used by the compiler during release minsize builds.
CMAKE_CXX_FLAGS_MINSIZEREL:STRING=/MD /O1 /Ob1 /D NDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_CXX_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /D NDEBUG

//Flags used by the compiler during Release with Debug Info builds.
CMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING=/MD /Zi /O2 /Ob1 /D NDEBUG

//Libraries linked by defalut with all C++ applications.
CMAKE_CXX_STANDARD_LIBRARIES:STRING=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib

//Flags used by the compiler during all build types.
CMAKE_C_FLAGS:STRING= /DWIN32 /D_WINDOWS /W3

//Flags used by the compiler during debug builds.
CMAKE_C_FLAGS_DEBUG:STRING=/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1

//Flags used by the compiler during release minsize builds.
CMAKE_C_FLAGS_MINSIZEREL:STRING=/MD /O1 /Ob1 /D NDEBUG

//Flags used by the compiler during release builds (/MD /Ob1 /Oi
// /Ot /Oy /Gs will produce slightly less optimized but smaller
// files).
CMAKE_C_FLAGS_RELEASE:STRING=/MD /O2 /Ob2 /D NDEBUG

//Flags used by the compiler during Release with Debug Info builds.
CMAKE_C_FLAGS_RELWITHDEBINFO:STRING=/MD /Zi /O2 /Ob1 /D NDEBUG

//Libraries linked by defalut with all C applications.
CMAKE_C_STANDARD_LIBRARIES:STRING=kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib

//Flags used by the linker.
CMAKE_EXE_LINKER_FLAGS:STRING=' /machine:X86 '

//Flags used by the linker during debug builds.
CMAKE_EXE_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL:YES

//Flags used by the linker during release minsize builds.
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO

//Flags used by the linker during release builds.
CMAKE_EXE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO

//Flags used by the linker during Release with Debug Info builds.
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL:YES

//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files/VegastrikeEconomy

//Path to a program.
CMAKE_LINKER:FILEPATH=C:/Program Files/Microsoft Visual Studio 9.0/VC/bin/link.exe

//make program
CMAKE_MAKE_PROGRAM:FILEPATH=C:/PROGRA~1/MICROS~1.0/Common7/IDE/devenv.com

//Flags used by the linker during the creation of modules.
CMAKE_MODULE_LINKER_FLAGS:STRING=' /machine:X86 '

//Flags used by the linker during debug builds.
CMAKE_MODULE_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL:YES

//Flags used by the linker during release minsize builds.
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO

//Flags used by the linker during release builds.
CMAKE_MODULE_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO

//Flags used by the linker during Release with Debug Info builds.
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL:YES

//Value Computed by CMake
CMAKE_PROJECT_NAME:STATIC=VegastrikeEconomy

//RC compiler
CMAKE_RC_COMPILER:FILEPATH=rc

//Flags for Fortran compiler.
CMAKE_RC_FLAGS:STRING=' '

//Flags used by the linker during the creation of dll's.
CMAKE_SHARED_LINKER_FLAGS:STRING=' /machine:X86 '

//Flags used by the linker during debug builds.
CMAKE_SHARED_LINKER_FLAGS_DEBUG:STRING=/debug /INCREMENTAL:YES

//Flags used by the linker during release minsize builds.
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL:STRING=/INCREMENTAL:NO

//Flags used by the linker during release builds.
CMAKE_SHARED_LINKER_FLAGS_RELEASE:STRING=/INCREMENTAL:NO

//Flags used by the linker during Release with Debug Info builds.
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO:STRING=/debug /INCREMENTAL:YES

//If set, runtime paths are not added when installing shared libraries,
// but are added when building.
CMAKE_SKIP_INSTALL_RPATH:BOOL=OFF

//If set, runtime paths are not added when using shared libraries.
CMAKE_SKIP_RPATH:BOOL=OFF

//If true, cmake will use relative paths in makefiles and projects.
CMAKE_USE_RELATIVE_PATHS:BOOL=OFF

//If this value is on, makefiles will be generated without the
// .SILENT directive, and all commands will be echoed to the console
// during the make.  This is useful for debugging only. With Visual
// Studio IDE projects all commands are done without /nologo.
CMAKE_VERBOSE_MAKEFILE:BOOL=OFF

//Path to a file.
CPPUNIT_INCLUDE_DIR:PATH=CPPUNIT_INCLUDE_DIR-NOTFOUND

//Path to a library.
CPPUNIT_LIBRARIES:FILEPATH=CPPUNIT_LIBRARIES-NOTFOUND

//Graphviz Dot tool for using Doxygen
DOXYGEN_DOT_EXECUTABLE:FILEPATH=DOXYGEN_DOT_EXECUTABLE-NOTFOUND

//Doxygen documentation generation tool (http://www.doxygen.org)
DOXYGEN_EXECUTABLE:FILEPATH=DOXYGEN_EXECUTABLE-NOTFOUND

//Path to a file.
EXPAT_INCLUDE_DIR:PATH=D:/program/VSMARKET/Vegastrike_Market/src

//Path to a library.
EXPAT_LIBRARY:FILEPATH=D:/program/VSMARKET/Vegastrike_Market/lib/xmlparse.lib

//Path to a program.
PKGCONFIG_EXECUTABLE:FILEPATH=PKGCONFIG_EXECUTABLE-NOTFOUND

//pkg-config executable
PKG_CONFIG_EXECUTABLE:FILEPATH=PKG_CONFIG_EXECUTABLE-NOTFOUND

//Value Computed by CMake
VegastrikeEconomy_BINARY_DIR:STATIC=C:/vegastrike-market-master/Build

//Value Computed by CMake
VegastrikeEconomy_SOURCE_DIR:STATIC=C:/vegastrike-market-master

//Dependencies for the target
market_LIB_DEPENDS:STATIC=general;stdc++;general;D:/program/VSMARKET/Vegastrike_Market/lib/xmlparse.lib;


########################
# INTERNAL cache entries
########################

//ADVANCED property for variable: CMAKE_BUILD_TOOL
CMAKE_BUILD_TOOL-ADVANCED:INTERNAL=1
//What is the target build tool cmake is generating for.
CMAKE_BUILD_TOOL:INTERNAL=C:/PROGRA~1/MICROS~1.0/Common7/IDE/devenv.com
//This is the directory where this CMakeCache.txt was created
CMAKE_CACHEFILE_DIR:INTERNAL=c:/vegastrike-market-master/Build
//Major version of cmake used to create the current loaded cache
CMAKE_CACHE_MAJOR_VERSION:INTERNAL=2
//Minor version of cmake used to create the current loaded cache
CMAKE_CACHE_MINOR_VERSION:INTERNAL=8
//Patch version of cmake used to create the current loaded cache
CMAKE_CACHE_PATCH_VERSION:INTERNAL=11
//Path to CMake executable.
CMAKE_COMMAND:INTERNAL=D:/program files/cmake-2.8.11-win32-x86/bin/cmake.exe
//ADVANCED property for variable: CMAKE_CONFIGURATION_TYPES
CMAKE_CONFIGURATION_TYPES-ADVANCED:INTERNAL=1
//Path to cpack program executable.
CMAKE_CPACK_COMMAND:INTERNAL=D:/program files/cmake-2.8.11-win32-x86/bin/cpack.exe
//Path to ctest program executable.
CMAKE_CTEST_COMMAND:INTERNAL=D:/program files/cmake-2.8.11-win32-x86/bin/ctest.exe
//ADVANCED property for variable: CMAKE_CXX_FLAGS
CMAKE_CXX_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_CXX_STANDARD_LIBRARIES
CMAKE_CXX_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS
CMAKE_C_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_C_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_C_STANDARD_LIBRARIES
CMAKE_C_STANDARD_LIBRARIES-ADVANCED:INTERNAL=1
//Path to cache edit program executable.
CMAKE_EDIT_COMMAND:INTERNAL=D:/program files/cmake-2.8.11-win32-x86/bin/cmake-gui.exe
//Executable file format
CMAKE_EXECUTABLE_FORMAT:INTERNAL=Unknown
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS
CMAKE_EXE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_DEBUG
CMAKE_EXE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_MINSIZEREL
CMAKE_EXE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//Name of generator.
CMAKE_GENERATOR:INTERNAL=Visual Studio 9 2008
//Name of generator toolset.
CMAKE_GENERATOR_TOOLSET:INTERNAL=
//Start directory with the top level CMakeLists.txt file for this
// project
CMAKE_HOME_DIRECTORY:INTERNAL=C:/vegastrike-market-master
//ADVANCED property for variable: CMAKE_LINKER
CMAKE_LINKER-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MAKE_PROGRAM
CMAKE_MAKE_PROGRAM-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS
CMAKE_MODULE_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_DEBUG
CMAKE_MODULE_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL
CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELEASE
CMAKE_MODULE_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//number of local generators
CMAKE_NUMBER_OF_LOCAL_GENERATORS:INTERNAL=1
//ADVANCED property for variable: CMAKE_RC_COMPILER
CMAKE_RC_COMPILER-ADVANCED:INTERNAL=1
CMAKE_RC_COMPILER_WORKS:INTERNAL=1
//ADVANCED property for variable: CMAKE_RC_FLAGS
CMAKE_RC_FLAGS-ADVANCED:INTERNAL=1
//Path to CMake installation.
CMAKE_ROOT:INTERNAL=D:/program files/cmake-2.8.11-win32-x86/share/cmake-2.8
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS
CMAKE_SHARED_LINKER_FLAGS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_DEBUG
CMAKE_SHARED_LINKER_FLAGS_DEBUG-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL
CMAKE_SHARED_LINKER_FLAGS_MINSIZEREL-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_SHARED_LINKER_FLAGS_RELEASE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO
CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_INSTALL_RPATH
CMAKE_SKIP_INSTALL_RPATH-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_SKIP_RPATH
CMAKE_SKIP_RPATH-ADVANCED:INTERNAL=1
//Suppress Warnings that are meant for the author of the CMakeLists.txt
// files.
CMAKE_SUPPRESS_DEVELOPER_WARNINGS:INTERNAL=FALSE
//ADVANCED property for variable: CMAKE_USE_RELATIVE_PATHS
CMAKE_USE_RELATIVE_PATHS-ADVANCED:INTERNAL=1
//ADVANCED property for variable: CMAKE_VERBOSE_MAKEFILE
CMAKE_VERBOSE_MAKEFILE-ADVANCED:INTERNAL=1
CPPUNIT_CFLAGS:INTERNAL=
CPPUNIT_CFLAGS_I:INTERNAL=
CPPUNIT_CFLAGS_OTHER:INTERNAL=
CPPUNIT_FOUND:INTERNAL=
CPPUNIT_INCLUDEDIR:INTERNAL=
CPPUNIT_LIBDIR:INTERNAL=
CPPUNIT_LIBS:INTERNAL=
CPPUNIT_LIBS_L:INTERNAL=
CPPUNIT_LIBS_OTHER:INTERNAL=
CPPUNIT_LIBS_PATHS:INTERNAL=
CPPUNIT_PREFIX:INTERNAL=
CPPUNIT_STATIC_CFLAGS:INTERNAL=
CPPUNIT_STATIC_CFLAGS_I:INTERNAL=
CPPUNIT_STATIC_CFLAGS_OTHER:INTERNAL=
CPPUNIT_STATIC_LIBDIR:INTERNAL=
CPPUNIT_STATIC_LIBS:INTERNAL=
CPPUNIT_STATIC_LIBS_L:INTERNAL=
CPPUNIT_STATIC_LIBS_OTHER:INTERNAL=
CPPUNIT_STATIC_LIBS_PATHS:INTERNAL=
CPPUNIT_VERSION:INTERNAL=
//ADVANCED property for variable: DOXYGEN_DOT_EXECUTABLE
DOXYGEN_DOT_EXECUTABLE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: DOXYGEN_EXECUTABLE
DOXYGEN_EXECUTABLE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: EXPAT_INCLUDE_DIR
EXPAT_INCLUDE_DIR-ADVANCED:INTERNAL=1
//ADVANCED property for variable: EXPAT_LIBRARY
EXPAT_LIBRARY-ADVANCED:INTERNAL=1
//Details about finding EXPAT
FIND_PACKAGE_MESSAGE_DETAILS_EXPAT:INTERNAL=[D:/program/VSMARKET/Vegastrike_Market/lib/xmlparse.lib][D:/program/VSMARKET/Vegastrike_Market/src][v()]
//ADVANCED property for variable: PKGCONFIG_EXECUTABLE
PKGCONFIG_EXECUTABLE-ADVANCED:INTERNAL=1
//ADVANCED property for variable: PKG_CONFIG_EXECUTABLE
PKG_CONFIG_EXECUTABLE-ADVANCED:INTERNAL=1
//Stored GUID
SG_Filter_CMake Rules_GUID_CMAKE:INTERNAL=26C659AB-87AA-4936-802C-94AA42A12B79
//Stored GUID
SG_Filter_Header Files_GUID_CMAKE:INTERNAL=CE25808D-3988-47EC-B9F9-84877A4DF332
//Stored GUID
SG_Filter_Object Files_GUID_CMAKE:INTERNAL=00C24724-D8A7-48B4-92B5-76AE1EEDC705
//Stored GUID
SG_Filter_Resources_GUID_CMAKE:INTERNAL=72C088DE-7404-4B2E-BBFE-DD54F78B3792
//Stored GUID
SG_Filter_Source Files_GUID_CMAKE:INTERNAL=4D0A49CD-224A-46AF-A7D2-089276C027CE
//Stored GUID
ZERO_CHECK_GUID_CMAKE:INTERNAL=66F1C227-AF51-4E11-95EF-BE7F378BDFE8
__pkg_config_checked_CPPUNIT:INTERNAL=1

after the config :

Code: Select all

Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE) 
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CPPUNIT_LIBRARIES
    linked by target "bigtest" in directory C:/vegastrike-market-master

Configuring incomplete, errors occurred!
After the build :

Code: Select all

Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE) 
Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE) 
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CPPUNIT_LIBRARIES
    linked by target "bigtest" in directory C:/vegastrike-market-master

Configuring incomplete, errors occurred!
CMAKE is indeed a good idea , but also an investment in time to configure i actually don't have .
Sorry for that Nido .
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CPPUNIT_LIBRARIES
linked by target "bigtest" in directory C:/vegastrike-market-master
This is the problem proper. I have updated the github version, it should not have this problem anymore

EDIT: closed quote
Last edited by nido on Tue Jun 02, 2015 8:19 pm, edited 1 time in total.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

good job .
i'll try it tomorrow .
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

You said you've made changes ?
I have looked to your git and the last change is 3 days old ...
https://github.com/nido/vegastrike-market/tree/master

Yesterday i sent you a report with the same files than today .
And again , i had to configure expat , and cppunit fails ..
Could NOT find PkgConfig (missing: PKG_CONFIG_EXECUTABLE)
Found EXPAT: D:/program/VSMARKET/Vegastrike_Market/lib/xmlparse.lib (found version "2.0.1")
Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
CPPUNIT_LIBRARIES
linked by target "bigtest" in directory C:/vegastrike-market-master

Configuring incomplete, errors occurred!
Why don't you put expat in your lib , with correct CMAKE links ?
expat.h =40 ko
xmlparse=27 ko

I don't understand you , every time , i need to navigate in my huge folders to point to expath and xmlparse,
when you could provide it as dependency .

I can't see no good reason to don't do that .
I'm tired with that CMAKE config that isn't useful in my case .
MY WAY :
The best way for a windows user is to make a new solution , a project , and fill it with your sources files :
https://github.com/nido/vegastrike-mark ... master/src
Add the xmlparse.lib to the linker input , compile and build as static lib .
That's all.

Edit : I've found something useful for my project , perhaps for you too :
( MIT License )
C++: Minimalistic CSV Streams

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

ezee wrote:You said you've made changes ?
I have looked to your git and the last change is 3 days old ...
https://github.com/nido/vegastrike-market/tree/master
Seems something went wrong with github. Looking at it the last change in CMakeLists.txt was on was June 2nd. Could be that I just pushed those changes a moment ago habitually, when I failed to do so yesterday evening.
And again , i had to configure expat , and cppunit fails ..
Found EXPAT: D:/program/VSMARKET/Vegastrike_Market/lib/xmlparse.lib (found version "2.0.1")
[snip]
I don't understand you , every time , i need to navigate in my huge folders to point to expath and xmlparse,
when you could provide it as dependency .
find_package will locate packages installed in places where they are expected to be installed. One of these conventions is <prefix>/<name>*/. In this particular case, expat on windows, that would be "C:/program files/expat-2.0.1/". If you installed it to that default location, cmake could've picked it up automagically. Since you installed it into a path neither I nor CMAKE ever heard about, it will have problems locating it.
Why don't you put expat in your lib , with correct CMAKE links ?
expat.h =40 ko
xmlparse=27 ko
The last 'release' mentioned on the expat homepage is version 2.0.1. This was on 5 June 2007. Yet, according to the repositories, as little (in comparison to the year 2007) as three years ago, changes have been made in response to a couple of bugs. Which 2.0.1 version should I be distributing? The 2007 or the 2012 version? Expat is MIT licensed, so it wouldn't be hard licensewise to include only binaries, but which windows binaries should be supplied? mingw32? mingw64? msvc either 64 or 32bit? What are the incompatible compiler switches for which also separate libs must be made? what about mac/linux/bsd?
What would I do when someone sends me a patch for expat patch to change market behaviour? Especially since I have no power over the lib proper.
When will there be a new version of expat? Should we need the new version of expat or is it perhaps even incompatible? Is there a downstream of people who should get the updated expat library? Will people remember we use a prepackaged binary 10 years down the line and check whether it is still actually up to date?

These are but a few things to take into account when bundling a library. Also, this particular stap (cmake) is only needed once (assuming it is set up correctly, which we are trying to achieve here). The resulting vsproject file can be used from that point on.
I can't see no good reason to don't do that .
I'm tired with that CMAKE config that isn't useful in my case .
MY WAY :
The best way for a windows user is to make a new solution , a project , and fill it with your sources files :
https://github.com/nido/vegastrike-mark ... master/src
Add the xmlparse.lib to the linker input , compile and build as static lib .
That's all.
As I recall, when you joined in this thread you spent several days creating said visual studio project. Something that, should it be configured correctly, CMake takes about 0.164 seconds to do, and after which the correctness of the paths has been ensured, they do not need to be checked and altered to their local alternatives; they would already have already been set.
Edit : I've found something useful for my project , perhaps for you too : ( MIT License ) C++: Minimalistic CSV Streams
Firstly, the master part list parser already works, so there is no immediate need for a different paresr.
Secondly, at first glance, this project seems to parse in a very naive manner taking only the delimiter into account. the master part list already has quoted fields in it which contains comma's which will hence get misparsed.
Thirdly, how is this supposed to be compiled? The Makefile which supposibly does only compiles an example.exe, doesn't even mention minicsv.h.
Fourthly, what license is it? The project itself claims the following three: MIT, The Code Project Open License (CPOL) 1.02 and SequelMax .NET License 2014 - 2015. COPL is not GPL compatible. The SequelMax license I couldn't even find other then being mentioned as the license in License.html.

Whilst I appreciate your suggestion, all this together makes me feel that this may not be a useful library for this project.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

I have seen the xml parser in your lib , but not the .csv
That's why i joined this link on my previous post .

I know CMAKE can do a very good job , i used to compile the sources of Ogre3d ,
and it is a big project ...
Anyway , i'm looking to make my own lib because some of your stuff don't fit with my direction .
Not a problem , we just have different logic and different goals .
:)

I want to have a CargoContainer for example , that will reject a buy request if there is not enough rooms for this new particular item .
I tried to make changes on your code , but that mean a complete rewrite as ProductionOptions for example use a cargo as parameter , cargo that is also a container ...
I tried to make a cargo class that inherits from cargoType , to fill the std::map of
CargoContainer with cargo instead of cargotype .
But that mean a total rewrite of the lib , as base use also Cargo , etc ...

Your cargo class is a container and a content , i want to split that .
With few other ideas that i have , that is sufficient to think about make my lib from scratch .
As i want it to be usable in other games ( vegastrike is a kind of laboratory for me ) , i need a total freedom and ... my syntax also . :lol:

Okay , that's all for now , i hope some other members will have a look to your work and give support to it because like i said , it is a good framework .
Perhaps a little complicated , at first glance .
My console exemple was designed to help ( me and ) people to give it a try .
But i 'm not sure to have used it the right way and sure to don't have exploited all its potential.
So a little tutorial that shows how it is supposed to work efficiently IN VEGASTRIKE is welcome .

Edit :
the master part list already has quoted fields in it which contains comma's which will hence get misparsed.
Correct , i have some failures because of that .
A user posted a comment/fix :
Very nice library, thanks!
Still it needs some additional development to make it usable in general cases:
1) fields in csv-files can be enclosed in double-quotes, in this case double-quotes inside them must be escaped (use "" instead of "). Also double-quotes are not allowed in the fields if the field is not enclosed in double-quotes.
EDIT 2 : I've found your parser , seems to be neat, and cargoType is a good choice here.
https://github.com/nido/vegastrike-mark ... LParse.cpp
:wink:
Last edited by ezee on Wed Jun 03, 2015 2:32 pm, edited 1 time in total.

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

ezee wrote:Anyway , i'm looking to make my own lib because some of your stuff don't fit with my direction .
Not a problem , we just have different logic and different goals .
As I hinted before, I am just surprised you come to this conclusion so fast without elaborating on what you planned to do with it.
I want to have a CargoContainer for example , that will reject a buy request if there is not enough rooms for this new particular item .
I tried to make changes on your code , but that mean a complete rewrite as ProductionOptions for example use a cargo as parameter , cargo that is also a container ...
I don't see the problem with creating a cargocontainer class which limits the amount of Cargo it accepts. I also don't see how that limit is in any way important in defining the in- and outputs of ProductionOptions.
I tried to make a cargo class that inherits from cargoType , to fill the std::map of
CargoContainer with cargo instead of cargotype. [snip] Your cargo class is a container and a content , i want to split that .
Why exactly do you want a std::map in your Cargo containing CargoType? A Cargo can represent anything from '1 stembolt*' to '200 iron, 5 wooden planks, 600000 iso fugitives and 1 kitchen sink'. Your containers' job would be to check whether putting these two together will result in more then the alloted space/weight/whatever and reject addition in that case.

Market cargo is different from (current) vegastrike cargo though. in vegastrike, cargo is saved as 'n' copies of this cargotype. It can either be '200 iron' or '1 stembolt', not '200 iron and 1 stembolt'.

But that mean a total rewrite of the lib , as base use also Cargo , etc ...
Probably if multiple projects wish to make use of the project the base CargoType needs to be versatile, probably replacable.
But i 'm not sure to have used it the right way and sure to don't have exploited all its potential.
So a little tutorial that shows how it is supposed to work efficiently IN VEGASTRIKE is welcome .
Once the library is done we can implement it in vegastrike. How this is done efficiently depends on how the library is finished. Hence nothing of this kind has been done yet.



What still needs to happen is for (vegastrike) default factories to be defined, creation and reference to the economy made available and a trading interface in order for it to do _something_ (namely have ~3000 completely autonomous "economies" running in the universe). After that inter-base trade is probably the next step to make it more dynamic, and depending on circumstances, either more complicated governing or dispatching ships to bring cargo (which may not arrive).

* I couldn't think of a better random cargo type. It is essential to imagine them to be self sealing though.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

As I hinted before, I am just surprised you come to this conclusion so fast without elaborating on what you planned to do with it.
I must be an impulsive guy ?
:lol:

In fact i had a sudden idea with the FSM provided by MrBuckland on AI-junkie , and tried to quick implement it .
But i then saw the little things that don't fit in your market lib with my logic ( a concept that i can't actually proove :lol: ) .
Also , the steps that i used in my exemple console app show a lot of actions to perform for doing simple things like
add and remove cargo . It is a complex chain that is not easy to use .
But again , that example was written with my understanding of your logic , and my understanding is still in progress ...
^^
Why exactly do you want a std::map in your Cargo containing CargoType?
I don't want that ! That is what YOU HAVE DESIGNED , REMEMBER ? ( :lol: )
/** A collection of individual amounts of different CargoType's.
* This class should represent any random pile of stuff an entity
* (player, ship, base) happens to have.
*/
class Cargo {
public:
....
private:
/** Iterator datastructure iterator */
typedef std::map<CargoType, unsigned int>::iterator iterator;

/** Iterator datastructure const iterator */
typedef std::map<CargoType, unsigned int>::const_iterator const_iterator;

/** The datastructure holding the actual cargo itself. */
std::map<CargoType, unsigned int> cargo;
For me , Cargo class should be CargoContainer class .
I dont want to access Cargo::cargo , but CargoContainer::cargo .
:roll:

As i don' want Earth and moon be a flightgroup :mrgreen:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

Why exactly do you want a std::map in your Cargo containing CargoType?
I don't want that ! That is what YOU HAVE DESIGNED , REMEMBER ? ( :lol: )

I mistyped the question. In relation to
I tried to make a cargo class that inherits from cargoType , to fill the std::map of
CargoContainer with cargo instead of cargotype. [snip] Your cargo class is a container and a content , i want to split that .
the question should be: Why exactly do you want a std::map in your Cargo containing CargoContainer? The question is done especially because Cargo already models all sorts of different amounts of different sorts cargo.

For me , Cargo class should be CargoContainer class .
I dont want to access Cargo::cargo , but CargoContainer::cargo .
:roll:
I'm sorry; but as far as i know, the Cargo class has no cargo functions and neither does this class live in a namespace, so i don't really understand what you mean. I'm beginning to get the idea you are fine with the Cargo and CargoType classes, but want to rename Cargo to CargoContainer and CargoType to Cargo.


O.T.: I just noticed i am now a 'merchant'.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

I'm beginning to get the idea you are fine with the Cargo and CargoType classes, but want to rename Cargo to CargoContainer and CargoType to Cargo.
That's it .

CargoContainer.cargo and not Cargo.cargo ( even if you made it private , when i'm in Cargo i deal with an other
cargo , that's not good to me ) .

Also the way you define the ProductionOptions with a cargo , not with a cargoType , seems not natural to me:
ProductionOption::ProductionOption(const Cargo &consumes, const Cargo &produces)
: consumes(consumes), produces(produces) {}
I would like to use a cargoType instead of Cargo that is a container containing cargo of cargoTypes .
You see ?

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

This time CMAKE worked !
But there is an error at compilation time :
1>Compiling...
1>CargoType.cpp
1>common.cpp
1>Economy.cpp
1>MPLParse.cpp
1>XMLNode.cpp
1>..\src\XMLNode.cpp(225) : error C3861: 'strtof': identifier not found
1>..\src\XMLNode.cpp(226) : error C3861: 'strtof': identifier not found
1>..\src\XMLNode.cpp(227) : error C3861: 'strtof': identifier not found
1>Base.cpp
1>Factory.cpp
1>ProductionOption.cpp
1>Cargo.cpp
1>..\src\Cargo.cpp(84) : error C2039: 'at' : is not a member of 'std::map<_Kty,_Ty>'
1> with
1> [
1> _Kty=CargoType,
1> _Ty=unsigned int
1> ]
1>Generating Code...
1>Build log was saved at "file://c:\vegastrike-market-master\Build\market.dir\Release\BuildLog.htm"
1>market - 4 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 1 up-to-date, 0 skipped ==========
I can fix that probably , but you would like to know if that works out of the box i guess .
I don't have that error in my version of MarketLib

Edit : .at is c++11 , works with MSVC>2013 i think .

EDIT2 : That is my great part of work ( :lol: ) for the lib :
#ifdef WIN32
#include <stdlib.h> //ezee for windows
#endif
Just check that file for my modifs:
https://github.com/Ezeer/Dynamic-Econom ... MLNode.cpp

Same for .at :
#if __cplusplus > 199711L
if (this->cargo.at(newStock->first) < newStock->second) {return false;}
#else
if (this->cargo.find(newStock->first)->second< newStock->second) {return false;}
#endif
https://github.com/Ezeer/Dynamic-Econom ... /Cargo.cpp

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

As i try to level up my dumbness , i think i have found a good compromise that would help me and other dumbs
like me to work with the Cargo class you designed :
/** The datastructure holding the actual cargo itself. */
std::map<CargoType, unsigned int> cargoItems;
Or
/** The datastructure holding the actual cargo itself. */
std::map<CargoType, unsigned int> load;
Everything BUT cargo could work for me .
:lol:

Deal ?
:wink:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

CargoContainer.cargo and not Cargo.cargo ( even if you made it private , when i'm in Cargo i deal with an other
cargo , that's not good to me ) .
What is this '.cargo' part you are talking about. As said before, there is no function with that name, nor is there a namespace called Cargo. any way to call Cargo.cargo in i can think of the code would be a syntax error. Hence, I don't understand what you are saying here.
Also the way you define the ProductionOptions with a cargo , not with a cargoType , seems not natural to me:
Because a CargoType is insufficient input for a ProductionOption. A ProductionOption takes a Cargo(Container), and turns it into another Cargo(container).

Among other possibilities, a ProductionOption can turn one Foo into two Bar, or two Foo's into one Bar. Or three Foo's and four Bar into five Bazs. How are you goinbg to do this is the ProductionOption can only know the name of one of the types of its in/output, and not its quantity?

I would like to use a cargoType instead of Cargo that is a container containing cargo of cargoTypes .
You see ?
Given the explaination i gave above, no. If you could illustrate using the examples I gave I would be much obliged.



Glad to hear cmake now functions properly on windows too. I took the non-c++11-only version of the solution since hunting for which compile path has been taken is not a fun thing and in this case the functions are nearly identical. Perhaps some "c++11lite" package should be made translating the "new" c++ functions to their older equivalent ones. Would probably be hard with stdlib though.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

Given the explaination i gave above, no. If you could illustrate using the examples I gave I would be much obliged.
Let me try .
But before , lets look to your doc :
Factories work like this:

A factory has a number of production options.
There should not be too many because the factory collects and stores resources that it needs for production.

A factory is calculating the supplies it needs to buy from the market by taking the max over the required inputs for each production options respectively. A factory will calculate the price it is willing to pay by taking what it will get for selling its output, discounting it by the profit rate, and distributing the money over all resources in proportion to the current market value of the resources. Now a buy order can be placed on the market if there is enough money. If there isn't enough money, divide up the remaining money to place buy orders.

Upon receiving new supplies the factories reserve is check whether any production option may be executed fully or partially. Of the executable options, the one with the highest absolute profit is chosen and executed.
Afterthis , i say that we could push options in the factory when we need a certain kind of cargoType .
How actually your factory work is :
bool ProductionOption::canProduce(const Cargo &cargoStore) const {
return cargoStore.contains(this->consumes);
}
Now , what is " this->consumes " ?
A pointer to Cargo .

We are here:
Because a CargoType is insufficient input for a ProductionOption. A ProductionOption takes a Cargo(Container), and turns it into another Cargo(container).


Why a container is needed here ? Because of the std::map that contains all types of cargos available ?
Your system seem to be based in a " one time declaration " , i propose to push into the CargoContainer used
by the factory that is :
/** Cargo consumed by production. */
Cargo consumes;
A fonction like :

bool ProductionOption::addOption(CargoType &type)
{
// you take your iterator
// you find the type inside your consumer map
// you increment the second value if type exists ?
// return true if it's done , else false .
}

That is my proposition .

Edit : That could be used after yhe default constructor for example :
/** Empty constructor for cpptest */
ProductionOption::ProductionOption() : consumes(Cargo()), produces(Cargo()) {}
From there , we could manually add CargoItems (the elements in a map that contains a pair of cargotype and unsigned int ) one by one OR by container , as you seem to doing
now in your second constructor :
ProductionOption::ProductionOption(const Cargo &consumes, const Cargo &produces)
: consumes(consumes), produces(produces) {}

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

ezee wrote:But before , lets look to your doc :
Factories work like this:

A factory has a number of production options.
There should not be too many because the factory collects and stores resources that it needs for production.

A factory is calculating the supplies it needs to buy from the market by taking the max over the required inputs for each production options respectively. A factory will calculate the price it is willing to pay by taking what it will get for selling its output, discounting it by the profit rate, and distributing the money over all resources in proportion to the current market value of the resources. Now a buy order can be placed on the market if there is enough money. If there isn't enough money, divide up the remaining money to place buy orders.

Upon receiving new supplies the factories reserve is check whether any production option may be executed fully or partially. Of the executable options, the one with the highest absolute profit is chosen and executed.
I am sorry. I do not recognise this text. Which doc is this? Nevermind. I have grep... doc/factory_masterplan.txt

I am doubly sorry. I believe this is an artifact from redadders' code. At first, I have gotten it to work with cmake, after which i started to check out how it actually worked, I have implemented pretty much a complete redesign. The factory and other components we are working with is way more accurately described in 'plan2.md'. Obviously, I should've paid more attention to the contents of this directory, as the factory_masterplan factory does not exist in my code. I shall try my best to clearify the situation.

Should you want to implement the factory_masterplan.txt's factory now using the market code, a 'base' would be the appropriate structure to represent the masterplan factory. The bases' cargoStore would be where the resources would be stored (with addCargo/deleteCargo).

What the masterplan calls a productionoption is split up into two parts in market, the Factory, and ProductionOption. the ProductionOption represents the possibility to do different types of production (for example, create only a few, or a lot of whatever resource you can make). The difference is that the masterplan run do multiple production options simultaniously, whilst only one ProductionOption per Factory can in a tick. Bases can have multiple Factores, which is how one can accomodate that functionality.

This document also talks about buy orders, worker pay, profit rates, discounts and whatnot. As you may have discovered this is very much not implemented in the current code. Most of these also do not seem to have an ability to have much impact on vegastrike in its current state, as to start, the whole concept of people is nonexistent. I will inspect this directory better this weekend and see to remove outdated and incorrect information. For now I apologise for this misunderstanding.


[snip]
bool ProductionOption::canProduce(const Cargo &cargoStore) const {
return cargoStore.contains(this->consumes);
}
Now , what is " this->consumes " ?
A pointer to Cargo .
If you want to be pedantic about it, it is a proper Cargo, but you probably don't mean that with this question.

A ProductionOption is the ability of a factory to create something out of something else. It has a 'consumes' Cargo variable, which is subtracted from the cargoStore that is passed during the Produce function. the produces Cargo is subsequently added to the same cargoStore. canProduce is a test whether the cargoStore actually contains what it needs to be producting. If there are not sufficient resources to take everything that is in consumes, no production will take place at all.

We are here:
Because a CargoType is insufficient input for a ProductionOption. A ProductionOption takes a Cargo(Container), and turns it into another Cargo(container).


Why a container is needed here ? Because of the std::map that contains all types of cargos available ?
Your system seem to be based in a " one time declaration " , i propose to push into the CargoContainer used
by the factory that is :
/** Cargo consumed by production. */
Cargo consumes;
The ProductionOption needs it because the Factory can choose to use either of the ProductionOptions available to it. For example, you can create a ProductionOption which turns one foo into one bar, one that turns two foos into three bars, and one that turns five foos into ten bars. Depending on the amount of foos you have, you (or the as of now nonexistent governer) may not be able to create a complete ten bars in a single turn, but may still want to create at least one.
Alternatively, you can create a Factory which can create all types of aircraft, This one factory will be able to create any aircraft, but only one per turn, so a militairy base may want to have more then one of those Factories.

What the factory consumes is dependant on which ProductionOption is used, so it is not able to store this information independent from its ProductionOptions. Similarly, the stored resources mentioned in masterplan are more accurately modelled as the Base's cargoStore.
A fonction like :

bool ProductionOption::addOption(CargoType &type)
{
// you take your iterator
// you find the type inside your consumer map
// you increment the second value if type exists ?
// return true if it's done , else false .
}
That is my proposition .
[/quote]
Unless defined during initiation, the consumer map is empty. Following your pseudocode, this function would do exactly nothing with default ProductionOptions, and can possibly increase the quantity of a certain CargoType by one when it is present in that map.

Running the addOption function essentially increases the amount of a certain resource needed for production by exactly one. Personally I do not see the much benefit of such an option (remember the amount it outputs doesn't grow with it) and as such i do not really understand why it would be called addOption. I guess this construct had to do with some confusion caused by the factory masterplan document, for which i again apologise.

I hope this has created a better picture of what is actually going on. If you have questions/comments regarding this i would be happy to hear so. The factory_masterplan.txt and deviously misnamed market_documentation.txt have little to no accurate information about the current state of the project. reqdoc.txt is a document made by myself trying to map out what requirements there would be for this code to work. plan2.md describes the current and future classes i have planned to implement. PriceList and Governer are not implemented and may possibly change before implementation starts.
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

I hope this has created a better picture of what is actually going on. If you have questions/comments regarding this i would be happy to hear so. The factory_masterplan.txt and deviously misnamed market_documentation.txt have little to no accurate information about the current state of the project. reqdoc.txt is a document made by myself trying to map out what requirements there would be for this code to work. plan2.md describes the current and future classes i have planned to implement. PriceList and Governer are not implemented and may possibly change before implementation starts.
Thx , it's a little bit clear .
Plan2.md is the place where i'll soon be . :wink:
But hey , i knew that the doc was from RedAdder ( i've downloaded all his files to compare with yours and it was
one of the first thing i have read ) .
What i didn't knew is what is your plan and goal .
Now i know where to look for that.

Well , about my pseudo fonction , it is "ezee" to add a second parameter to tell how many increase you want to add
with that " In " option . ( i understand in/out like consume/produce )
bool ProductionOption::addOption(CargoType &type, unsigned int howmany)
{
// you take your iterator
// you find the type inside your consumer map
// you increment*howmany the second value if type exists ? Or force it if don't exist ...
// return true if it's done , else false .
}

Pedantic ...
pedantic (comparative more pedantic, superlative most pedantic)

Like a pedant, overly concerned with formal rules and trivial points of learning.
Being showy of one’s knowledge, often in a boring manner.
Being finicky or fastidious, especially with language.  [quotations ▼]
ah ah ah ... Probably a bit if you have suffered it .
sorry .
:roll:

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

Back to the python side .
You said you'll have a look how they wrap with c++ .
I have found the place that defines Cargo :
Doc about it in unit_wrapper.cpp
PYTHON_BASE_BEGIN_CLASS( VS, Cargo, "Cargo" )
#if BOOST_VERSION != 102800
, boost::python::init< std::string, std::string, float, int, float, float > ( ) );
#else
Class.def( boost::python::constructor< std::string, std::string, float, int, float, float > () );
#endif
PYTHON_DEFINE_METHOD( Class, &Cargo::SetPrice, "SetPrice" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetPrice, "GetPrice" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetMass, "SetMass" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetMass, "GetMass" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetVolume, "SetVolume" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetVolume, "GetVolume" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetQuantity, "SetQuantity" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetQuantity, "GetQuantity" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetContent, "SetContent" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetContentPython, "GetContent" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetCategory, "SetCategory" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetCategoryPython, "GetCategory" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetMissionFlag, "SetMissionFlag" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetMissionFlag, "GetMissionFlag" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetDescriptionPython, "GetDescription" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetFunctionality, "SetFunctionality" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetFunctionality, "GetFunctionality" );
PYTHON_DEFINE_METHOD( Class, &Cargo::SetMaxFunctionality, "SetMaxFunctionality" );
PYTHON_DEFINE_METHOD( Class, &Cargo::GetMaxFunctionality, "GetMaxFunctionality" );

PYTHON_END_CLASS( VS, Cargo )
We could define Market wrap here .
Noptice the format of the arguments :
&Cargo::GetMaxFunctionality
And the doc file for vegastrike cargo is here

I hope this will help you to find a way to implement your market

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

ezee wrote:Well , about my pseudo fonction , it is "ezee" to add a second parameter to tell how many increase you want to add
with that " In " option . ( i understand in/out like consume/produce )
bool ProductionOption::addOption(CargoType &type, unsigned int howmany)
{
// you take your iterator
// you find the type inside your consumer map
// you increment*howmany the second value if type exists ? Or force it if don't exist ...
// return true if it's done , else false .
}
That would, but then you'd have a function with which you can arbitrarily increase the amount of a single input resource needed to create the same output as previously. I don't see of what the use for this is. If you want to add new ProductionOptions to the Factory, Factory::addProductionOption seems to be the function you are looking for. Adding a delProductionOption would also allow for "altering" the available ProductionOptions by flat out replacing them, though we probably need some way to extract said ProductionOptions in that case.

There is no choice or selection to be done within ProductionOption, so i don't see why this is named addOption. How and why would you plan to use this function?
ezee
Intrepid Venturer
Intrepid Venturer
Posts: 703
Joined: Tue Feb 11, 2014 12:47 am
Location: FRANCE
Contact:

Re: Now I was thinking maybe I'd code a market

Post by ezee »

That would, but then you'd have a function with which you can arbitrarily increase the amount of a single input resource needed to create the same output as previously.
No , because you designed two containers , one for input and one for output .
AddOption in my mind is AddOptionIn if you prefer , stored in CONSUMES
An other fonction could set the OptionOut too ...

Exemple :
If a factory needs an amount of 100 iron cargoType to produce a turret , but that it contains actually only 70 ,
when a vessel will dock to the base to unload his CargoContainer that holds 50 iron ,the governor will buy 30 and add this "optionIn " with that function .

Exemple 2 :
Minercraft style : With 3000 CargoType_A and 200 CargoType_B the factory will produce 1 CargoType_C .
Until the right quantity of CargoType is not reached , no production is done .
It is the role of the governor to create a fleet that will convoy consumes Cargo to the factory
and production Cargo to the MarketPlace . ( while a merchant could buy producted cargo directly to the factory ...)
That is DYNAMIC for me .

But what is really a ProductionOption in your lib , and what is his lifetime , i don't know .
A productionOption need to be prepared for each turn ? ( Tick() )

Now i'm totally lost with your design , that don't take the time in parameter also .
In my opinion , produce something takes time , not only raw materials in input .
So a Tick() is able to achieve a production cycle , but not by using the time .

Finally , when , in a vegastrike loop() , do you set your ProductionOptions , when your tick() occurs , etc ... ?

Code: Select all

 if (!track.HasWeapons())
            {
                // So what are you going to threaten me with? Exhaustion gas?
                return ThreatLevel::None;
            }
Vegastrike evolved
DEV YOUTUBE CHANNEL
Vegastrike evolved wiki
nido
Merchant
Merchant
Posts: 43
Joined: Tue Sep 03, 2013 2:35 pm

Re: Now I was thinking maybe I'd code a market

Post by nido »

ezee wrote:
That would, but then you'd have a function with which you can arbitrarily increase the amount of a single input resource needed to create the same output as previously.
No , because you designed two containers , one for input and one for output .
AddOption in my mind is AddOptionIn if you prefer , stored in CONSUMES
An other fonction could set the OptionOut too ...
Which is exactly why it increases only the required input and does nothing to the output. the output variable is not modified.
Exemple :
If a factory needs an amount of 100 iron cargoType to produce a turret , but that it contains actually only 70 ,
when a vessel will dock to the base to unload his CargoContainer that holds 50 iron ,the governor will buy 30 and add this "optionIn " with that function .
Factory needs 100 iron to make a turret; the base only had 70 iron. When 50 extra iron cargo becomes available, these 50 are added to the Base's cargoStore, which then has 120 iron.
calling the factory's ProductionOptions' optionIn function with "30 iron", will change the factory to need 130 iron to create 1 turret. Cargo is only taken when actual production takes place. No "physical" Cargo is saved in ProductionOptions.

The Factory is merely the place where conversion takes place, and only that. Input is taken from the cargoStore, output is saved in the cargoStore. 'consumes' and 'produces' merely tell what is consumed and what is produced by the ProductionOption. The Cargo in a ProductionOption's consumes does not exist. It is a list of ingredients if you will to create the produces. When running Produce, you give it the cargoStore with which to work. It will takes its consumes from there and stores its produces there.
Exemple 2 :
Minercraft style : With 3000 CargoType_A and 200 CargoType_B the factory will produce 1 CargoType_C .
Until the right quantity of CargoType is not reached , no production is done .
It is the role of the governor to create a fleet that will convoy consumes Cargo to the factory
and production Cargo to the MarketPlace . ( while a merchant could buy producted cargo directly to the factory ...)
That is DYNAMIC for me .
However the governer is supposed to replenish its stocks is up to it, but yes; it would be his function to set restocking in motion. However, transport of Cargo from the cargoStore to the Factory happens instantly and does not need accomodation other then to give a reference to the cargoStore during Produce().

Merchants do not yet exist. Assuming you are talking about an ingame dude who manages the trade screens, I envision him to have full access to the bases' complete cargoStore initially. Later, he can have a separate cargoStore of his own which the governer can put stuff in/take stuff out for sale to the general public (this so rich enough players wouldn't be able to e.g. starve a planet by continually buying all the food whenever some becomes available (not that there are any ingame concequences to a lack of food now, but I think you get the point).

Inter-base traders between bases can possibly be the same class, but one needs to be careful. The speed of the library as it is now comes from the fact that its preformance is linear in relation to the number of bases and factories. Naive trade implementations can easily violate this charisteristic. I wouldn't be surprised if the performance drops from two seconds per tick to over an hour per tick if every base would have a governer checking the price of a FOO everywhere in the universe.
But what is really a ProductionOption in your lib , and what is his lifetime , i don't know .
A productionOption need to be prepared for each turn ? ( Tick() )
A ProductionOption lives inside a Factory, and thus will live as long as the factory will live. Where a Factory is "a place to change stuffA to other stuffB", a ProductionOption is the thing which defines what stuffA is and what stuffB is. No preparations are needed for ProductionOptions, other then for them to be housed in factories (and, in order to have actual effect, to be the active ProductionOption). When the tick() happens, the economy updates all bases, the bases update all their factories, the factory updates using its active ProductionOption.
Now i'm totally lost with your design , that don't take the time in parameter also .
In my opinion , produce something takes time , not only raw materials in input .
So a Tick() is able to achieve a production cycle , but not by using the time .
The ticks are essentially discretely modelled time. Inside the tick, all production happen. Essentially, the cycle happens at the tick. You probably want to run a thread which calls eonomy.tick() every few minutes or something along that time.
Finally , when , in a vegastrike loop() , do you set your ProductionOptions , when your tick() occurs , etc ... ?
[/quote]
Beforehand. You set it all up beforehand so the ProductionOptions can be used by the factories by the time tick() comes around. You probably also want to have a separate loop do the ticking, since the timescale of the vegastrike loop() is on the scale of miliseconds, and economy's loop more in the order of magnitude of minutes. I will probably introduce a function in economy which can take care of all the timing and threading details.
Post Reply