Jump to content

How to make a differential.

Recommended Posts

A few weeks ago when discussing auras, Stan´ meantioned https://github.com/0ad/0ad/blob/e68daa4f75488bdbdd9b0f58979430ce5e9898fc/source/simulation2/components/CCmpRangeManager.cpp

I noticed that file contained a lot of divisions, mainly of the form Z / LOS_TILE_SIZE

Now my suggestion is to introduce a dummy variable INV_LOS_TILE_SIZE=1/ LOS_TILE_SIZE. That way, we can do a multiplication instead of a division and the lines would read

Z*INV_LOS_TILE_SIZE, which is cheaper if you need to do a lot of divisions. Wraitii suggested that I would make a differential to test if it makes the game faster.

I made an account on phabricator to try to make a differential, but I did not know how to make a differential. Can anyone explain which steps would be needed to be done to publish such a simple differential? I do unsterstand some C# code, but I don´t know what steps are next. Do I have to download/upload something or can it be done in the browser?


Link to comment
Share on other sites

Those pages are very helpful:





So basically:

Download TortoiseSVN.

Clone the official repo.

Change some code.

Test if it works.

Save the change as a patch.

Upload it manually to phabricator.


You can also use command line to do that but it's more complicated to setup.


And I'm sure @Stan` or other people at the irc channel will help you get ready to make a patch (although a good time may be after the feature freeze and important bug fixing that is done after that :))


Edited by maroder
Link to comment
Share on other sites

  • 3 weeks later...

Isn't Arcanist the tool needed in addition?

On 05/03/2021 at 4:22 PM, Stan` said:


I'm not sure what shaders you are refering to but maybe you could help @vladislavbelov work on the graphics engine.

Yes we have started developping A25: https://trac.wildfiregames.com/wiki/Alpha25

You can use either the git or the svn version note that the git version is only updated once per day.

We use Phabricator to handle contributions, so you'll need to install arcanist, or generate diffs by hand https://trac.wildfiregames.com/wiki/Phabricator  https://trac.wildfiregames.com/wiki/SubmittingPatches

Are there good hints how to install Arcanist under Windows 10 that you could recommend? Thank you! :)

Link to comment
Share on other sites

  • 3 months later...
  • 2 weeks later...

If I did not miss a step, this is what I did:

Downloaded the code.

Found the kushite architecture tech and changed its cost.

inserted in the command line

$ cd ./0ad

$ svn diff --diff-cmd diff -x "-U 99999" > changes.patch

That created a document changes.patch in the 0ad folder, which I uploaded to


and now we have https://code.wildfiregames.com/D4310

  • Like 2
Link to comment
Share on other sites

On 06/06/2021 at 5:53 PM, LetswaveaBook said:

I did not know how to make a differential

if y = f(x) then your differential of f with respect to x is:





Alt: open a terminal in your 0ad source code folder and type 'git diff' or 'svn diff' then it will show you the differential code. Then ctrl+shift+v to copy it and then paste it into the 'raw diff' textbox of the differential creator. 

  • Haha 2
Link to comment
Share on other sites

18 hours ago, Yekaterina said:

if y = f(x) then your differential of f with respect to x is:



That does not work. First of all, that formula does not make sense if the limit does not exist. Secondly, you don't make the differential by that way, it is calculated that way. The differential of a function exists or does not, regardless of whether you can calculate it. So in that sense you don't make the differential.

  • Thanks 1
Link to comment
Share on other sites

Differential and derivatives are not the same. The (exact) differential of f(x1,x2,...) is

df = f_x1 dx1 + f_x2 dx2 + ...

where f_xi is the partial derivative of f with respect to x_i

The first law of thermodynamics is expressed in exact and inexact differentials

dU = delta W + delta Q

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...