1
0
forked from 0ad/0ad
Commit Graph

75 Commits

Author SHA1 Message Date
8747b1c098 SpiderMonkey 38 upgrade: 17/35
JS_GetUint*Array now takes an AutoCheckCannotGC parameter. Based on
patch by leper.
Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1061288

This was SVN commit r18671.
2016-09-02 16:33:10 +00:00
c3710c9632 SpiderMonkey 38 upgrade: 14/35
JS_NewObject has no parent or proto arg anymore, use
JS_NewObjectWithGivenProto instead. Patch by leper.
Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1136906
https://bugzilla.mozilla.org/show_bug.cgi?id=1127443 and
https://bugzilla.mozilla.org/show_bug.cgi?id=1136345

This was SVN commit r18668.
2016-09-02 16:29:21 +00:00
8d15411abf SpiderMonkey 38 upgrade: 13/35
Update JS_NewObject to JS_NewPlainObject, with new parameters. Patch by
leper.
Addresses https://bugzilla.mozilla.org/show_bug.cgi?id=1136906 and
https://bugzilla.mozilla.org/show_bug.cgi?id=1125356

This was SVN commit r18667.
2016-09-02 16:28:17 +00:00
b18cd3254c Test FixedVector{2,3}D script conversions, and test calling functions of the prototypes.
Also ENSURE that the given value identifier is actually present in the
cache instead of creating one if it is not.

This was SVN commit r17603.
2016-01-04 21:41:40 +00:00
89aef0b6eb Cinematic camera core functionality. Patch by Vladislav Belov.
Based on existing code that was still around from an old(not working)
implementation.
Supports basic control from trigger scirpts (queue, start and stop
camera paths) and works in multiplayer.

This was SVN commit r17594.
2016-01-03 12:41:04 +00:00
3760891131 Fix the precedent fix. It turns out the code behaves in much weirder ways than I expected.
This was SVN commit r17255.
2015-11-14 19:03:20 +00:00
8494e36aa8 Revert the logic change in 9da482ead4. This commit removed the checks in UnitMotion against structures, which should have been fine except the short-range pathfinder and the long-range pathfinder are not entirely compatible (check out #3532 for details). This behavior was probably slightly optimized, but it was too clever for its own good in the current state of the pathfinder, might be reintroduced later.
This resulted in ALL "units inside obstructions" issues.

Thanks to elexis for the testing.

Fixes #3532, #3450.
Refs #3538 (still OOSes), #3410 (unitmotion remains buggy for
formations, but this is only aesthethic.)
Probably affects #3471 and #3505, but those are not fixed.

This was SVN commit r17152.
2015-10-31 08:43:31 +00:00
9da482ead4 Based on previous experimental changes, major update to the unit motion.
With this change, units will not check their movement against all
obstructions when moving: terrain and static obstructions are assumed to
be handled by the long-range pathfinder.
However, when static obstructions are changed, the paths have to be
invalidated. In order to minimize the performance impact, units will
check for obstructions when they move after a passability change. If
they collide with something, they will recompute a path that will take
into account the new passability map.

Also includes some code cleanup. This patch should not change
performance a lot: the lower number of checks should give a small
performance improvement while using the message broadcasting system
should hurt it a bit.

Fixes #3376, #3337, #1914.

This was SVN commit r16998.
2015-09-10 18:12:13 +00:00
6581796103 New long-range pathfinder.
Based on Philip's work located at
http://git.wildfiregames.com/gitweb/?p=0ad.git;a=shortlog;h=refs/heads/projects/philip/pathfinder
Includes code by wraitii, sanderd17 and kanetaka.

An updated version of docs/pathfinder.pdf describing the changes in
detail will be committed ASAP.

Running update-workspaces is needed after this change.

Fixes #1756.
Fixes #930, #1259, #2908, #2960, #3097
Refs #1200, #1914, #1942, #2568, #2132, #2563

This was SVN commit r16751.
2015-06-12 18:58:24 +00:00
caf89fa04e Rename ps/Overlay(.h|.cpp) to ps/Shapes(.h|.cpp), fixes a TODO located in graphics/Overlay.h.
The file name did not match the content.

Also little cleanup of some unnecessary includes.

This was SVN commit r16431.
2015-03-15 18:06:32 +00:00
c02a7e1a7b SpiderMonkey 31 upgrade
This upgrade also introduces exact stack rooting (see to the wiki:
JSRootingGuide) and fixes problems with moving GC. This allows us to
enable generational garbage collection (GGC).
Measurements a few months ago have shown a performance improvement of a
non-visual replay of around 13.5%. This probably varies quite a bit, but
it should be somewhere between 5-20%. Memory usage has also been
improved. Check the forum thread for details.

Thanks to everyone from the team who helped with this directly or
indirectly (review, finding and fixing issues, the required C++11
upgrade, the new autobuilder etc.)! Also thanks to the SpiderMonkey
developers who helped on the #jsapi channel or elsewhere!

Fixes #2462, #2415, #2428, #2684, #1374
Refs #2973, #2669

This was SVN commit r16214.
2015-01-24 14:46:52 +00:00
e02d7ad949 Automatically replace %hs/%ls with %s in CLogger format strings.
Everything is char* now, so we don't need to mess around with different
string types.

Done with:

  ag -ls 'LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR)' source | xargs perl
-pi -e'1 while
s/(LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR).*)%[hl]s/$1%s/g'

This was SVN commit r16187.
2015-01-22 20:36:24 +00:00
49e2ecea63 Automatically convert all CLogger format strings from wchar_t* to char*.
Done with:

  ag -ls 'LOG(MESSAGE|MESSAGERENDER|WARNING|ERROR)' source | xargs sed
-i 's/LOG\(MESSAGE\|MESSAGERENDER\|WARNING\|ERROR\)(L/LOG\1(/g'

This was SVN commit r16183.
2015-01-22 20:31:30 +00:00
8e2d514228 Exact stack rooting for CParamNode
Refs #2415
Refs #2462

This was SVN commit r15944.
2014-11-09 11:08:53 +00:00
83aa817f71 Exact stack rooting for simulation message type conversions.
Also replaces some deprecated API (jsval typedef and OBJECT_TO_JSVAL) in
that part of the code.

Refs #2415

This was SVN commit r15624.
2014-08-09 20:02:49 +00:00
169174824f Exact stack rooting for ScriptInterface::ToString.
I had to change a few other functions to take JS::MutableHandleValue
because JS::Stringify takes a JS::MutableHandleValue as input parameter.
That seems a bit strange because it should not change that value.
I assume it has historical reasons.

Refs #2415
Refs #2462

This was SVN commit r15605.
2014-08-03 17:29:49 +00:00
5c07a25ddc More exact stack rooting (CallFunction object).
Changes CallFunction and CallFunctionVoid to use a HandleValue as object
parameter. Also changes some JS serialization/deserialization functions
to only support the JSAPI rooted types (drop support for CScriptVal and
CScriptValRooted there). Some other functions got changed too because
they were closely related.

Refs #2415
Refs #2462

This was SVN commit r15592.
2014-07-31 19:18:40 +00:00
28bdd8540f Quite a lot of stack rooting related changes.
Changes GetProperty, SetProperty and HasProperty and a few other
functions to take handles. The conversions to CScriptVal or
CScriptValRooted at some places should be removed in the future. I've
done that to avoid an even larger patch.

Refs #2415
Refs #2462

This was SVN commit r15568.
2014-07-26 22:33:16 +00:00
52f4cda439 Changes ToJSVal to take JS::MutableHandleValue instead of JS::Value&.
JS::MutableHandleValue is similar to JS::HandleValue, but the whole
JS::Value it points to can be replaced.
This change is needed for support of exact stack rooting and moving GC.
Contains a few other trivial API adjustments and style improvements too.

Refs #2462
Refs #2415

This was SVN commit r15534.
2014-07-14 19:52:35 +00:00
1b5ab8142e Makes custom JS objects compatible with SpiderMonkey ESR31.
In v24 you called JS_InitClass and passed in a definition of JSNative
functions. Later you could call JS_NewObject with this class and the
object would get a prototype with the specified JSNative functions.
In ESR31 you now have to explicitly store the prototype object returned
by JS_InitClass and pass it as prototype argument to JS_NewObject to
achieve the same.
This change modifies our existing ScriptInterface implementation for
custom object types a bit and uses it at places where the JSAPI was used
directly before.

Refs #2462

This was SVN commit r15524.
2014-07-13 15:31:48 +00:00
db9c20e0a9 Changes FromJSVal to take a JS::HandleValue instead of JS::Value.
JS::HandleValue is basically a wrapper around a JS::Value that is safe
for exact stack rooting and moving GC.
I've tried to keep this changeset rather small and isolated and
therefore create additional JS::Rooted<T> values at some places where
the function should eventually directly take a JS::Handle<T>.
The functions "CallFunction" and "CallFunctionVoid" put their arguments
inside a JS::AutoValueVector because this will be passed directly to
"CallFunction_" with ESR31.

Refs #2462
Refs #2415

This was SVN commit r15517.
2014-07-12 19:08:39 +00:00
2174eaaeee Add a VisibilityChanged message sent by the range manager whenever an entity changes visibility for any player.
This will be necessary for hiding buildings/trees/etc in fog-of-war, and
may be useful for AIs and for UnitAI.

Refs #599.

This was SVN commit r15508.
2014-07-10 20:51:39 +00:00
db39d742f0 Fix units falling off the edge of the world.
I guess changes to the map loading sequence caused the TerrainChanged
message to be sent before the map was switched from square to circular
instead of after. The pathfinder didn't notice the switch, so it
continued treating the map as if it were square, allowing units to walk
into the permanent map-corner SOD and vanish, and allowing territories
to expand into the SOD.

Tell the pathfinder explicitly when the map shape changes, so it can
discard its cached data correctly.

This was SVN commit r15277.
2014-06-03 22:35:40 +00:00
1882f28504 New unit renderer.
Instead of each CCmpVisualActor rendering itself individually, collect
all the units in a single CCmpUnitRenderer. This avoids the overhead of
doing Interpolate/RenderSubmit calls every frame for every object in the
world. It also allows more efficient culling.

CCmpUnitRenderer knows the positions of each object at the start and end
of each turn, and computes the bounding sphere of the object along that
path. That allows quick culling without recomputing the precise
interpolated transform every frame. (In the future it could be improved
much more.)

Clarify and clean up the sending of PositionChanged messages, and add
new InterpolatedPositionChanged.

Remove the forceFloating parameter from GetInterpolatedTransform, since
it doesn't fit the new design. Replace it with a (non-synchronised) flag
in CCmpPosition.

Move construction progress from CCmpVisualActor to CCmpPosition, so that
it consistently affects all position/transform computation.

Refs #2337.

This was SVN commit r15265.
2014-06-01 18:24:50 +00:00
d117d96d22 Simplify component deserialization.
Deserialize SYSTEM_ENTITY before any other entities. This makes it safe
for Deserialize() methods to access system components (mirroring how
Init() can already access system components).

Add a Deserialized message, sent after all entities have been
deserialized, to help with some other sequencing problems.

This was SVN commit r15264.
2014-06-01 18:14:09 +00:00
41f62cd3ff Add WaterChanged message, for things that need to be recomputed when the water height changes.
This was SVN commit r15226.
2014-05-26 13:44:24 +00:00
e9e05f4efc Second (main) commit for the SpiderMonkey upgrade.
This commit contains all the required changes to our source files and
build scripts (hopefully).
A next commit will remove the old stuff of SpiderMonkey 1.8.5.

Spcial thanks to:
 - H4writer who helped a lot mainly with the performance issues we
had/have, but also with other problems or questions.
 - Leper for the review.
 - Historic_bruno for implementing the build scripts on Mac OS X and
testing on the Mac.
 - The people from the #jsapi channel and from
mozilla.dev.tech.js-engine who answered a lot of questions and helped
solving problems.
 - All the other people who helped

Refs #1886
Fixes #2442
Fixes #2416

This was SVN commit r14877.
2014-03-28 20:26:32 +00:00
19965ce37a Fix missing territory decay when moving out of territory without changing the actual territory. Add possibility to check movement over territory boders in the JS simulation part. Based on patch by niektb
This was SVN commit r14754.
2014-02-16 15:22:11 +00:00
bab3a08643 Fixes a crash introduced in fd187f466f by ensuring that the CScriptValRooted values are destroyed before calling JS_DestroyContext.
I've tested the performance on Combat Demo (Huge) again with the code
from #2394.
It's very close but probably a little bit lower (hard to tell because
it's so close).

Closes #2408
Refs #2394

This was SVN commit r14705.
2014-01-30 13:21:36 +00:00
fd187f466f Add vector prototype to vector-like return values from C++ to JS. Fixes #2394.
This was SVN commit r14645.
2014-01-23 11:32:08 +00:00
c1e86161b5 AIs now properly receive aura and technology updates. Fixes #2377, Refs #1520 . Consequently reimplement repairing for AIs.
Fix a few style issues and a bug with the gatherer count.
Still need to fix the entity.js file to handle properly some things as
this uses raw templates values.
Cache the AIinterface in AIProxy.js, please report if this works
properly.

This was SVN commit r14588.
2014-01-16 20:32:44 +00:00
5f5eedc513 Rename technology related files, methods and messages so their names represent the shared data flow between technologies and auras (and maybe future components). Implement the C++ part of auras through these generalised files. Fixes #2154
This was SVN commit r14001.
2013-10-15 10:05:08 +00:00
754e794f9b Implements attack notifications based on patch by madmax and zoot, fixes #1719
This was SVN commit r13951.
2013-10-06 04:49:38 +00:00
e72b603cce Implements Vision/Range tech modification
This was SVN commit r12707.
2012-09-24 22:27:32 +00:00
vts
6b50a660b9 Added elapsed real time (as opposed to elapsed simulation time) to MT_Interpolate messages. Fixes leftover TODO from #824. Refs #824.
This was SVN commit r11944.
2012-06-06 19:37:03 +00:00
fc47098743 Implements TerritoryInfluence/Radius tech modification. Adds C++ interface for TechnologyManager. Renames its message to MT_TechnologyModification defined in TypeList.h. Refs #1357.
This was SVN commit r11711.
2012-05-01 22:44:27 +00:00
fc27a5c0ea More FreeBSD build fixes.
Fixes some warnings about files that don't end with newline.

This was SVN commit r10991.
2012-01-30 06:21:11 +00:00
2878102ed7 Avoid some code duplication
This was SVN commit r10583.
2011-11-23 21:26:14 +00:00
1c081135ad Adds territory map to AI GameState, based on patch from quantumstate. Fixes #969.
Updates testbot and Jubot to support basic build restrictions.

This was SVN commit r10408.
2011-10-16 02:55:58 +00:00
308cb26dd4 # Health decay for buildings not in a civ center's territory.
This was SVN commit r10034.
2011-08-18 20:28:53 +00:00
609f1643d5 Fix -Wconversion warnings in simulation code.
Cast to smaller integer types explicitly.
Generally avoid platform-dependent types (size_t) in simulation code.
Use float versions of math.h functions, not double.

This was SVN commit r10017.
2011-08-16 11:18:32 +00:00
9430de3d85 Support TerrainChanged messages in scripts, and report use of unsupported messages
This was SVN commit r9950.
2011-08-01 21:01:06 +00:00
2f0bd8d8b0 Upgrade to SpiderMonkey 1.8.5 (fixes #734)
This was SVN commit r9852.
2011-07-16 23:24:14 +00:00
4663ac0fe7 split debug_assert into ENSURE and ASSERT as discussed in a previous meeting.
the old debug_assert always ran and tested the expression, which slows
down release builds. wrapping them in #ifndef NDEBUG is clumsy. the new
ASSERT behaves like assert and ENSURE like the old debug_assert. Let's
change any time-critical but not-super-important ENSURE to ASSERT to
speed up release builds. (already done in bits.h and unique_range.h)

This was SVN commit r9362.
2011-04-30 13:01:45 +00:00
f618605477 Changes default random map sizes.
Tweaks random map resources.
Adds support for circular maps to rmgen library.
Various fixes in map generator.
On Miletus map, change player 2 civ, as Romans are not fully implemented
(fixes #758)

This was SVN commit r9104.
2011-03-23 08:12:04 +00:00
6f9da85d9f Improve performance of full state hash computation, by skipping script components that are known to have no data.
Switch to much quicker (and less comprehensive) per-turn hashing in
multiplayer games.

This was SVN commit r9036.
2011-03-05 22:30:32 +00:00
e608d9269a Load entity templates for the AI via the progressive loader.
Display message while loading the map list for the setup screen.

This was SVN commit r9019.
2011-03-05 01:56:59 +00:00
b8925fbbc9 # Support AI construction of buildings.
Pass terrain passability data to AI scripts.
Expand pathfinder passability data to 16 bits per tile, to allow more
classes.
Support 16-bit ints in serializer.
Partially support JS typed arrays.
Allow foundations to be placed on top of units (fixes #499).
Stop farms and fishes blocking movement (fixes #534).
Add obstruction flags to allow finer control over what they block.
Associate entity IDs with obstruction shapes, to allow finding colliding
entities.
Support moving to the edge of a target entity with inactive obstruction.
Support foundation entities in AI.
Support playing as non-hele civs.

This was SVN commit r8899.
2011-02-10 16:06:28 +00:00
c3b734775b Simplify component interface: remove explicit context parameter, use GetSimContext() instead.
This was SVN commit r8867.
2011-01-16 14:08:38 +00:00
f39f279132 Add AI script code to provide a cleaner API around the engine interface.
Handle AIProxy entirely through scripts.
Support structured clones of script values.
Improve performance.
Support multiple script contexts sharing a runtime.
Use a separate context per AI player.

This was SVN commit r8866.
2011-01-15 23:35:20 +00:00