[DONE] Spring.LoadMap - Page 3

[DONE] Spring.LoadMap

A place for offers of Bounties and discussion of funded proposals.
8611
XTA Developer
Posts: 242
Joined: 29 Dec 2014, 08:22

Re: [Funded] Spring.LoadMap

Post by 8611 »

spring-98.0.1-338-g8a3014c on win vista
Took mod with SP and replaced Spring.Restart("-s", file) with Spring.Reload (file) (file being a startscript string loaded from txt file)
It worked.
I swapped between missions a few times (load mission A, go to menu, mission B, go to menu, load mission A,...) and after some ten tries spring did hang. I tried again to reproduce and watched memory usage in taskmanager but saw nothing unusual and could not reproduce it.

Before Restart takes effect there is a delay of 2-5 seconds during which spring appears frozen.
(does not update anymore, clicking causes Windows to "white out" spring's window and the title changes to "(Keine Rückmeldung") (=not responding) like Win does for all programs that have supposedly hung up. Like in this screenshot of some browser: http://www.windows-7-forum.net/attachme ... ung_ff.jpg )
It is not really bad but similiar to the previous "flash of desktop" during restart it can look bit strange to players. On plus side the mod now has controll what to draw before this frozen period.

Kloot wrote:Besides the Spring.Reload callout, the branch also adds quit-to-menu functionality which is accessible by:
2) bringing up the quit-box (shift+esc) and choosing "quit to menu", or
The option works but not sure if that is just for testing or supposed to stay.
Many mods still use this menu: For multiplayer there is now an option that players should never click.
Of course mods do not have to use the engine-menu and can do their own Quit-menu without this option but that just makes it even less unnessecary to add the "problematic" option to engine-menu?
For modders it gives no big advantage either and they still have other ways to return to the beach.
Silentwings wrote:From the point of view of single player stuff, the natural next step is...
...a way for players to get into these Lua-menus from the normal lobbies, too.
8611
XTA Developer
Posts: 242
Joined: 29 Dec 2014, 08:22

Re: [Funded] Spring.LoadMap

Post by 8611 »

Kloot wrote:...This example might make it more obvious.
...
The pastebin expired, can re-upload?
If that example was not what I vaguely remember it to be:
What is the minimum startscript to load a game/map, without care for players/teams? (just have gaia)
I was not very successful in trying to"trim down" my startscript of maybe unneeded stuff like [allyteam0], [team0] etc.
abma
Spring Developer
Posts: 3798
Joined: 01 Jun 2009, 00:08

Re: [Funded] Spring.LoadMap

Post by abma »

8611 wrote:What is the minimum startscript to load a game/map, without care for players/teams? (just have gaia)
imo this: http://paste.springfiles.com/view/raw/9ee51cb0

afaik you can't start spring without players/teams, atm they are mandatory. (=feature request to allow it without players/teams)

code-wise there are some asserts which "force" non-empty teams:
https://github.com/spring/spring/blob/d ... er.cpp#L54
8611
XTA Developer
Posts: 242
Joined: 29 Dec 2014, 08:22

Re: [Funded] Spring.LoadMap

Post by 8611 »

thanks...Not real worth a featurerequest when atm it does not hinder anything.
I was just wondering how my startscripts could be shorter.
Playernames seem not strictly required, still works when removing those:
MyPlayerName=me;
Name=me;
(defaults to "UnnamedPlayer")
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: [Funded] Spring.LoadMap

Post by Silentwings »

On that topic - a piece of code to convert a lua table of the same structure into a string containing the startscript wouldn't be a bad thing to have in a minimal example of this.
User avatar
Funkencool
Posts: 542
Joined: 02 Dec 2011, 22:31

Re: [Funded] Spring.LoadMap

Post by Funkencool »

Code: Select all

function ScriptTXT(script)
  local string = '[Game]\n{\n\n'

  -- First write Tables
  for key, value in pairs(script) do
    if type(value) == 'table' then
      string = string..'\t['..key..']\n\t{\n'
      for key, value in pairs(value) do
        string = string..'\t\t'..key..' = '..value..';\n'
      end
      string = string..'\t}\n\n'
    end
  end

  -- Then the rest (purely for aesthetics)
  for key, value in pairs(script) do
    if type(value) ~= 'table' then
      string = string..'\t'..key..' = '..value..';\n'
    end
  end
  string = string..'}'

  -- local txt = io.open('script.txt', 'w+')
  -- txt:write(string)
	-- txt:close()
  return string
end
example script in lua

Code: Select all

	Script = {
		player0  =  {
			isfromdemo = 0,
			name = 'Local',
			rank = 0,
			spectator = 0,
			team = 0,
		},

		team0  =  {
			allyteam = 0,
			rgbcolor = '0.99609375 0.546875 0',
			side = 'CORE',
			teamleader = 0,
		},

		allyteam0  =  {
			numallies = 0,
		},

		gametype = 'Pick A Game',
		hostip = '127.0.0.1',
		hostport = 8452,
		ishost = 1,
		mapname = 'Undecided',
		myplayername = 'Local',
		nohelperais = 0,
		numplayers = 1,
		numusers = 2,
		startpostype = 2,
	}
which could then be ran with

Code: Select all

Spring.Reload(ScriptTXT(Script))
Post Reply

Return to “Bounty Offers”