Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Switch engine from spring to recoil #32

Open
PicassoCT opened this issue Jun 29, 2023 · 1 comment
Open

Switch engine from spring to recoil #32

PicassoCT opened this issue Jun 29, 2023 · 1 comment
Assignees
Labels
enhancement New feature or request

Comments

@PicassoCT
Copy link
Owner

Migrating from Spring

While Recoil is mostly compatible with Spring 105 some divergences naturally developed over time.

Here we list the most relevant breaking changes and how to fix them when migrating from Spring.
Table of contents

[Callouts](https://beyond-all-reason.github.io/spring/migrating-from-spring/#callouts)
    [Font rendering](https://beyond-all-reason.github.io/spring/migrating-from-spring/#font-rendering)
    [Spring.Marker usage](https://beyond-all-reason.github.io/spring/migrating-from-spring/#springmarker-usage)
    [Spring.GetConfig usage](https://beyond-all-reason.github.io/spring/migrating-from-spring/#springgetconfig-usage)
    [Spring.GetSelectedUnits{Sorted,Counts}](https://beyond-all-reason.github.io/spring/migrating-from-spring/#springgetselectedunitssortedcounts)
[Defs](https://beyond-all-reason.github.io/spring/migrating-from-spring/#defs)
[Camera modifiers](https://beyond-all-reason.github.io/spring/migrating-from-spring/#camera-modifiers)
[Resurrecting units](https://beyond-all-reason.github.io/spring/migrating-from-spring/#resurrecting-units)
[General](https://beyond-all-reason.github.io/spring/migrating-from-spring/#general)

Callouts
Font rendering

Rendering fonts now obeys GL color state. This means that sometimes text will not be the same color as previously. To get back previous behaviour, you might need to add gl.Color in front of gl.Text calls.
Spring.Marker usage

All three Spring.Marker functions (Point, Line, Erase) no longer accept numerical 0 as false for onlyLocal (now follows regular Lua language rules where 0 is true). To get back old behaviour, change 0 to false, e.g.:

-Spring.MarkerAddPoint(x, y, z, text, 0)
+Spring.MarkerAddPoint(x, y, z, text, false)

-Spring.MarkerAddLine(x1, y1, z1, x2, y2, z2, 0, playerId)
+Spring.MarkerAddLine(x1, y1, z1, x2, y2, z2, false, playerId)

-Spring.MarkerErasePosition(x, y, z, noop, 0, playerId)
+Spring.MarkerErasePosition(x, y, z, noop, false, playerId)

Spring.GetConfig usage

Spring.GetConfigInt, Spring.GetConfigFloat and Spring.GetConfigString now accept nil as the second argument (what to return by default if not set). Previously it was treated as 0 (Int and Float) or “” (String). To get back previous behaviour:

local originalGetConfigInt = Spring.GetConfigInt
Spring.GetConfigInt = function(key, def)
return originalGetConfigInt(key, def) or 0
end

Spring.GetSelectedUnits{Sorted,Counts}

The tables returned by Spring.GetSelectedUnitsSorted and Spring.GetSelectedUnitsCounts no longer have an additional n key with corresponding value containining the number of unitdefs.

Instead use the second return value, e.g.:

  • local counts = Spring.GetSelectedUnitsCounts()
  • local unitDefsCount = counts.n
  • counts.n = nil
  • local counts, unitDefsCount = Spring.GetSelectedUnitsCounts()

Defs

Hovercraft and ships brought out of water no longer forced to be upright. To get back previous behaviour, put the upright = true tag in all unit defs whose move def is of the hovercraft or ship type.

Units with useFootPrintCollisionVolume but no collisionVolumeScales set will now use the footprint volume (previously mistakenly used the model’s sphere).

To keep the old hitvolume, set useFootPrintCollisionVolume to false for units with no collisionVolumeScales. Assuming you apply lowerkeys to unit defs, this can also be achieved by putting the following in unit defs post-processing:

for unitDefID, unitDef in pairs(UnitDefs) do
  if not unitDef.collisionvolumescales then
    unitDef.usefootprintcollisionvolume = nil
  end
end

Tree feature defs treetype0 through treetype16 are now provided by the basecontent archive instead of the engine.

No known games ship their own basecontent and they would know what to do if so.

The firestarter weapon tag no longer capped at 10000 in defs (which becomes 100 in Lua WeaponDefs after rescale), now uncapped.

To get back previous behaviour, put the following in weapon defs post-processing:

for weaponDefID, weaponDef in pairs(WeaponDefs) do
if weaponDef.firestarter then
weaponDef.firestarter = math.min(weaponDef.firestarter, 10000)
end
end

It is heavily recommended to replace acceleration and brakeRate with maxAcc and maxDec respectively (possibly in post-processing). While the old spelling still works the way it always did, at some point in the future it will be changed from elmo/frame to elmo/second.

Camera modifiers

The following keyboard modifiers were unhardcoded from engine:

On spring camera: rotating on the x (pitch) or y (yaw) axis with ALT and middle mouse button pressed while moving the cursor.
Resetting camera settings on ALT pressed and mousewheelscroll down.
Rotating on the x axis (pitch) with CTRL pressed and mousewheelscroll.

If games and players do not change engine defaults, no action is needed, however to enable these modifiers as previously the following keybindings must be set:

bind Any+ctrl movetilt // rotates the camera over the x axis on mousewheel move
bind Any+alt movereset // resets camera state to maxzoom/minzoom on mousewheel move, additionally resets tilt on Overhead cam
bind Any+alt moverotate // rotates the camera in x and y axis on mmb move (Spring cam)

Resurrecting units

Resurrecting units no longer overrides their health to 5%. To get back the old behaviour define a gadget with the following callin:

function gadget:UnitCreated(unitID, unitDefID, teamID, builderID)
if builderID and Spring.GetUnitWorkerTask(builderID) == CMD.RESURRECT then
Spring.SetUnitHealth(unitID, Spring.GetUnitHealth(unitID) * 0.05)
end
end

General

Paletted image files are no longer accepted. Convert your images not to be paletted.
The return value from the [UnitUnitCollision](https://beyond-all-reason.github.io/spring/ldoc/modules/LuaHandle.html#UnitUnitCollision) callin is now ignored and there is only one event for each collision. There is no way to get back the old behaviour for now, but if someone needs it it could be arranged.
Removed the following constants:
    Platform.glSupport16bitDepthBuffer
    Platform.glSupport24bitDepthBuffer
    Platform.glSupport32bitDepthBuffer

To get back previous behaviour, replace with

Platform.glSupportDepthBufferBitDepth >= 16 -- or 24, or 32, respectively

Removed LOD rendering (2D unit billboards when zoomed out far), including the /distdraw command and the UnitLodDist springsettings entry
Removed the AdvSky springsetting and the /dynamicsky command, which made clouds move across the sky. You cannot easily get back previous behaviour, though you can probably achieve something similar by rendering moving clouds yourself.
The deprecated Game.allowTeamColors, whose value was always true, has been removed.

Back to top

@PicassoCT PicassoCT added the enhancement New feature or request label Jun 29, 2023
@PicassoCT PicassoCT added this to the Playable on recoil milestone Jun 29, 2023
@PicassoCT PicassoCT self-assigned this Jun 29, 2023
@PicassoCT
Copy link
Owner Author

So, ivand build the more pieces branch and noticed:

  1. In debug mode model loading takes literally 5 minutes - something is not right with the models. Too detailed? Bad format?
  2. math.random() is invalid call, that worked in spring because of a bug, but you have to always specify min & max bounds
  3. Models flicker, maybe you have dup geometry there
  4. Rendering is VERY slow, indicates problems with models

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant