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:

https://trac.wildfiregames.com/wiki/SubmittingPatches

https://trac.wildfiregames.com/wiki/BuildInstructions

https://trac.wildfiregames.com/wiki/BuildInstructionsGettingTheCode

 

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
typo
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...

It is mostly "whatever floats your boat". So if you have worked with git before, go for it. Else I would say use SVN just for the sake of our code being developed there. ^^ That said, both "svn diff" and "git diff" will be able to produce patches.

  • Like 1
Link to comment
Share on other sites

  • 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

https://code.wildfiregames.com/differential/diff/create/

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:

image.png.ae735e7f6a01e39b90f7a5ff087117f8.png

 

;););) 

 

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:

image.png.ae735e7f6a01e39b90f7a5ff087117f8.png

 

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

23 minutes ago, LetswaveaBook said:

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.

Also, why would you even need the concept of a limit to define what a differential equation is? f(x) = dy/dx is a differential equation, and it doesn't use the concept of a limit.

  • Confused 1
Link to comment
Share on other sites

10 minutes ago, alre said:

wait, isn't the derivative of a function defined using limits?

Umm....  no?

From Wikipedia: "In calculus, the differential represents the principal part of the change in a function y = f(x) with respect to changes in the independent variable. The differential dy is defined by dy=f'(x)\,dx, where f'(x) is the derivative of f with respect to x, and dx is an additional real variable (so that dy is a function of x and dx)."

Where's the concept of a limit in that definition?

Edited by m7600
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

11 minutes ago, sarcoma said:

Differential and derivatives are not the same.

Since this conversation was about differentials, I assumed that @alremeant to talk about differentials, not derivatives. And since a differential is just a delta of y, dy, I don't see why you would need the concept of a limit to define what dy is. Nor do I see why you would need the concept of a limit to define a differential equation like f(x) = dy/dx.

Link to comment
Share on other sites

11 minutes ago, nani said:

Calm down, I was just teasing

I know. And I am indeed calm. I just want to get something useful out of this conversation. Everything started with a joke that @Yekaterina made. Then @LetswaveaBook pointed out that her formula doesn't work if the limit doesn't exist. Since her formula starts with dy/dx = "something", that means that we're dealing with a differential equation. And I thought that I'd add something more to @LetswaveaBook's point: you don't even need to use limits in order to define what kind of mathematical object dy/dx = "something" is. That's all. But I'm not a professional mathematician. Maybe you do need to define that object using the notion of a limit, at least if we shift the discussion to the foundations of mathematics. Personally, I don't see how that would be the case. But I could be wrong. So, if you know something that I don't, please share it.

Edited by m7600
Grammar
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.

Guest
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.

 Share

×
×
  • Create New...