News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Broken: Experimental Server Listing

Started by DrSuperGood, July 09, 2016, 03:07:24 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

Quote from: An_dz on December 31, 2016, 02:40:56 AM
Why don't you do like GitHub and use the first seven characters of the commit number?

That could work in theory - but does anyone have any idea how programatically to extract these data so as automatically to form part of the version number?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

An_dz

Try changing this in makefile:

REV = $(shell svnversion)

to:

REV = $(shell git rev-parse --short HEAD)


jamespetts

Thank you; that is very helpful. I have changed this in the makefile on devel-new-2, but have yet to try it in practice with WITH_REVISION defined.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

An_dz

I did not test, maybe I got the makefile syntax wrong, but the command is correct.

jamespetts

#39
I am afraid that this does not seem to work, and I cannot find any alternative way of doing this that does not seem extraordinarily complicated. Also, it is not clear how to make this work equally in Visual Studio as with GCC. Have you (or anyone else) any ideas?

Edit: I have made a slight change to the makefile syntax thus:

ifneq ($(WITH_REVISION),)
  REVISION := $(shell git rev-parse --short HEAD)
endif


although I have yet to have a chance to test this.

Edit 2: On testing on the Bridgewater-Brunel server, this still does not appear to work: "REVISION" does not seem to be defined, and so defaults to 12.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

An_dz

#40
Maybe because it's a string and the Simutrans code expects int.

It has worked here:

jamespetts

Quote from: An_dz on January 12, 2017, 05:10:01 PM
Maybe because it's a string and the Simutrans code expects int.

This may be another issue with this, but I do not think that it is the only issue. I have added the following to simversion.h:


#ifndef REVISION
#define REVISION EX_VERSION_MAJOR.EX_VERSION_MINOR
#endif


This has the effect that, if REVISION is not defined, it will be defined as EX_VERSION_MAJOR.EX_VERSION_MINOR. EX_VERSION_MAJOR is currently defined as 12. The number 12 is that which I see.

It would therefore appear that the current behaviour is caused both by the code expecting an int and by REVISION not being defined in any event.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

TurfIt


echo $((16#$(git rev-parse --short HEAD)))



or rewrite the Simutrans code to accept hex.



Quote from: jamespetts on January 12, 2017, 05:18:45 PM
This may be another issue with this, but I do not think that it is the only issue. I have added the following to simversion.h:

#ifndef REVISION
#define REVISION EX_VERSION_MAJOR.EX_VERSION_MINOR
#endif

Integers only, no floating point allowed. Or again rewrite the code.


For MSVC, isn't that why revision.jse exists to create revision.h ?  I expect you need to rewrite that for git instead of svnversion... (and figure out how to get a whatever a .jse is to convert to decimal...)

An_dz

I did not notice that you posted when I edited my post so here it is again:

QuoteIt has worked here:

No changes done except for my suggestion, but that's on Linux and with Standard code. For MSVC the makefile has no effect. Also git has to be accessible from the shell, if you open cmd and can't call git you need to add the executable to the variables.

Edit:
For MSVC you need to change svnversion to git rev-parse --short HEAD in revision.jse

- var svnRevNum = shell.Exec("svnversion");
+ var svnRevNum = shell.Exec("git rev-parse --short HEAD");

TurfIt

And what do you suppose the output of atol("cf5a61b") might be?   How about a big fat zero.
The window title treats REVISION as a string, no problem. The listing server version check treats it as int32 parsed from the string with atol() - hex not allowed.

An_dz

Hey, I have no idea how the server code works, I just wanted to show that my suggestion does set REVISION correctly and that it prints it while James' build is not setting REVISION.

Vladki

Quote from: TurfIt on January 12, 2017, 08:41:42 PM
And what do you suppose the output of atol("cf5a61b") might be?   How about a big fat zero.
The window title treats REVISION as a string, no problem. The listing server version check treats it as int32 parsed from the string with atol() - hex not allowed.

Do you think that the problem is only on the listing server? That simutrans itself is treating the revision as string, and only the listing server is trying to convert it to a number?

jamespetts

Thank you all for that. However, I think that I am still missing important contextual information necessary to understand how to make this work, especially in Visual Studio.

I have replaced the atol commands connected to REVISION with strtol commands, which I understand work with strings representing hexadecimal values. However, I still cannot find any way of causing the revision number to be inserted into Visual Studio (and for REVISION to be defined there). I have modified the .jse file as follows:


//var svnRevNum = shell.Exec("svnversion");
//var rev = svnRevNum.StdOut.ReadAll();
var gitRevNum = shell.Exec("git rev-parse --short HEAD");
var rev = gitRevNum.StdOut.ReadAll();
var filename = "revision.h";
var file;
var file_ts;


and I have included it in the "Resource files" section, but I have no idea how to tell Visual Studio to do anything with it. Google searches tell me little more than .jse is some sort of Javascript file.

I did try to use the "revision from file", but that only defined revision as "Unversioned directory" (and appeared to have no logic for doing anything else, which made that seem rather pointless; indeed, I notice that the whole REVISION_FROM_FILE preprocessor directive and related code has now been excised from Standard).

I still do not understand why REVISION was not defined even in the Linux builds, however.

Any assistance would be much appreciated. Thank you all again for your help so far.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

TurfIt

Quote from: jamespetts on January 12, 2017, 11:12:54 PM
indeed, I notice that the whole REVISION_FROM_FILE preprocessor directive and related code has now been excised from Standard).
huh?

simversion.h

#if defined(REVISION_FROM_FILE)  &&  !defined(REVISION)
// include external generated revision file
#include "revision.h"
#endif

and revision.h gets created by your pre build thingy to call the .jse

simutrans.vcxproj

<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
    <PreBuildEvent>
      <Command>cscript.exe //Nologo revision.jse</Command>
    </PreBuildEvent>
    <ClCompile>
      <PreprocessorDefinitions>NOMINMAX;WIN32_LEAN_AND_MEAN;WINVER=_WIN32_WINNT_WINXP;ZLIB_WINAPI;REVISION_FROM_FILE;LITTLE_ENDIAN;DEBUG=3;COLOUR_DEPTH=16;MULTI_THREAD=2;%(PreprocessorDefinitions)</PreprocessorDefinitions>


I note the pre build is missing from SumutransEX project, and you defined WITH_REVISION rather than REVISION_FROM_FILE.


Might want to update the gui/server_frame to print the hex too:

revision_buf.printf( "%s %u", translator::translate( "Revision:" ), gi.get_game_engine_revision() );



Is the git executable on your path? From the GIT working directory where you invoke make, just run the git rev-parse manually, and you should see the printout.
Did you put WITH_REVISION=1 in config.default?
And no other definitions of REVISION sneaking in?

And of course this has been reverted:
Quote from: jamespetts on January 12, 2017, 02:26:56 PM
Edit: I have made a slight change to the makefile syntax thus:

ifneq ($(WITH_REVISION),)
  REVISION := $(shell git rev-parse --short HEAD)
endif


although I have yet to have a chance to test this.
You don't need a make variable called REVISION, you need a preprocessor REVISION as was properly done by An_dz.

An_dz

The context is that REVISION is a preprocessor directive. With make this can be done with a line in the makefile, on Visual Studio there's no way, so Simutrans uses a hack where it calls a JavaScript that creates a header file that includes this preprocessor directive.

In both cases it will set REVISION with the output of running the command "git rev-parse --short HEAD", which means both will simply run the git executable.

TurfIt has already pointed that the JS is not included in Experimental vcxproj, you just need to add that xml part and VS and the JS will do the rest.

As git is called you need to have a .git directory inside the working tree and git must also be installed and set on your PATH so you can call it globally. On Linux this should be trivial as installing git from any repository already installs it on the main bin dir. On Windows you'll need to include the path to the git executable into PATH. If you are using the GitHub desktop UI you need to navigate to %LocalAppData%\GitHub\PortableGit_random#\cmd then you can add this folder to you PATH.

jamespetts

#50
Thank you both very much - this now seems to work in Visual Studio. I have yet to have time to test it in Linux - I will report back in due course on that.

Edit: This also seems to work - in principle at least - in Linux: thank you again both for your help.

However, I am not able to make it work properly in Linux due to two other issues, one of which is extremely baffling. The way that I have had the server set up is that I simply created a directory for the game, pulled from Github, compiled Simutrans, did the same for the pakset in a suitable subirectory, and ran it from there.

This simple arrangement works well enough in itself, but I need to alter simuconf.tab from the one on Github. This means that, now, whenever I pull from Github, it merges into a new commit and the commit number on the server is therefore not the same as for the release.

I had hoped to get around this by using the separate directories that I had set up for the nightly build to build the executable, and instead of having the actual executable in the running directory, just have a symbolic link to the executable in the nightly build directory. This would then be at the default commit number and thus should not cause problems with merging. I have used a similar system successfully for the paksets: the pakset used by the Bridgewater-Brunel server is now the identical one to that offered as the nightly download, just symbolically linked to the relevant directory.

However, I have had a bizarre problem in building the server executable from the nightly directory: it refuses to build a command line version even when explicitly instructed to do so in the configuration file. I created a new copy of config.default called config.server, and created a /server subdirectory in the ~/build directory. When I run env CFG=server make -j5, it indeed builds a separate copy of simutrans-experimental in the /server subdirectory, but, when I try to run it with no options, it complains of there being no GUI themes, indicating that this is a graphical build. When I try to run a version built as a command line build, it complains instead about a modal dialogue unless it is given command line switches indicating the pakset and a saved game to load.

For reference, my config.server file is as follows:

#
# to compile:
# copy this file to config.default and adjust the settings
#

#BACKEND = allegro
#BACKEND = gdi
#BACKEND = opengl
#BACKEND = sdl
#BACKEND = sdl2
#BACKEND = mixer_sdl
BACKEND = posix

COLOUR_DEPTH = 0
#COLOUR_DEPTH = 16

#OSTYPE = amiga
#OSTYPE = beos
#OSTYPE = cygwin
#OSTYPE = freebsd
#OSTYPE = haiku
OSTYPE = linux
#OSTYPE = mingw
#OSTYPE = mac

#DEBUG = 3    # Level 1-3, higher number means more debug-friendly, see Makefile
OPTIMISE = 3 # Add umpteen optimisation flags
#PROFILE = 1  # Enable profiling
#PROFILE = 2  # Enable profiling with optimisation flags, can be used with `OPTIMISE = 1'

WITH_REVISION = 1 # adds the revision from svn; required for networkgames
# if you do not use SVN, add -DREVISION="1234" to the FLAGS below

#WIN32_CONSOLE = 1 # adds a console for windows debugging

MULTI_THREAD = 1 # Enable multithreading

# Define these as empty strings, if you don't have the respective config program
#ALLEGRO_CONFIG = allegro-config
#PNG_CONFIG     = pkg-config libpng
#SDL_CONFIG     = sdl-config
#SDL2_CONFIG    = sdl2-config

#VERBOSE = 1

# The following useful conditional compilation flags exist
#
# Needed to compile:
# USE_C: no assembler for copying (required for not using GCC on x86)
# SIM_BIG_ENDIAN: MUST be set for PPC/Motorola byte order! (old mac, amiga)
# NO_INTPTR_T: must be set if intptr_t is not available
#
# Changing appearance:
# USE_SOFTPOINTER: emulate mouse pointer (set automatically in Makefile)
#
# Useful for debugging:
# DEBUG_ROUTES: show routing calculation information in minimap
# SHOW_FORE_GRUND: show which objects are drawn as foreground
# DEBUG_FLUSH_BUFFER: show the dirty areas on the screen
# USE_VALGRIND_MEMCHECK: make valgrind-memcheck aware of the memory allocation stuff in dataobj/freelist
# SYSLOG: send debug output to syslog
#
# Following flags alter game engine (and are off for standard builds)
# OTTD_LIKE: Enables half height tiles and crossconnects all industries
# AUTOMATIC_BRIDGES and AUTOMATIC_TUNNELS: will be built also for player
# AUTOJOIN_PUBLIC: stations next to a public stop will be joined to it
# USE_DIFFERENT_WIND: different airplane approach directions over the map
# DESTINATION_CITYCARS: Citycars can have a destination (enabled automatically - cannot be disabled)
#
# In order to use the flags, add a line like this: (-Dxxx)
# FLAGS = -DUSE_C

# Output directories:
#
# use this put objects file in same directory, where the sources are (not recommended):
# ... otherwise defaults to 'build/default')
#
# BUILDDIR = build/command-line-server
#
# use this to specifiy the target directory for the executable:
# .. otherwise defaults to BUILDDIR
#
# MAKEOBJ_PROGDIR = $(shell pwd)
# NETTOOL_PROGDIR = $(shell pwd)
# PROGDIR  = $(shell pwd)

FLAGS = -DNDEBUG -DSYSLOG -fno-delete-null-pointer-checks -fno-strict-aliasing -std=c++11


If anyone has any ideas as to what is wrong, I should be most grateful. Thank you both again very much for your help so far: it is greatly appreciated.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Vladki

I think the revision numbers now work perfectly - I can see the right git short hash in client and server listing.

Felix

The command "CFG=server make -j5" with your config allows me to build a working command line version on Linux.

I can also confirm the reporting of the correct build hash.

jamespetts

#53
Quote from: Felix on January 15, 2017, 03:03:05 AM
The command "CFG=server make -j5" with your config allows me to build a working command line version on Linux.

I can also confirm the reporting of the correct build hash.

That is very curious. Have you (or anyone else) any idea why it does not seem to work for me? Could I be missing something obvious?

Edit: I tried copying the exact same config.default that I used to build the server version into the nightly directory and naming it as config.server. The only change made was to the output directory of the executable. Even after running "make clean", the executable produced is still one that complains at having no GUI themes when launched instead of complaining about a "modal dialogue" as a non-GUI build would.

I am afraid that it is entirely beyond my comprehension how this could be happening.

Edit 2: Having checked, the makefiles are identical.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Isaac Eiland-Hall

I've had troubles with Virtualmin, so long story short, I'd like to drop this server. :|

I do have another server that I'm using as a backup for my main server - is there any way we could have this moved over there? It's a straight Ubuntu installation...

Vladki

If you give me an account there, I'll move the data, and start new instance. Then just change the DNS for server.exp.simutrans.com

jamespetts

Thank you all for maintaining this - it is much appreciated.

Incidentally, interesting new icon, Isaac!
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Isaac Eiland-Hall

Quote from: Vladki on April 13, 2017, 08:52:19 PM
If you give me an account there, I'll move the data, and start new instance. Then just change the DNS for server.exp.simutrans.com

I'll create the account and send you login information. Does it interact with apache in any way? Because I haven't played with the apache setup yet, but I will if I need to. I do hope it's not a pain to move.

Quote from: jamespetts on April 13, 2017, 08:59:50 PM
Thank you all for maintaining this - it is much appreciated.

Incidentally, interesting new icon, Isaac!

Thanks to Google Deep Dream (technically Deep Style for the pic). :)

Vladki

The listing server does not need apache (or any other http server).

However I have used http://server.exp.simutrans.com/ as a place to publish compiled executables and paksets for use with the server games running on the same server. Also I used it to store screenshots and saves for bug hunting. But I can put that stuff elsewhere.

Isaac Eiland-Hall

I do have two servers - cPanel server would be convenient to have a place for shared files, as long as you will forgive having two accounts (one on each server)...

Also, a delay on the setup because I had to leave with my wife to run an errand; I'm back, so I'll get to this in a little bit (account creation) - so it won't be *too* long, just in a little bit :)

Vladki

That was much faster than I expected. Unfortunately I'm away on Easter weekend.

Sent from my ONEPLUS A3003 using Tapatalk


Isaac Eiland-Hall

No worries, I'll keep the server up until it's ready - please no hurry on my account :)

Vladki


jamespetts

#63
Thank you for setting that up. Can I confirm that you would like me to alter the game's code to point to this new listing server instead of the current one?

Also, I notice that the old "Experimental" graphic is still used - could this be changed, I wonder?

Thank you for this.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Vladki

Do you have some logo with extended text? This one was already available with the code.

Please test the new listing server and if it is ok, change the address in code. I hope that this one will stay. However the old address should be redirect to the new one as well.

Sent from my ONEPLUS A3003 using Tapatalk


jamespetts

#65
I am afraid that I do not have a logo with the Extended text; it was not I who made the old "Experimental" logo.

Is the old listing server address already set to redirect to the new one? If so, the new listing server is not working, as the Bridgewater-Brunel server would be announcing every 15 minutes or so, and would have been redirected by the old server to the new one.


Edit: I am a little confused - is the redirection working yet? http://server.exp.simutrans.com:8080/list still has the full listings, but http://list.extended.simutrans.org:8080/list only has what seems to be a spurious test listing. I need to know whether the new server is working before I switch the game code; perhaps an interim redirection would assist in a smooth transition?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Vladki

Dns is in the hands of isaac. I sent him PM that he can change it.

Sent from my ONEPLUS A3003 using Tapatalk


An_dz

Here's an updated logo:


This version is already based on an updated version of the standard logo, it has better ratio and better safe space (20% of the height on all sides)

Download SVG files

The file ending with Path Text has the fonts converted to paths so you don't need the fonts installed on your system, that's the option one should use on the web. The other file requires the fonts, in case you wish to edit the texts, which are:

1) Roadgeek 2005 Series EM - Download
2) Harrison - Download

I want to work on a squared logo as well so to use as the program icon, but I'll probably finish updating the standard versions.

Vladki

Wooow, thank you very much.

Sent from my ONEPLUS A3003 using Tapatalk


jamespetts

Splendid, thank you!

Can I check what the latest position is with the DNS?
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.