DosTips.com

A Forum all about DOS Batch
It is currently 20 Aug 2017 22:47

All times are UTC-06:00




Post new topic  Reply to topic  [ 62 posts ]  Go to page Previous 1 2 3 4 5 Next
Author Message
PostPosted: 07 Sep 2015 08:25 
Online
Expert

Joined: 12 Feb 2011 21:02
Posts: 1882
Location: United States (east coast)
einstein1969 wrote:
@dbenham
I have tested the version 0.4.0 - 0.4.1 and 0.41a and all is ok.
Than I only modify a line of code for probe multitasking on my monocore.
from:
Code: Select all
  set /a proc=NUMBER_OF_PROCESSORS, childCnt=proc-1

to:
Code: Select all
  set /a proc=NUMBER_OF_PROCESSORS+1, childCnt=proc-1

In this case the result are not always the same. The output is only half some time. Some time is full and sometime is half good and half not. :(

EDIT: it would seem that the job variable is not set for the main thread and/or use the child/parallel definition.

I cannot reproduce that behavior :?

It runs flawlessly when my total number of active processes never exceeds the number of processors.

But I do see something odd about 1 frame out of 25 if I set NUMBER_OF_PROCESSORS to 5, even though my machine has 4 cores. Every now and then, it seems like one of the render files is not updated with new data, so the output is garbled. I modified the code to investigate a bit - instead of deleting the job file, I move it to original_name.sav. I can then look at each job and render file in another window as soon as I see a problem. It is really odd, because the job must have run - all the job files with .sav extension have the correct data and the last modified timestamps of each job and render file indicate each job was run and each render file created at the correct time (I looked at timestamps with millisecond precision).

I am totally stumped as to what could be happening :? :evil:


Dave Benham


Top
   
PostPosted: 14 Sep 2015 07:57 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
Hi Dave,

There are many days I'm trying to debug 0.4.1 but I had to stop. I was going crazy ... :shock:


Top
   
PostPosted: 11 Oct 2015 18:56 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
Hi to all,

I have developed a new engine. This is developed on monocore. I have used a grid accelerated tecnology (for reference search SEADS by Fujimoto)

I have a little optimized with "Empty Environment", use variable name with prefix $ for faster SET and some other minor trick.

The new engine return the SIDE of ray intersection with wall, usefull for simulate a light/shadow

This is the full demo without antialiasing that calcultate the average FPS.

On my monocore @2.00Ghz is near 3 FPS 8)

Code: Select all
:::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal Enabledelayedexpansion

mode 69,58

set "preserve= TMP COMSPEC NUMBER_OF_PROCESSORS preserve "
for /f "delims==" %%v in ('set') do if "!preserve: %%v =!" equ "!preserve!" set "%%v="
set "preserve="

set  MAP[0]=11111111111111111
set  MAP[1]=11212121212121211
set  MAP[2]=12.............21
set  MAP[3]=11.............11
set  MAP[4]=12.............21
set  MAP[5]=11.............11
set  MAP[6]=12.............21
set  MAP[7]=11.............11
set  MAP[8]=12.............21
set  MAP[9]=11.............11
set MAP[10]=12.............21
set MAP[11]=11.............11
set MAP[12]=12.............21
set MAP[13]=11.............11
set MAP[14]=12121212121212121
set MAP[15]=11111111111111111

For /L %%N in (1,1,50) do set S=_!S!

For /L %%N in (1,1,50) do set S0=Û!S0!
For /L %%N in (1,1,50) do set S0s=°!S0s!

For /L %%N in (1,1,50) do set S1=²!S1!
For /L %%N in (1,1,50) do set S1s= !S1s!

set /a "PI=(35500000/113+5)/10, PI_div_2=(35500000/113/2+5)/10, PIx2=2*PI, PI32=PI+PI_div_2"
set "SIN=(a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000)"

set /A Playerx=5*10000, PlayerY=4*10000, _Angle=0

rem for average FPS
set "t1=!time: =0!"

for /l %%. in (1,1,100) do (

  rem for instant FPS
  rem set "t1=!time: =0!"

  call :raycast

  rem for average FPS
  for /F "tokens=1-8 delims=:.," %%a in ("!t1!:!time: =0!") do set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31)&8640000, FPS=100000/(a*10/%%.), a=a*10/%%."
  Title Raycast Dos Batch  -  Time Elapsed:!a!ms - FPS: !FPS:~0,-2!.!FPS:~-2! [%%.]

  rem for instant FPS
  rem for /F "tokens=1-8 delims=:.," %%a in ("!t1!:!time: =0!") do set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31)&8640000, FPS=10000/a"
  rem Title Raycast Dos Batch  -  Time Elapsed:!a!0ms - FPS: !FPS:~0,-2!.!FPS:~-2! [%%.]

  set a=&set FPS=

  set /A _Angle+=15
)

pause
exit /B

:::::::::::::::::::::::::::::::::::::::::::::::::
:raycast

setlocal

( %= Empty Environment =%
  for %%v in (_Angle Number_of_Processors PI PI32 PIx2 PI_div_2 SIN
              prompt comspec PlayerX PlayerY) do set "%%v="

  set "transposedLine="
  set/A  from=%_angle%-32, to=%_angle%+32
  For /L %%Z in (!from!,1,!to!) do (
 
      %= Sin_Cos inline for speed =%
      (
        setlocal
        set "p1=%%Z * %PI% / 180"
        set "p4=((%%Z-%_angle%) * %PI% / 180)"

        set /a "a=(!p1!) %% %PIx2%, b=(a>>31|1)*a"
        if !b! gtr %PI32% (
          set /a "a=a-(a>>31|1)*%PIx2%, c=%SIN%"
        ) else if !b! gtr %PI_div_2% (
          set /a "a=(a>>31|1)*%PI%-a, c=%SIN%"
        ) else set /a "c=%SIN%"

        set /a "a=(%PI_div_2%-!p1!) %% %PIx2%, b=(a>>31|1)*a"
        if !b! gtr %PI32% (
          set /a "a=a-(a>>31|1)*%PIx2%, d=%SIN%"
        ) else if !b! gtr %PI_div_2% (
          set /a "a=(a>>31|1)*%PI%-a, d=%SIN%"
        ) else set /a "d=%SIN%"

        set /a "a=(%PI_div_2%-!p4!) %% %PIx2%, b=(a>>31|1)*a"
        if !b! gtr %PI32% (
          set /a "a=a-(a>>31|1)*%PIx2%, b=%SIN%"
        ) else if !b! gtr %PI_div_2% (
          set /a "a=(a>>31|1)*%PI%-a, b=%SIN%"
        ) else set /a "b=%SIN%"

        for /F "tokens=1,2,3" %%A in ("!c! !d! !b!") do (
          endlocal
          set /a "aStepY=%%A, aStepX=%%B, corr=%%C"
        )
      )

    set /A $X=%PlayerX%/10000, $Y=%PlayerY%/10000

    if !aStepX! equ 0 (
      set /A $tx=Dtx=100000000, $SX=0
    ) else if !aStepX! lss 0 (
                  set /A "$tx=($X*10000-PlayerX)/aStepX, Dtx=-10000*10000/aStepX, $SX=-1"
           ) else set /A "$tx=(($X+1)*10000-PlayerX)/aStepX, Dtx=10000*10000/aStepX, $SX=1"
    if !aStepY! equ 0 (
      set /A $ty=Dty=100000000, $SY=0
    ) else if !aStepY! lss 0 (
                  set /A "$ty=($Y*10000-PlayerY)/aStepY, Dty=-10000*10000/aStepY, $SY=-1"
           ) else set /A "$ty=(($Y+1)*10000-PlayerY)/aStepY, Dty=10000*10000/aStepY, $SY=1"

    set "$B=" & set /A "Distance=21*10000"

    for /L %%. in (1,1,3) do if not defined $B for /L %%? in (1,1,7) do if not defined $B (

        if !$tx! lss !$ty! (
           set /A $tx+=Dtx, $X+=$SX
           for /f "tokens=1,2" %%X in ("!$X! !$Y!") do if "!Map[%%Y]:~%%X,1!" geq "1" (
             set /A Distance=$tx-Dtx, Side=0, $B=!Map[%%Y]:~%%X,1!
           )
        ) else (
           set /A $ty+=Dty, $Y+=$SY
           for /f "tokens=1,2" %%X in ("!$X! !$Y!") do if "!Map[%%Y]:~%%X,1!" geq "1" (
             set /A Distance=$ty-Dty, Side=1, $B=!Map[%%Y]:~%%X,1!
           )
        )
    )
    if not defined $B for /f "tokens=1,2" %%X in ("!$X! !$Y!") do set "B$=!Map[%%Y]:~%%X,1!"

    set /A "Height=25*10000/( (Distance/2*corr/10000) + 1234 ), Len=Height*2, st=(50-len)/2+1"

    %= 2D-clipping =%
    if !st! lss 1 (set st=1) else if !st! gtr 50 set st=50

    for /f "tokens=1,2" %%X in ("!st! !len!") do if !$B! equ 1 (
        if !side! equ 0 (
           set "N%%Z=-!S:~0,%%X!+!S0:~0,%%Y!+!S:~0,%%X!-"
        ) else set "N%%Z=-!S:~0,%%X!+!S0s:~0,%%Y!+!S:~0,%%X!-"
    ) else (
        if !side! equ 0 (
           set "N%%Z=-!S:~0,%%X!+!S1:~0,%%Y!+!S:~0,%%X!-"
        ) else set "N%%Z=-!S:~0,%%X!+!S1s:~0,%%Y!+!S:~0,%%X!-"
    )
    set "transposedLine=!transposedLine!^!N%%Z:~%%n,1^!"
  )

)

cls & for /L %%n in (0, 1, 55) do echo( ^|%transposedLine%^|

endlocal

exit /b


Einstein1969

EDIT: I haven't used files for transpose. This is monocore version.


Top
   
PostPosted: 16 Oct 2015 11:33 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
I have released a new version @ viewtopic.php?f=3&t=5824.

Use a version of DDA algorithm.

Code: Select all
:: ver. 0.5.0   2015-10-16 einstein1969
::  - Implemented DDA algorithm. Improved speed (~40%)
::  - Moved output of execution time on title + Add FPS counter.
::  - "H" now display Help.
::  - "M" now toggle the view of the Map
::  - Improved speed by clear the environment + other optimization (~10-15% on reference system)
::  - Map more readable.
::  - revert "reduce CALLs and rearrange code to minimize CALL distance" for easy code develop. TODO later. See ver. 0.4.x
::  - revert fast 3D clipping


Unfortunately I can not test the multithreaded part not having a multicore. :(
Anyone can test the new version? Thanks

einstein1969


Top
   
PostPosted: 17 Oct 2015 12:04 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
I have released a new version @ viewtopic.php?f=3&t=5824.

Use a modified version of choice emulator by aGerman, token in the thread of dbenham's BATCHSNAKE.

Code: Select all
:: ver. 0.5.1   2015-10-17 einstein1969
::  - Add choice emulation. Now it should run on XP platform. Not tested.
::


I have an idea to increase performance. Like jeb, that not repeat testing on MAP, it is possible
use "ray coherence" tips used in realtime raytrace. We test about "X" time the same Map path.
It is possible avoid this and use a linear interpolation. The goal of 15 FPS is not far.

einstein1969


Top
   
PostPosted: 18 Oct 2015 04:49 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
This is the new engine with a lot of optimizations:

Code: Select all
- Precompute all: Sin, Cos, Correction for fisheye errors.
- Use % trick for variables
- Use "For" instead of "For /F" with LF for separate elements. The For is faster!
- Minimize SET
- Keep the environment near empty, with use temporary files for storage.
- Optimize for rotate Rigth. But rotate left is similar. Moving is faster than rotate.


We pass from about 350 ms to about 210ms (~ 5 FPS) on average 8)

Any idea for other optimizations?

Code: Select all
:::::::::::::::::::::::::::::::::::::::::::::::::
@echo off
setlocal Enabledelayedexpansion

mode 69,58

set "preserve= TMP COMSPEC NUMBER_OF_PROCESSORS preserve "
for /f "delims==" %%v in ('set') do if "!preserve: %%v =!" equ "!preserve!" set "%%v="
set "preserve="

set   MAP[1]=1212121212...2121212121..........
set   MAP[2]=2........1...1........2..121.....
set   MAP[3]=1........21212....121.1.2...2....
set   MAP[4]=1........21212....121.1.2...2....
set   MAP[5]=1.............................2..
set   MAP[6]=2....1...12121................2..
set   MAP[7]=1....2...2...2.....1..11.....1...
set   MAP[8]=1....1...1...1....12..2.2...2....
set   MAP[9]=2....2...2...2........1..121.....
set  MAP[10]=1212212121...1212121212..........

set /A Playerx=4*10000, PlayerY=5*10000, Angle=0

For /L %%N in (1,1,50) do set S=_!S!

For /L %%N in (1,1,50) do set S0=Û!S0!
For /L %%N in (1,1,50) do set S0s=°!S0s!

For /L %%N in (1,1,50) do set S1=²!S1!
For /L %%N in (1,1,50) do set S1s= !S1s!

setlocal
For /L %%N in (-32,1,32) do (
        set /A I=%%N+32
        call :sin_cos "%%N * PI / 180" sin cos
        set "_C=!_C! !cos!"
        set "TL=!TL!^!N!I!:~%%n,1^!"
)
echo !_C!>corr.txt
echo !TL!>TL.txt
endlocal

set/A  from=%angle%-32, to=%angle%+32
For /L %%Z in (%from%,1,%to%) do (
  call :sin_cos "%%Z * PI / 180" aStepY aStepX
  set "SC=!SC!"!aStepY! !aStepX!" "
)

rem for average FPS
set "t1=!time: =0!"

for /l %%. in (1,1,360) do (

  rem for instant FPS
  rem set "t1=!time: =0!"

  call :raycast

  rem for average FPS
  for /F "tokens=1-8 delims=:.," %%a in ("!t1!:!time: =0!") do set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31)&8640000, FPS=100000/(a*10/%%.), a=a*10/%%."
  Title Raycast Dos Batch  -  Time Elapsed:!a!ms - FPS: !FPS:~0,-2!.!FPS:~-2! [%%.]

  rem for instant FPS
  rem for /F "tokens=1-8 delims=:.," %%a in ("!t1!:!time: =0!") do set /a "a=(((1%%e-1%%a)*60)+1%%f-1%%b)*6000+1%%g%%h-1%%c%%d, a+=(a>>31)&8640000, FPS=10000/a"
  rem Title Raycast Dos Batch  -  Time Elapsed:!a!0ms - FPS: !FPS:~0,-2!.!FPS:~-2! [%%.]

  set a=&set FPS=

  rem set /A Playerx=4*10000, PlayerY=5*10000+%%.*500

  set /A Angle+=1, to+=1

  call :sin_cos "!to! * PI / 180" aStepY aStepX
  set "SC=!SC!"!aStepY! !aStepX!" "
  set SC=!SC:*"=!
  set SC=!SC:*"=!

  rem pause>nul
)

pause
exit /B

rem 3.10 - 4.38 - 4.46 - 4.48 - 4.65 - 4.76 - 4.87 - 4.80 - 4.78/4.83 - 4.90
rem set /A aStepY=%%u, aStepX=%%v
rem for %%C in (!Z!) do set corr=!_C:~%%C,5!

:::::::::::::::::::::::::::::::::::::::::::::::::
:raycast
setlocal
for /f usebackq^ delims^=^ eol^= %%A in (corr.txt) do set "_C=%%A"

( %= Empty Environment =%
  for %%v in (Angle Number_of_Processors prompt comspec PlayerX
              PlayerY from to SC aStepY aStepX) do set "%%v="

  set Z=0
  For %%Z in (%SC%) do for /f "tokens=1,2" %%u in (%%Z) do (


    if %%v gtr 0 (
      set /A "$X=%PlayerX%/10000, $tx=(($X+1)*10000-%PlayerX%)*10000/%%v, Dtx=10000*10000/%%v, $SX=1"
    ) else if %%v lss 0 (
                  set /A "$X=%PlayerX%/10000, $tx=($X*10000-%PlayerX%)*10000/%%v, Dtx=-10000*10000/%%v, $SX=-1"
           ) else set /A $X=%PlayerX%/10000, $tx=Dtx=100000000, $SX=0

    if %%u gtr 0 (
      set /A "$Y=%PlayerY%/10000, $ty=(($Y+1)*10000-%PlayerY%)*10000/%%u, Dty=10000*10000/%%u, $SY=1, Distance=21*10000"
    ) else if %%u lss 0 (
                  set /A "$Y=%PlayerY%/10000, $ty=($Y*10000-%PlayerY%)*10000/%%u, Dty=-10000*10000/%%u, $SY=-1, Distance=21*10000"
           ) else set /A $Y=%PlayerY%/10000, $ty=Dty=100000000, $SY=0, Distance=21*10000

    set "$B="
    for /L %%£ in (1,1,3) do if not defined $B for /L %%? in (1,1,7) do if not defined $B (
        if !$tx! lss !$ty! (
           set /A $tx+=Dtx, $X+=$SX
           for /f "tokens=1,2" %%X in ("!$X! !$Y!") do if "!Map[%%Y]:~%%X,1!" geq "1" (
             set /A Distance=$tx-Dtx, Side=0, $B=!Map[%%Y]:~%%X,1!
           )
        ) else (
           set /A $ty+=Dty, $Y+=$SY
           for /f "tokens=1,2" %%X in ("!$X! !$Y!") do if "!Map[%%Y]:~%%X,1!" geq "1" (
             set /A Distance=$ty-Dty, Side=1, $B=!Map[%%Y]:~%%X,1!
           )
        )
    )
    for %%C in (!Z!) do set /A "Len=(25*10000/( (Distance/2*!_C:~%%C,5!/10000) + 1234 ))*2, st=(50-len)/2+1, I=Z/5, Z+=5"
    %= 2D-clipping =%
    if !st! lss 1 (set st=1) else if !st! gtr 50 set st=50
    for /f "tokens=1,2" %%X in ("!st! !len!") do if !$B! equ 1 (
        if !side! equ 0 (
              set "N!I!=-!S:~0,%%X!+!S0:~0,%%Y!+!S:~0,%%X!-"
        ) else set "N!I!=-!S:~0,%%X!+!S0s:~0,%%Y!+!S:~0,%%X!-"
    ) else (
        if !side! equ 0 (
           set "N!I!=-!S:~0,%%X!+!S1:~0,%%Y!+!S:~0,%%X!-"
        ) else set "N!I!=-!S:~0,%%X!+!S1s:~0,%%Y!+!S:~0,%%X!-"
    )
  )
)
set /P "TL="<TL.txt
cls & for /L %%n in (0, 1, 55) do echo( ^|%TL%^|
endlocal
exit /b

:Sin_Cos rad*10000 return_var*10000     rem RADIANT
  setlocal

  set /a "PI=(35500000/113+5)/10, PI_div_2=(35500000/113/2+5)/10, PIx2=2*PI, PI32=PI+PI_div_2"
  set "SIN=(a-a*a/1920*a/312500+a*a/1920*a/15625*a/15625*a/2560000-a*a/1875*a/15360*a/15625*a/15625*a/16000*a/44800000)"

    set /a "a=(%~1) %% %PIx2%, b=(a>>31|1)*a"
    if !b! gtr %PI32% (set /a "a=a-(a>>31|1)*%PIx2%, c=%SIN%")  else (
      if !b! gtr %PI_div_2% (set /a "a=(a>>31|1)*%PI%-a, c=%SIN%") else set /a "c=%SIN%")

    set /a "a=(%PI_div_2%-%~1) %% %PIx2%, b=(a>>31|1)*a"
    if !b! gtr %PI32% (set /a "a=a-(a>>31|1)*%PIx2%, a=%SIN%")  else (
      if !b! gtr %PI_div_2% (set /a "a=(a>>31|1)*%PI%-a, a=%SIN%") else set /a "a=%SIN%")
 
  (endlocal & set "%2=%c%" & set "%3=%a%")
goto :eof


einstein1969


Top
   
PostPosted: 18 Oct 2015 06:08 
Offline

Joined: 24 Jun 2013 17:10
Posts: 437
Location: Bulgaria
Giving ideas without implementing them is easy :lol:


May be :sin_cos is compact enough to be macro instead of function.Though jeb reworked that function and he didn't made it macro so may be it's not possible :?:


And the script is big enough so may be using anonymous function instead of :raycast will give you small performance improvement - at least this one is pretty easy for check.


Top
   
PostPosted: 18 Oct 2015 12:09 
Offline
Expert

Joined: 30 Aug 2007 08:05
Posts: 825
Location: Germany, Bochum
npocmaka_ wrote:
May be :sin_cos is compact enough to be macro instead of function.Though jeb reworked that function and he didn't made it macro so may be it's not possible :?:

It's possible, but I remeber that there was no or only a very small gain.

But it's possible to use a lookup table, but even then it's necessary to use only a few variables, else the array search is nearly as long as the calculation (Yes I tested it).

npocmaka_ wrote:
And the script is big enough so may be using anonymous function instead of :raycast will give you small performance improvement - at least this one is pretty easy for check.

As the raycast function is only called onced, it's nearly unimportant.


Top
   
PostPosted: 19 Oct 2015 08:39 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
@npocmaka_
I have fast read the thread on anonymous function call and haven't understund how they work. maybe i should testing a lot...
I have seen that the gain is small for the time the raycast code get (200ms about on last algorithm optimized). For now i agree with jeb.

I the future when the time is small starch could come in handy !!

I have changed the algoritmh 3 times. Now it's necessary again for bypass this limits.
Now the algorithm go for each ray and traverse the map until found a wall. Then return the distance.

The idea is to use rays packets. Will start with two ray that are not near and look if go trought same destination.
If the destination is the same than the ray in the middle go in the same destination too. And with linear interpolation we calculate the distance.

This is the new algorithm, written in pseudocode (and recursive for now... anonymous function call might be usefull?)

Code: Select all
subroutine raypacket (from, to) 
   if from = to then .....????
   else
      destination1=raytraverse(from)
      destination2=raytraverse(to)
     if destination1=destination2 then
           if from - to > 1 then linear_interpolate_distance(from,to)
     else begin
         raypacket (from, from+(to-from)/2)
         raypachet (from+(to-from)/2+1, to)
     end
   end



I need help for implement new idea that allows us to get more speed gain. :evil:

einstein1969


Last edited by einstein1969 on 20 Oct 2015 04:02, edited 1 time in total.

Top
   
PostPosted: 20 Oct 2015 03:16 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
Hi,

this is the table of improvements updated:

Improvements:
Code: Select all
vers.  frame time  FPS     Columns
0.01a   14890ms    0.06      40
0.01b    5870ms    0.17      40     swap out environment
0.1.0    3610ms    0.27      64     new algorithm (ray marching like, fixed step)
0.2.0    3840ms    0.26      64
0.3.0     750ms    1.33      64     jeb trick fast ray traversal
0.4.1     720ms    1.38*     64     dbenham multithread on monocore @2.00Ghz , 2-3 times faster on quad-core machine (4-5 frames per second)
0.5.1     400ms    2.50**    64     dda algorithm on monocore @2.00Ghz
0.5.x     200ms    5.00**    64     optimized dda algorithm on monocore @2.00Ghz (on demo code) - forecast in 0.5.x
0.6.x    <100ms  >10.00**  64/128   forecast

*: on monocore. In multicore the FPS are more
**: multicore performance data not avaible N/D :(

Future implementations: my idea :idea:
- double width (pass from 64 to 128 Columns) for small size fonts (increase only resolution on Y, same performance/FPS)
- choice default chars (Fast antialising, Normal, Wireframe, etc.)
- Asyncronous input (like BatchSnake)
- Aacini's Event-driven multi-thread scheme for Batch files 8)
- Use velocity(amount/seconds) for movements/rotations. This allows you to move at the same speed of platforms with different performances and singlecore/multicore
- Double Y resolutions. Choice chars for double resolution on Y (a little slower)
- what else? ...

What would you like to see in the new release?
Anyone can do tests on multicore and return the results performance here?

einstein1969


Top
   
PostPosted: 12 Dec 2015 13:15 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
dbenham wrote:
einstein1969 wrote:
@dbenham
I have tested the version 0.4.0 - 0.4.1 and 0.41a and all is ok.
Than I only modify a line of code for probe multitasking on my monocore.
from:
Code: Select all
  set /a proc=NUMBER_OF_PROCESSORS, childCnt=proc-1

to:
Code: Select all
  set /a proc=NUMBER_OF_PROCESSORS+1, childCnt=proc-1

In this case the result are not always the same. The output is only half some time. Some time is full and sometime is half good and half not. :(

EDIT: it would seem that the job variable is not set for the main thread and/or use the child/parallel definition.

I cannot reproduce that behavior :?

It runs flawlessly when my total number of active processes never exceeds the number of processors.

But I do see something odd about 1 frame out of 25 if I set NUMBER_OF_PROCESSORS to 5, even though my machine has 4 cores. Every now and then, it seems like one of the render files is not updated with new data, so the output is garbled. I modified the code to investigate a bit - instead of deleting the job file, I move it to original_name.sav. I can then look at each job and render file in another window as soon as I see a problem. It is really odd, because the job must have run - all the job files with .sav extension have the correct data and the last modified timestamps of each job and render file indicate each job was run and each render file created at the correct time (I looked at timestamps with millisecond precision).

I am totally stumped as to what could be happening :? :evil:


Dave Benham


Hi Dave,

I have an idea for found the concurrency problem if there are more processes than processor.

It's possible use a LOCK/MUTEX when there is access to shared resource or atomic instruction like RENAME etc. ?

I think that in this mode it's possible understund where is the real problem.

Francesco


Top
   
PostPosted: 11 Feb 2016 12:55 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
Hi to all,

I have found a new algorithm for speedup.

This new algorithm is based on DE (Distance estimator functions) and is knowed how "Sphere tracing" or "Raymarch distance fileds"

With this algorithm is possible:
- speedup,
- use true antialiasing
- go from 2.5D versus full 3D. (with step size!!!) 8)

Links:
- http://computergraphics.stackexchange.com/questions/161/what-is-ray-marching-is-sphere-tracing-the-same-thing
- http://graphics.cs.illinois.edu/papers/zeno
- http://9bitscience.blogspot.it/2013/07/raymarching-distance-fields_14.html
- http://blog.hvidtfeldts.net/index.php/2011/06/distance-estimated-3d-fractals-part-i/

I thinks that the previus idea of "raypackect" is possible with this new algorithm. Multithreading also. ;)

stay tuned!

Francesco Poscetti aka Einstein1969


Top
   
PostPosted: 22 Mar 2016 04:47 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
I have released version 0.5.2 @ viewtopic.php?f=3&t=5824.

Use the Aacini method for calculus the functions SIN(X). See Definition and use of arithmetic "functions" in Batch files
The code is small and is about 20% faster than previous, less than 300ms on monocore @2Ghz! 3.33FPS

Code: Select all
::
:: ver. 0.5.2   2016-03-22 einstein1969
::  - Add new SIN(x) calculus using Aacini method. Improved speed (~20%)
::


Can anyone test on multicore? Give me the FPS, Ghz and Number of core of PC

einstein1969


Top
   
PostPosted: 22 Mar 2016 12:13 
Offline
Expert

Joined: 10 Feb 2012 02:20
Posts: 6033
I had a look einstein and it's an impressive bit of coding to get the graphics so nice.

EDIT: On a subsequent play I also noticed some odd wall reflections that appeared when I turned a little in a passage, where no wall seemed to be earlier. It was a bit tricky to navigate, but the curves and lines are nice work.

FPS: 6.25

CPU is Intel(R) Core(TM) i7-2600 CPU @ 3.40GHz
No of Cores: 4 (2 logical cores per physical)

https://www.cpubenchmark.net/cpu.php?cp ... 40+3.40GHz





Old post:

I am unsure where the FPS is shown though - this was the status on the screen.
The titlebar had text but the right side was not visible due to the narrower window.

PlayerX/Y:279512/86802 OldplayerX/Y:269513/86802
FAST: Angle:0 GridX/Y:27/8 StepX/Y=9999/0 wait=0



Top
   
PostPosted: 22 Mar 2016 15:13 
Offline
Expert

Joined: 15 Jun 2012 13:16
Posts: 740
Location: Italy, Rome
Thanks foxidrive.

You can change this line of code for visualize on screen the FPS:
Code: Select all
    echo !method!: Angle:!Angle! GridX/Y:!gridx!/!gridy! StepX/Y=!StepX!/!StepY! wait=!wait!%space%

with this:
Code: Select all
    echo !method!: Angle:!Angle! GridX/Y:!gridx!/!gridy! StepX/Y=!StepX!/!StepY! wait=!wait! FPS:!FPS:~0,-2!.!FPS:~-2! 


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 62 posts ]  Go to page Previous 1 2 3 4 5 Next

All times are UTC-06:00


Who is online

Users browsing this forum: admin, Bing [Bot] and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Limited