New starting position options

New starting position options

Discuss the source code and development of Spring Engine in general from a technical point of view. Patches go here too.

Moderator: Moderators

MajBoredom
Posts: 17
Joined: 24 Nov 2013, 09:14

New starting position options

Post by MajBoredom »

Hello spring community,

I am again soliciting feedback for a new feature. The feature would improve the Team FFA game type by providing a new StartPosType (rts/Game/GameSetup.h:64). To be specific, this is when there are several allyteams (>=3) with >=2 teams (usually 1 player per team) on each allyteam. Popular maps for this game mode in BA/TA are mearth, dworld, throne, etc. However, these games usually end with complaining and comments about "free wins".

At the moment the players have the choice between a small number of starting position options for team ffa, none of which provides a satisfying game. Starting with fixed positions only works for a small number of maps, and players need to ensure that their team number aligns with the map. Starting with random positions usually gives one or two teams a strong tactical advantage by placing them close together. Any teams that are far apart in this setting are usually eliminated quickly. Starting with "Choose in game" (see also "Choose before game") usually means that the players have to manually set starting boxes for each allyteam. This is a real chore since most maps do not have an arbirtrary number of easy symmetries and the boxes need to be specified numerically to the autohost software (SPADS).

What I propose is a new StartPosType, "StartPos_RandomTeamFFA". This mode would randomize the starting positions, and then perform a shuffling step to ensure that players on the same team start closer together, and players on opposite teams start further apart. The algorithm for shuffling the players is not very complicated (search for a shuffle path that leads to minimization of a heuristic value representing how "spread out" each team is, and how "close together" opposing teams are). The algorithm isn't perfect -- there are some combinations of map and team configurations that won't permit good starting positions to be made. Also, the distance between players is sometimes not a good heuristic of shortest path length between them. That said, this simple algorithm should provide good starting positions for most popular ffa maps that have more or less evenly distributed start spots and fairly direct paths between these spots.

This option would let people set up team ffa games more quickly without the need for boxes. It is also consistent with the "random start" characteristic of FFA that rewards scouting, surveillance, and careful expansion planning.

Comments and flames welcome.
User avatar
knorke
Posts: 7971
Joined: 22 Feb 2006, 01:02

Re: New starting position options

Post by knorke »

The idea is good but think it would be better to do it via the game's lua.
For BA it could be added here:
http://imolarpg.dyndns.org/trac/balates ... _spawn.lua
Otherwise all the lobbies would have to be adapted , too.
Also more flexible if you want to tweak the algorithm, releasing new BA version is easier than waiting for new engine version.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: New starting position options

Post by smoth »

Wrong forum. This belongs in game development
User avatar
AntiAllez
Posts: 105
Joined: 06 Mar 2012, 18:22

Re: New starting position options

Post by AntiAllez »

every new lua is a bad idea. so many games f****d by ugly lua-coding. this makes the list of banned lua by manual only longer

User was warned for this post; felony 1, felony2.

--FLOZi
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: New starting position options

Post by Silentwings »

We've thought of this before & there was once an effort to do it within the engine too - but we never found a "the algorithm" (as you call it) which was reliable enough for us to include. Algorithm welcome!

Code: Select all

 it should look like this 
MajBoredom
Posts: 17
Joined: 24 Nov 2013, 09:14

Re: New starting position options

Post by MajBoredom »

My thoughts:

The existing start position handlers are done as part of the engine, and are c++. It seems a bit awkward to extend a single start position mode in Lua, or to make it mod-specific. Second, this is truly an option for all mods. On the surface, Lua code may seem to be more maintainable, but it can add significant complexity to the code base if start position modes are spread out into both c++ and Lua.

The algorithm I'm thinking of is just based on a heuristic -- there are worst cases where you can't actually position the players together. So, it wouldn't be perfect. Still since it is an option, players may still get some enjoyment out of using it.

Knorke raises a good point about needing to modify the lobby clients. I think that this can be done in a minimalistic way by adding a new battle setting to spads' "startpostype" variable which would allow users to use the new feature. Certain theme servers (ie: FFA) may also wish to create a TeamFFA preset, but that is the purview of the respective admins. I would likely target the 97.0 for the feature and try to see if I can contribute spads support to coincide with the release. (I don't know when this will be, though.)
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: New starting position options

Post by smoth »

Doing it in c++ is forcing it on all spring projects keep your game specific requests in Lua please!
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: New starting position options

Post by Silentwings »

In this case it wouldn't force it all on projects because the "startpoint placing" modes seen by the lobby are currently controlled by the engine - he could simply add a new one without changing what already exists. It would only work for lobbies that updated to use it, though. But I'd have no objection to it gadget form, of course.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: New starting position options

Post by FLOZi »

I would say go all game side lua but the situation is massively complicated by drawing start-boxes, so some engine/lobby support is required.

It would be nice to allow white/black listing of start position methods via engineoptions.lua or such. e.g. MCL should only ever be played with fixed / random positions, never boxes.
klapmongool
Posts: 843
Joined: 13 Aug 2007, 13:19

Re: New starting position options

Post by klapmongool »

Hmm, nixa made (something like) this. It was used for a while and very popular.
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: New starting position options

Post by Silentwings »

@klap, got a link?
klapmongool
Posts: 843
Joined: 13 Aug 2007, 13:19

Re: New starting position options

Post by klapmongool »

No, I have no idea if it was ever released or if the code was shared with anyone. It was for the 2v2v2 FFA server if that rings a bell for anyone.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: New starting position options

Post by smoth »

Flozi a proper Lua implementation would allow you to easily ignore the start boxes. Adding MORE bloat like this to the engine is bad
dansan
Server Owner & Developer
Posts: 1203
Joined: 29 May 2010, 23:40

Re: New starting position options

Post by dansan »

klapmongool wrote:No, I have no idea if it was ever released or if the code was shared with anyone. It was for the 2v2v2 FFA server if that rings a bell for anyone.
I remember that. I wonder if that was actually a patch to spads.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6240
Joined: 29 Apr 2005, 01:14

Re: New starting position options

Post by FLOZi »

smoth wrote:Flozi a proper Lua implementation would allow you to easily ignore the start boxes. Adding MORE bloat like this to the engine is bad
And how do you set lua start boxes before the game launches?

Some stuff does have to have lobby and ergo engine functionality!
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: New starting position options

Post by smoth »

Either we read the ones being sent via startscript(I presume this is where they are communicated) or we demand that be added so we can!
User avatar
PicassoCT
Journeywar Developer & Mapper
Posts: 10450
Joined: 24 Jan 2006, 21:12

Re: New starting position options

Post by PicassoCT »

The problem is to break it down into strategic value of a start position.

I think you need to estimate
- closeness of ressources
- space to build,
- narrow entrances to defend
- routes to allys and enemys
- and expanding options (really difficult too estimate)

You evaluate those all, weight them, and find the config that sucks the least..
klapmongool
Posts: 843
Joined: 13 Aug 2007, 13:19

Re: New starting position options

Post by klapmongool »

PicassoCT wrote:The problem is to break it down into strategic value of a start position.

I think you need to estimate
- closeness of ressources
- space to build,
- narrow entrances to defend
- routes to allys and enemys
- and expanding options (really difficult too estimate)

You evaluate those all, weight them, and find the config that sucks the least..
Nixa just made settings per map. He showed me once how he did it and it was very easy.

The ABC 2v2v2 FFA, I remember now!
User avatar
Silentwings
Posts: 3720
Joined: 25 Oct 2008, 00:23

Re: New starting position options

Post by Silentwings »

Hmm; I would rather have a good algorithm than have settings per map, an algorithm is much easier to maintain. But I agree with Pica.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: New starting position options

Post by smoth »

Why not both?
Post Reply

Return to “Engine”