Java-Gaming.org Hi !
Featured games (85)
games approved by the League of Dukes
Games in Showcase (611)
Games in Android Showcase (172)
games submitted by our members
Games in WIP (657)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
   Home   Help   Search   Login   Register   
  Show Posts
Pages: [1] 2 3 ... 7
1  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-29 10:14:19
Sorry but it so funny ^^

In parallel universe:
Lot's of first today for me:
- Got my first job. At a resteraunt
- Burned a restaurant
2  Discussions / General Discussions / Re: Windows 10 on: 2015-08-27 19:36:03
Why update if you can try it on virtual machines =)
http://dev.modern.ie/tools/vms/
3  Games Center / WIP games, tools & toy projects / Re: Pezna Story Engine - A tool for creating non-linear, complex stories for games. on: 2015-08-27 19:23:14
Personaly i like projects like this.
even if I do not use them for self,
I like ideas that stand behind them, how they evolve and what they have become )
4  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-26 20:19:18
Hm is Steam Use some sort Price adjustment like Amazon?
5  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-25 14:57:00
Wahey, looks like my game "Miners" is going to be on Indie Insights!
Congrats!

Don't let your dreams be dreams! *flex*
+
6  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-23 21:14:55
@theagentd, how many cells and how many entities are being handled?
Someone try CCD Rigbody physical base collision?
http://www.stencyl.com/help/view/continuous-collision-detection/
https://developer.nvidia.com/sites/default/files/akamai/physx/Manual/Advanced.html
its sound stupid, but it looks like: you can use it to process collision on 100+ frames forward.
(in close system without player external input)

up:if take close dimension system (game closed room or lvl)
and calculate objects moves by frame ticks (not physical PC time)
then in theory (i think ^^) you can calculate collision forwards
+ if use some sort cached "time_frame positions, time_frame velocity"
it will be fast to calculate any external collisions changes that created by player input.
but maybe its all my madness =)
7  Game Development / Newbie & Debugging Questions / Re: Eclipse, multiple classpaths? on: 2015-08-21 14:50:41
I have Eclipse project A which loads resources found in its project root.
Have same issues long time ago)
Only Conclusion I find – not load res in project A from other place then project A  Wink
For all others res use external folder “../../res” links good same in eclipse and after project was built.

p.s personaly i now using abs Path - easy to debug
1  
2  
3  
4  
String workingDir = System.getProperty("user.dir");
String IO_Path_ABS = workingDir + "\\";

File file = new File(IO_Path_ABS + str);


but long time ago i use this)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
   protected File get_File_In_Jar_In(String path){
      URL ur = SomeClass.class.getClassLoader().getResource(path);  
      File file = null;
      try{
         file = new File(ur.toURI());
      }catch (URISyntaxException e){e.printStackTrace();}  
      return file;
   }

   protected File get_File_In_Folder_In(String path){
      File file = new File(path);  
      return file;
   }
8  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-21 14:27:05
Finally add multi file linking support to my parser Wink

it's looks messy but I am so happy so want to share it ^^
(long names - for debug,
+ need set uniq colors: now working on parsing, fix visual later - so many work to do =) )



parse this to java with file import )
1  
T_Class_Fun_Call_Prim_0.int_1 = T_Class_Fun_Call_Prim_0.int_1 + int_1 + 1;

1  
T_Class_Fun_Call_Prim_0.B_Extra_int_1 = T_Class_Fun_Call_Prim_0.B_Extra_int_1 + T_Class_Fun_Call_Prim_1.B_Extra_int_1 + 1;



9  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-18 20:27:10
Why would I leave buggy code in my project when I already know exactly what is wrong

It may be bug in the situation how you want use it.
But in old code it can work perfect
(I see many such examples)
Some ppl say “If it ain't broke, don't fix it” XD
And this may be current situation.

I don't think telling my boss it was too much work to refactor some clearly buggy code would really blow over well.

Its not about work on fixing 1-2 bugs
Its about broke all project fixing 1 bug on half+ month deadline ^^
(This is time management point of view)

Simple ask boss what you should do with bug, don't try fix all own silently
and it will be ok (probably Wink)
10  Games Center / Android Showcase / Re: [FREE] Binary Tree Jump on: 2015-08-18 20:13:03
Nice Smiley
Imho fixes:
-need render lines to next ground when they off screen - because now they start render when pass half screen and instantly pop up from nowhere.
-maybe add some power ups to pick them up - stars, funny mosters etc

don't need to draw them fully from scratch - use google find funny make someting same add colors)

take parts google images and make one own ^^,
its sound weird but come on: you do it for fun, not for making billions dollars on someone art
or harm them
(even with intellectual property law you always have option to find conclusion with they owner)
11  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-18 19:51:20
Fixed a major bug that the last developer who worked on this project for me left behind (he left).
Thats normal )
We all left bugs in code: sometimes because we hurry, and some time because we simple don't see bug ther )
Don't take current bug like someting unnatural - when working with someone code you will see many bugs
(or first you think it was bug, fix it and later undestand that code was work right and you broke it Wink )

Edit: This solution does not seem to work in all cases.
I not recommend fix old working function if shi working not like you want, and work fine in old code.
Simple add new function hasNext() and use it,
If you change old you must refractor and double check all old code that use this old  bug” function.
An this is a lot of work.

(When you work on own project you have time for this and know wher you and how use old Fun,
Bun working on company with third party code you simple don’t have time for this,
same as for quality control after refactoring.)

This is how big project create thousand newer used function and then call them legacy XD
12  Game Development / Game Play & Game Design / Re: Article on pay to win games in Japan on: 2015-08-17 21:52:43
Southpark S18E06 "Freemium Isn't Free." This episode is hilarious.
It’s really epic,
And story about dopamine.

(same have dopamine problems Sad but some another way,
lose pleasure from many things like playing games all week long or watch all seasons some fun TV show:
like it was before - when I was teenager, but maybe its natural… in any case its not fun =)
hm.. maybe problems because it's less self rewarding than before)
13  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-08-08 04:24:07
I have my apartment I need to pay for so...
Simple interesting: What is middle price for apartment in you’r region?
14  Discussions / General Discussions / Re: Windows 10 on: 2015-08-07 13:34:02
Still on Xp  Cool and don't want change it XD

All the metro animations seem to suffer from "lag spikes" ...

Imho: The Trend of last years fears me:
from year to year we have more buggy and laggy software’s each year
- and now even big corporations create so low quality products.

What be next.
in 50 years we will have 100 core cpu that run new tetris with lags 10- FPS
because you don’t have top pc with 378 cores ?  persecutioncomplex  
15  Game Development / Newbie & Debugging Questions / Re: Interfaces and Method call- Handling by the JVM on: 2015-08-05 14:43:54
Try not use it because think its buggy - by logic)
But not remember to test it ^^
so test
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
   static public void main(String[] args){
      a a1 = new a();
      a a2 = new a();
      b b1 = new b();
      b b2 = new b();
      a b1_a = b1;
      a b2_a = b2;
     
      f(a1, a2);//a, a 0 0
      f(b1, b2);//b, b 1 1
      f(b1_a, b2_a);//a, a 1 1
      f(b1_a, b2);//a, a 1 1
      f(b1_a, a2);//a, a 1 1
   }
   
   static public void f(a a1, a a2){
      System.out.println("a, a");
      System.out.println(a1.i);
      System.out.println(a1.i);
   }
   
   static public void f(b a1, b a2){
      System.out.println("b, b");
      System.out.println(a1.i);
      System.out.println(a1.i);
   }
   
   static class a{int i = 0;}
   
   static class b extends a{
      public b(){i = 1;}
   }

I should then write hundreds of calls to the method areFriends(Person, Person) for each Person implementation. So the best way would probably be as you suggested with the instanceof.
or like this =)
1  
2  
areFriends_Person(...)
areFriends_Student(...)

Quote from: leSpace
And how does the jvm handle that and know which method to call ?
as i remember methods parsed to byte code
so when java code parsed - parser take variable in function type
and find for it needed function,
so: no dynamic auto variable top class check)
16  Games Center / Showcase / Re: jfCraft on: 2015-08-01 06:11:18
About source code)
quick watch it ^^
nice code - but have some not critical arhitecture errors

many code dublicated

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
//LightingEarth.java
         if (z < 31 && chunk.getSunLight(x,y,z+1) < 14) {
            lvl = getBlock(x, y, z+1).absorbLight(15);
            lvl = getBlock2(x, y, z+1).absorbLight(lvl);
            if (lvl > 0) {
              if (setSunLight(x,y,z+1, lvl)) {
                add(SUN_CAST, x,y,z+1); }
              }
          }
          if (z > -15 && chunk.getSunLight(x,y,z-1) < 14) {
            lvl = getBlock(x, y, z-1).absorbLight(15);
            lvl = getBlock2(x, y, z-1).absorbLight(lvl);
            if (lvl > 0) {
              if (setSunLight(x,y,z-1, lvl)) {
                add(SUN_CAST, x,y,z-1);
              }
            }
..
//can be optimized
//dublicates create small errors
function_absorbLight(x, y, z, lvlPrev){
            int lvl = getBlock(x, y, z).absorbLight(lvlPrev);
            lvl = getBlock2(x, y, z).absorbLight(lvl);
            if (lvl > 0) {
              if (setSunLight(x,y,z, lvl)) {
                add(SUN_CAST, x,y,z); }
              }
            return lvl;
}


also will be good use more static var
1  
2  
3  
4  
5  
6  
  for(int y=0;y<255;y++) {
      for(int x=0;x<16;x++)
//
ChunkSizeY = 256;
ChunkSizeX = 16;
//good for refactoring


need window manager but not critical )
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
//CraftingMenu.java
//Hard for refactoring
 public void mousePressed(int x, int y, int button) {
...
 bx = 59;
    by = 33;
    for(byte a=0;a<9;a++) {
      if (a != 0 && a % 3 == 0) {
        bx = 59;
        by += 36;
      }
      if (x >= bx && x <= bx+36 && y >= by && y <= by+36) {
        Static.client.clickCraftlInput(a, button == 1);
      }
      bx += 36;
    }
    //check craft output
    bx = 239;
    by = 60;
    if (x >= bx && x <= bx+36 && y >= by && y <= by+36) {
      Static.client.clickCraftOutput(button == 1);
    }
}
...

BUT- this all NOT important: its works and THAT WHAT Important.
So make game popular and after that can start fixing code ^^

p.s http://javaforce.sourceforge.net/ Man that Insane XD, so many cool tools

i have question - becouse i can't find answer((
do you have any solutions for:
java - packet(TCP or UDP) tunneling for dedicated server
from users pc Internet without 3d party broadcast server?
(dirrect user connects through internet with gray IP's)
(NAT traversal, UDP Hole Punching etc)

up: hm i think i finally find possible solution: SSH tunneling =)
(without UDP cheats ^^)
{try it later - in unknown future}
17  Games Center / Showcase / Re: jfCraft on: 2015-08-01 05:05:02
Mega cool XD

P.s Imho - if you want make own game mechanics (because ppl don’t like playing in 99% clones)
Make all crazy ideas (same as item recipe) that can you imagine – and it will be almost sure fun,

Simple keep it logical – that only rule for madness ideas: like wooden pickaxe =)

Example:
Red blocks have magnets gravity,
blue spawn monsters,
for harvesting purple ypu resive EXP,
from 10 yellow blocks you can craft laser crystal for rifle to DMG yellow monsters Type)
Unleash your imagination and it will be funny gameplay Wink

But in any case is cool what you'r already done =)

up: You even have server and plugin system XDDD

Quote from: pquiring
I've done other clones of MC using web based interfaces but they all failed.
This time I wrote it in Java like the original and making much better progress.
it's sad Sad
agane IMHO:
Clones need big marketing or mega cool new gameplay (or Visual) that original don't have or they not be popular ((
this is wrong forum for marketing promo ;(
i believe minecraft promos marketing start from tigsource users + Lego games forum, but i not sure its some sort of magic )

IMO advice make minecraft FPS - they popular and fun )
(left 4 dead with missions etc)
creative mode minecraft not popular and fun anymore
it was fun when it realized because you don't need 3dMX or any other hard to noobs software to create something
+ you can play with it in game
++(minecraft looks when realized - like dungeon keeper first person + dwarf fortress, Lego World
And ppl mind own dreams about this)

But now - no one cares about creative mode, they already play in original minecraft)
Exceptions kids – they can play all day long in minecraft, dota, LoL, etc
without no reason – because they simple like it),
and taking part of there auditory to minecraft clone as same hard, as take dota's funs to dota clone =)

up2:
Exeption2 -
Big free MMO - make minecraft server on 200+ online and it will be popular )
(if you can handle kids IMHOs - "we want this, we see it in minecraft" ^^)
18  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-31 04:42:04
It actually works pretty well.
Nice ^^
I want make someting same =)
http://pixologic.com/zbrush/features/shadowbox/
http://docs.pixologic.com/user-guide/3d-modeling/modeling-basics/creating-meshes/shadowbox/

but still don't sure how to improve it
+ my drawing skills is so low so i can't properly see result from visual side, and easy to draw - not as programmer)
19  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-30 09:02:44
Start making separate file – AST File Header.
If some one say me before that for parsing code I need separate Header AST
–I say to him: why? I don’t need it Wink
And now I need it - because no one wants reparse every text file in big project when you run IDE =)
20  Discussions / Miscellaneous Topics / Re: What I did today on: 2015-07-28 10:03:43
Parse this:
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
DFG T_Class_Fun_Call_Prim_0{&

   Data B_Extra{~
      b4 int_0
      Static b4 int_1
   ~}
   
   Fun Class_Call{@
      Class fun_Class_Call(^ b4 a, ..b #= 3 ^){$
         b4 aa = 1;
         a = a + 1;
         int_0 = aa - a;
         int_1 = aa - a;
         return
      $}
   @}
&}


to this =)

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
package AS.Parse.Pars_Basick;
import AS.Class_Inst;
import AS.Class_Type;
import AS.Fun_Data_Call_CL;
import AS.Fun_Data_Use;
import AS.Fun_Type;

public class T_Class_Fun_Call_Prim_0 extends Class_Inst{
   static protected T_Class_Fun_Call_Prim_0_Type Cl_S = new T_Class_Fun_Call_Prim_0_Type();

   public int int_0;
   static public int int_1;

   @Override
   public T_Class_Fun_Call_Prim_0_Type get_Class(){return Cl_S;}

   static protected class fun_Class_Call extends Fun_Type{
      public fun_Class_Call(Class_Type CL, int pos, int line){super(CL, pos, line);}
      @Override
      protected Fun_Data_Call_CL cr_Data_Call(){return new fun_Class_Call_C(this);}
      @Override
      protected Fun_Data_Use cr_Data_Use(){return new fun_Class_Call_U();}

      static public class fun_Class_Call_U extends Fun_Data_Use{
         int a;
         int b;

         @Override
         public void Set_Def(){
            b = 3;
         }
      }

      static public class fun_Class_Call_C extends Fun_Data_Call_CL<T_Class_Fun_Call_Prim_0, fun_Class_Call_U>{

         int aa;

         public fun_Class_Call_C(Fun_Type type){super(type);}
         @Override
         public void F(T_Class_Fun_Call_Prim_0 c_S, fun_Class_Call_U D_U){
            aa = 1;
            D_U.a = D_U.a + 1;
            c_S.int_0 = aa - D_U.a;
            T_Class_Fun_Call_Prim_0.int_1 = aa - D_U.a;
            return;
         }
      }
   }

   static protected class T_Class_Fun_Call_Prim_0_Type extends Class_Type{
      public T_Class_Fun_Call_Prim_0_Type(){super("T_Class_Fun_Call_Prim_0");}
      public fun_Class_Call fun_Class_Call = new fun_Class_Call(this, 15, 9);
   }
}

What i am doing?
I don't know  Clueless
It's madness... XD
(its only like 10-20% from something fully worked Sad )

(strange brackets is for visual and later IDE formater will be adding them self)
21  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-28 01:09:15
Adding lerping
add lerp to code, don't know why)
on 12 bits %f give Largest Error 0,000003)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
   static final private float Pi = (float)Math.PI;
   static final private float Pi_D = Pi * 2;
   static final private int Size_SC_Bits_Ac = 12;
   static final private int Size_SC_Ar = 1 << Size_SC_Bits_Ac;
   static final private int Size_SC_Bits_M = Size_SC_Ar - 1;
   static final private float Sin[] = new float[Size_SC_Ar + 1];
   static final private float Cos[] = new float[Size_SC_Ar + 1];
   static final private float Pi_SC_D = Pi_D / Size_SC_Ar;
   static{
         for(int i = 0; i < Size_SC_Ar + 1; i++){
            double d = i * Pi_SC_D;
            Sin[i] = (float) Math.sin(d);
            Cos[i] = (float) Math.cos(d);
         }
   }

   static final public float sin_L_theagentd(float rad) {
         float index = rad / Pi_SC_D;
         
         int ii = (int)index;
         float alpha = index - ii;
         
         int i = ii & Size_SC_Bits_M;
         
         float sin1 = Sin[i];
         float sin2 = Sin[i + 1];
         
         return sin1 * (1f - alpha) + sin2 * alpha;
   }
   
     
   static final public float cos_L_theagentd(float rad) {
         float index = rad / Pi_SC_D;
         
         int ii = (int)index;
         float alpha = index - ii;
         
         int i = ii & Size_SC_Bits_M;
         
         float cos1 = Cos[i];
         float cos2 = Cos[i + 1];
         
         return cos1 * (1f - alpha) + cos2 * alpha;
   }

p.s try add lerp to atan - but code becomes too heavy visual, so trow it)
22  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 20:33:34
now replace
r / Pi_SC_Dp
with
r * Inv_Pi_SC_Dp
and you copied my code exactly Roll Eyes
Yep ^^
i can't say copy i change "if with %" on "&" with size align to bit natural grov =)
but y, i see such optimization first time here, so thanks for share it Wink

(technically it one algo so no need add duplicate in chart)

But i don't know why
1  
2  
3  
-0.5PI .. +0.5PI   min err      max err      avg err      stddev
icecore         0.000000   0.001532   0.000485   0.000391
riven           0.000000   0.002299   0.000609   0.000559

on 12 BITS
23  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 20:16:28
Use Riven Bit =)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
   static final private float Pi = (float)Math.PI;
   static final private float Pi_D = Pi * 2;
   static final private int Size_SC_Bits_Ac = 12;
   static final private int Size_SC_Ar = 1 << Size_SC_Bits_Ac;
   static final private int Size_SC_Bits_M = Size_SC_Ar - 1;
   static final private float Sin[] = new float[Size_SC_Ar];
   static final private float Cos[] = new float[Size_SC_Ar];
   static final private float Pi_SC_D = Pi_D / Size_SC_Ar;
    static{
         for(int i = 0; i < Size_SC_Ar; i++){
            double d = i * Pi_SC_D;
            Sin[i] = (float) Math.sin(d);
            Cos[i] = (float) Math.cos(d);
         }
    }
     
   static final public float sin(float r){
      return Sin[(int)(r / Pi_SC_D) & Size_SC_Bits_M];
   }
   
   static final public float cos(float r){
      return Cos[(int)(r / Pi_SC_D) & Size_SC_Bits_M];
   }
24  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 20:00:39
(i thnk magic in % Remainder operation float)
Fix it)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
   static final private float Pi = (float)Math.PI;
   static final private float Pi_D = Pi * 2;
   static final private int Size_SC_Ac = 5000;
   static final private int Size_SC_Ar = Size_SC_Ac + 1;
   static final private float Sin[] = new float[Size_SC_Ar];
   static final private float Cos[] = new float[Size_SC_Ar];
   static final private float Pi_SC_D = Pi_D / Size_SC_Ac;
   static final private int Pi_SC_D_Rem = (int)(Pi_D / Pi_SC_D);
    static{
         for(int i = 0; i < Size_SC_Ar; i++){
            double d = i * Pi_SC_D;
            Sin[i] = (float) Math.sin(d);
            Cos[i] = (float) Math.cos(d);
         }
    }
     
   static final public float sin(float r){
      if(r < 0){
         return Sin[((int)(r / Pi_SC_D) % Pi_SC_D_Rem) + Pi_SC_D_Rem];
      }
      else{
         return Sin[(int)(r / Pi_SC_D) % Pi_SC_D_Rem];
      }
   }
   
   static final public float cos(float r){
      if(r < 0){
         return Cos[((int)(r / Pi_SC_D) % Pi_SC_D_Rem) + Pi_SC_D_Rem];
      }
      else{
         return Cos[(int)(r / Pi_SC_D) % Pi_SC_D_Rem];
      }
   }


1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
linear progression -0.5PI..+0.5PI:
    java.math   64.369 ns/op
    devmaster   29.441 ns/op
    icecore     13.827 ns/op
    riven       11.395 ns/op
    kappa        8.976 ns/op

linear progression -8PI..+8PI:
    java.math   93.948 ns/op
    devmaster   30.792 ns/op
    icecore     14.076 ns/op
    riven       11.319 ns/op
    kappa        9.439 ns/op

input float[]/L1 -0.5PI..+0.5PI:
    java.math   75.743 ns/op
    devmaster   34.110 ns/op
    icecore     23.574 ns/op
    riven        3.197 ns/op
    kappa       16.083 ns/op
25  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 18:40:35
Not so fast as i hope)
(i thnk magic in % Remainder operation float)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
linear progression -0.5PI..+0.5PI:
    java.math   68.584 ns/op
    devmaster   30.111 ns/op
    icecore     29.352 ns/op
    riven       13.923 ns/op
    kappa       10.247 ns/op

linear progression -8PI..+8PI:
    java.math   96.521 ns/op
    devmaster   31.088 ns/op
    icecore     29.686 ns/op
    riven       10.896 ns/op
    kappa       10.368 ns/op

input float[]/L1 -0.5PI..+0.5PI:
    java.math   73.849 ns/op
    devmaster   34.602 ns/op
    icecore     20.253 ns/op
    riven        3.180 ns/op
    kappa       14.639 ns/op
26  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 01:51:20
this is my lookup table)

(Riven's looks fastest)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
   static final private int Size_SC_Ac = 5000;
   static final private int Size_SC_Ar = Size_SC_Ac + 1;
   static final private float Sin[] = new float[Size_SC_Ar];
   static final private float Cos[] = new float[Size_SC_Ar];
   static final private float Pi = (float)Math.PI;
   static final private float Pi_D = Pi * 2;
   static final private float Pi_SC_D = Pi_D / Size_SC_Ac;
   static{
      for(int i = 0; i < Size_SC_Ar; i++){
         double d = i * Pi_SC_D;
         Sin[i] = (float)Math.sin(d);
         Cos[i] = (float)Math.cos(d);
      }
   }
   
   static final public float sin(float r){
      float rp = r % Pi_D;
      if(rp < 0){
         rp += Pi_D;
      }
      return Sin[(int)(rp / Pi_SC_D)];
   }
   
   static final public float cos(float r){
      float rp = r % Pi_D;
      if(rp < 0){
         rp += Pi_D;
      }
      return Cos[(int)(rp / Pi_SC_D)];
   }
27  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-27 00:04:59
Well, devmaster's critically errors past 180
then we need 2 performance lists.

I think i fix it )

(i think +-  can be easy align somewhere in formula but i don't see it)
1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
    static final private float Pi_D = Pi * 2;
    private static float devmaster_sin(float x){
       float x1 = x % Pi;
       float x2 = x % Pi_D;
         
        if(x > 0){
           float y = x1 * (B + C * x1);
           y = (y > 0) ? (y = P * (y * y - y) + y)
                     : (y = P * (-y * y - y) + y);
           float xp = x2 - Pi_D;
           if(!(xp < 0 && xp < -Pi)){
              y = -y;
           }
            return y;
        }
        else{
           float y = x1 * (B - C * x1);
           y = (y > 0) ? (y = P * (y * y - y) + y)
                     : (y = P * (-y * y - y) + y);
           float xp = x2 + Pi_D;
           if(xp > 0 && xp < Pi){
              y = -y;
           }
            return y;
        }
    }

    private static float devmaster_cos(float x) {
       float x0 = x + PI_2;
       float x1 = x0 % Pi;
       float x2 = x0 % Pi_D;
         
        if(x0 > 0){
           float y = x1 * (B + C * x1);
           y = (y > 0) ? (y = P * (y * y - y) + y)
                     : (y = P * (-y * y - y) + y);
           float xp = x2 - Pi_D;
           if(!(xp < 0 && xp < -Pi)){
              y = -y;
           }
            return y;
        }
        else{
           float y = x1 * (B - C * x1);
           y = (y > 0) ? (y = P * (y * y - y) + y)
                     : (y = P * (-y * y - y) + y);
           float xp = x2 + Pi_D;
           if(xp > 0 && xp < Pi){
              y = -y;
           }
            return y;
        }
    }


1  
2  
3  
A lower average means higher accuracy. Results over 18 001 samples.
math_devmaster_sin : Average Error 0,00050 / Largest Error 0,00109
math_devmaster_cos : Average Error 0,00050 / Largest Error 0,00110
28  Game Development / Shared Code / Re: Extremely Fast sine/cosine on: 2015-07-26 22:59:40
1  
2  
3  
4  
 
    // Accuracy
    public static void main(String[] args) {
        int range = 90;

I think range must be bigger like 9000;
For any unnatural values, who knows when function can return critical error)
29  Game Development / Shared Code / Re: Extremely Fast atan2 on: 2015-07-26 22:47:48
I'm assuming they had a contract to fulfill in terms of accuracy that prevented the heavy optimization that we're doing in this thread.

With  lookup table: we can increase it size to increase accuracy.
1  
static final private int Size_Ac = 1000000;

1000000 give "Largest Error 0,000001"
(1000000  = 4mb float[])

+ This also can be used to decrease memory usage with low performance decrease
1  
2  
3  
4  
5  
Atan2_RMP[i] = -Pi_H + v;

Atan2_RMP[(int)(x / y * Size_Ac)];
==
-Pi_H + Atan2[(int)(x / y * Size_Ac)];

p.s increase sin, cos lookup table size can also work with Riven lookup table.
30  Game Development / Shared Code / Re: Extremely Fast atan2 on: 2015-07-26 20:54:50
I ran the benchmark with the addition of Icecore's atan2. I'll be updating the main post shortly. It appears to be in first place by a large margin.
Also, I updated the accuracy measure to actually have somewhat relevant data.
Nice)

Most interesting is – in theory this pattern:
Can be used to cache any returns function data with 2 primitive params like float.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
         double d = (double)i / Size_Ac;
         double x = 1;
         double y = x * d;
         Ar_PP[i] = fun(y, x);
         Ar_PM[i] = fun(y, -x);
         Ar_MP[i] = fun(-y, x);
         Ar_MM[i] = fun(-y, -x);
         
         Ar_RPP[i] = fun(x, y);
         Ar_RPM[i] = fun(x, -y);
         Ar_RMP[i] = fun(-x, y);
         Ar_RMM[i] = fun(-x, -y);
         
         //return save as atan2

But keep in mind because accuracy have errors,
result may be previous or next cached value.

Example
(1,2,3,4,5) want 3 return 4
(4,0,9,1,2,4) want 9 return 0

1  
         float ep = (Max - Min return val) / (Size_Ac * 4);

On practice all not so easy and usage only on certain condition
but why not try on custom function )
(don't forget to check results epsilon equal)
Pages: [1] 2 3 ... 7
 
Roquen (9 views)
2015-08-29 11:30:54

GamerC4 (23 views)
2015-08-22 20:38:50

GamerC4 (22 views)
2015-08-22 20:37:18

GamerC4 (25 views)
2015-08-22 20:37:01

Kefwar (29 views)
2015-08-22 18:07:24

GamerC4 (24 views)
2015-08-22 01:00:24

GamerC4 (37 views)
2015-08-22 01:00:17

GamerC4 (23 views)
2015-08-22 00:57:35

GamerC4 (25 views)
2015-08-22 00:56:59

BurntPizza (29 views)
2015-08-21 01:38:01
HotSpot Options
by Roquen
2015-08-29 11:33:11

Rendering resources
by Roquen
2015-08-17 12:42:29

Rendering resources
by Roquen
2015-08-17 09:36:56

Rendering resources
by Roquen
2015-08-13 07:40:51

Networking Resources
by Roquen
2015-08-13 07:40:43

List of Learning Resources
by gouessej
2015-07-09 11:29:36

How Do I Expand My Game?
by bashfrog
2015-06-14 11:34:43

List of Learning Resources
by PocketCrafter7
2015-05-31 05:37:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!