Ai Dreams Forum

Member's Experiments & Projects => AI Programming => Topic started by: ranch vermin on November 10, 2017, 12:20:31 pm

Title: new demo on the way
Post by: ranch vermin on November 10, 2017, 12:20:31 pm
Ive got the next week all planned out.  This will be a continuous thread,  sorry for the abrupt making of threads up till now, ive definitely got something solid to do this time.

Heres a screen shot of yesterday and todays work,  next on i need animation and then im going to code the bots brain,  and its all organized start to finish I know it pretty well now.   And ive taken a bit out of the brain design which should give me something easier to make right now.  Because Ive gone a long time with no results, and I think its time to actually implement something.


Title: Re: new demo on the way
Post by: ranch vermin on November 10, 2017, 01:17:04 pm
heres the algorythm for the robot,  id like to just add, an algorythm is one of these, most people think methods are algorythms, but they are not,  algo -rythm means algo-pain rythm-beating,  so i think its reserved for reinforcement learning, which is a method in itself,  but not all methods are algorythms.

  score higher if he manages a 180.
  score higher if he goes quicker.

 score lower if someone sees him 
 score lower if he makes too much noise.

 score lower if it gets hit too hard.
 score lower if the enemy gets hit too hard.  (cant tell if he hurt, but he can tell the force!)

 score lower for proximity of enemy to ally
 score higher if its between enemy or ally.
 score higher if the derivative of the enemy is going away from the scene

 score higher if you spot the following character
 score lower if you have not spotting the following character

 score lower if the battery is low
 score higher if you have spotted a power plug
 score higher the closer the tendril is to the power plug.  (error,  it doesnt quite have the 3d power to know this non approximately, and it has to see it.)
 score lower if you battery is charged and your still in the power plug.

 score lower if a novelty is near something thats old that is always around you.
 START A TIMER ->  score higher if he gets away from it

 score higher for seeing someone new
 score lower if he hasnt seen someone new for a while

but theres more to do to make him fully useful->

   //ON A TIMER -> score higher for altitude and proximity to enemy

Title: Re: new demo on the way
Post by: on November 10, 2017, 01:27:22 pm

May I suggest, chase and evade algorithms?
Title: Re: new demo on the way
Post by: ranch vermin on November 10, 2017, 01:35:44 pm
That could be fun to watch,    I guess if you make it interested in an object, it will definitely go after it - and the opposite, make it repulse.
Title: Re: new demo on the way
Post by: ranch vermin on November 10, 2017, 03:08:13 pm
just for fun,  i was working on the parallax occlusion mapping "hologram" of the bot and it went skinny and a swasticross!


The technique im using is hit the ground, then sample backwards,   if most things are near the ground it works okish,  100 samples, and 40 samples to gain the surface detail,  and its double sided displacement mapping, so everything has a bottom as well as a top.

When its all done, im going to go over the graphics render, and bring it up nice and moody and realistic at the end.   All I have to do at the beginning is make sure the detail is there, then lighting takes care of the rest. 

my spidder model->

Ill have him fully ragdoll by tomorrow evening - then its onto the a.i.!
Title: Re: new demo on the way
Post by: ranch vermin on November 13, 2017, 02:21:54 pm
UPDATE.   sorry Since the blow I took to my head, everything is a little harder to get through, and im stuck on the mouse picker,   I should get it finished tonight then a bit more on collision detection and model rotation then im onto the brain!
Title: Re: new demo on the way
Post by: on November 13, 2017, 05:19:53 pm
Thanks for the update.
It's looking good so far.
Title: Re: new demo on the way
Post by: ranch vermin on November 13, 2017, 05:42:13 pm
No, thankyou for watching.  :)

Its coming along,  i wouldnt say nicely, but maybe half nicely.       Im pretty sure ill be onto the actual ai tomorrow,  just a bit more work on the simulation to go. (BORING!!!)
Title: Re: new demo on the way
Post by: LOCKSUIT on November 13, 2017, 07:57:39 pm
What's this thing gonna do though, really? Is it going to talk back to us, and tell us what to do to stop deaths? Or, achieve intelligent behavior and come out of the simulation?

Come on Ranch, before anymore of us dye.
Title: Re: new demo on the way
Post by: ranch vermin on November 13, 2017, 10:58:51 pm
Ok I just wrote most the brain code,  but theres a bit left to do.

Theres 2 main weaknesses here.

A) having to fit 400 bit keys into a space that would fit a 21 bit key,   

B) A very brittle response from whole states only at once, only 1 key over time, but with near matching (through exact matching of LODS) instead of actually having the space chained with the time with a whole screen accesses over time.

SO. pros.

a)  I might get a bit of time before the array overloads, so it could work fine for a while, but how long I dont know.

b) Near matching whole time states may be an equivilent but different method to "invent states" so I dont have to do all those extra space accesses - not only processing is wasted, they actually all chain wrong as well and its horribly difficult!

Other than those 2 issues It is quite close to my finished original idea, which I think could run a quite a good robo army,  or looking after a farm automatically, once I get this system going, just know it takes more brainy knowhow to know how to use it,  and what to get out of it - as well as to make it.   which can be easily also stuffed up!!!  (when taking this whole send us to the future thing AS A WHOLE which is happening right now.)

You could try to escape a bad situation by making a dummy version of yourself that hides in the bush and runs out so they run after him instead of you.
You could give your whole house a predictive brain that knows when your cooking dinner and going to bed, and when to feed the birds out the back.

What this "machine learning" gives us,  we all come up with very similar ideas,  but Its great to see actually done, instead of just talked about.

So give me a couple of more days and ill have a few more updates,  I promise this will be resolute by the 23rd this month, it being november MAX.  whether it works, half works, or fails pretty bad ill be posting HERE - and ill be proud anyhow it goes!

Having a 400 bit key for it,  definitely seems like enough to me,  you could fit a good portion of the scene in front of it in "memory particles" on an SDR field, it kinda sees the world like how it sees itself.   But the problem is my limited SUPER ACCESS SPEED SPACE ? :) only gives me 21 bits to wrap the key over, so it eventually will stuff up a read,   so how long it takes for this to happen i dont know.

And will rectifying the problem, slow the whole process down so it doesnt run anymore....        but im not worried,  this is important for me to try out.
Title: Re: new demo on the way
Post by: ranch vermin on November 14, 2017, 05:59:11 am
apart from the full offload to the gpu with a change of plans,   heres what the rule function turned into half coded.   but the population tester function is just about finished,  this is the motivation code slowly taking shape with a double loop of the environment to the environment which is a bit annoying cause i have to run the bugger every step of series and parallel.

uint rule(BOTKEY botkey, ENVKEY envkey, uint lod, POPINTMEM intmem)
 uint score=0;

 //1 point.   3x8 depth data,  3 bit id.  (just have friend and foe at first.)


 //ok so weve got a prob,  it isnt enough topology information actually - if u had a camera on all sides of the robot, it would get
 //a better scene.


 bool flipped=false;
 //did i flip? check the route, and compare to the old key.
  // score higher if he goes quicker.     this is combating against the battery used???  so maybe itll just make a nothing score.
 //the route in front has a velocity to it?
 float speed=0;  //check the speed in the route.

 //this hacks at robots speed score the lower the battery is.

  // score-=selfaccelleration;
  // score-=opponentaccelleration;  (it even hates looking at people getting hurt.)

 uint g;
 for(g=0;g<lod;g++) //go through the objects in the seen.
   //stranger or foe  downscore INDEPENDANT OF POSITION. and reset timer
   //UPSCORE ally INDEPENDANT OF POSITION and reset timer
   //then further downscore for proximity of an enemy unit to an ally unit
  //upscore for enemy unit to be moving away - (it has its velocity subtracted from it.)
  uint h;
   //CHECK DISTANCE TO G.  score inverse proportional.

   //AM I INBETWEEN THE TWO? - they are on either side of the screen.  (HERE U NEED A BACK VIEW TO KNOW THEY ARE BEHIND YOU.)
   //?for stranger being near an "ally item"


 return 0;
Title: Re: new demo on the way
Post by: ranch vermin on November 19, 2017, 08:04:00 am
Sorry bad news,  my gpu just f'n died when i was doing the eye,  I think its because my little brother hacked in a power supply in and me running it full power too often eventually toasted it....  heres a video just to show me doing the eye - im not just flaking out.

All the code is actually in,  I was just going through bit by bit getting it working!    Ive got this awesome really quick method of getting pattern matches,  IM PISSED OFF!!!

I have to wait till at least 23rd of november to get another video card.    Bastard!!  Just when I wanted to see something decent!!
But the good thing out of this,  is I get to clean my house.  the computer was taking up all my time and my house has turned into a trash heap.

Title: Re: new demo on the way
Post by: ranch vermin on December 13, 2017, 03:40:03 am

So ive got the 3d eye going again,  sorry for the delay,  I got my computer back and realized I didnt even need to send it to the shop because it was just a shader wasnt compiling!!! and i got stack overflow errors, i was dizzy in the head, and fricken forgot to test run the computeshader demo tutorial i nabbed the code off!!!   dummy.  and it ran fine.

This tests my super router, fine,   so i can go and write a ga that can have a population of over a thousand over a fair series judgement!!!  SO WATCH OUT,   anytime i want i can pull my trigger.  >:D

But... i got something even more deadly up my sleeve like jim carrey.  hence all the big waits...
Title: Re: new demo on the way
Post by: ranch vermin on December 13, 2017, 03:56:19 am   <-a more better raw view of how fast my memory system goes.  (i get bills of accesses, but this aint shit,   i have to keep my proper one a total secret!!  for u goons, i dont trust ya!!!)
Title: Re: new demo on the way
Post by: ranch vermin on December 15, 2017, 12:34:54 pm
Its on its way!   If anyone wants to see what gpu code can look like  (this drone is gpu accellerated.)  heres what mine does->   (its the whole robot update read and write)

its finished on my computer now, but things are left out of this one so its nonrunnable.
But its just as small,   the ai loop is not very large at all!!

Code: [Select]
DRONE_KEY run_drone(DRONE& drone)


 SRV views[1000];

 // SHITTY 3D SENSE   (i dont think you want to use this for now, just pass it a depth map.)
 RunComputeShader(dc, drone_sobel, 1, views, nullptr, nullptr, 0, drone.sobel_retina_uav, (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );   
 RunComputeShader(dc, drone_blur_sobel, 1, views, nullptr, nullptr, 0, drone.blur_sobel_retina_uav, (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 RunComputeShader(dc, drone_tune_blur_sobel, 2, views, nullptr, nullptr, 0, drone.tune_blur_sobel_retina_uav, (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 //then just leave the 3d there for now.
 //basic "depth green screen"  so the foreground is mostly separate from the back, but it makes blunders.

 // EYE    (1st near neighbour solution!)
 int i;
  RunComputeShader(dc, drone_make_eye_keys, 1, views, nullptr, nullptr, 0, drone.eyekeys_uav[i], (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 RunComputeShader(dc, drone_jumble_match_eye_keys, drone.lods+1, views, nullptr, nullptr, 0, drone.class_map_uav, (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 //suppress the output map.
 RunComputeShader(dc, drone_suppress_eye_keys, 1, views, nullptr, nullptr, 0, drone.class_map_suppressed_uav, (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 //form the word keys.
 RunComputeShader(dc, drone_make_phrases, 1, views, nullptr, nullptr, 0, drone.phrase_keys_uav, (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 //run the soft body word router. //then you class it,  MAN, WOMAN, PRIMO & PRIMA
 RunComputeShader(dc, drone_match_phrases, 1, views, nullptr, nullptr, 0, drone.phrase_map_uav, (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
  //form the environment keys.  suppress the words off one at a time.
  RunComputeShader(dc, drone_suppress_phrases, 1, views, nullptr, nullptr, 0, drone.suppressed_phrase_map_uav[0][i], (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 //keep a history chain, at some point back


 // MOTOR    (huge population over time!)
 uint j;
 for(j=0;j<drone.lods;j++) //add the j dimension
  RunComputeShader(dc, drone_run_pop, 1, views, nullptr, nullptr, 0, drone.blended_motor_key_uav[0], (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );

 // SENSOR MOTOR MEMS.   and output key.
 //write new motor key, to environment keys.   //U HAVE TO TRUNCATE IT FOR EACH LOD MEMORY.
 RunComputeShader(dc, drone_run_pop, 1, views, nullptr, nullptr, 0, drone.blended_motor_key_uav[0], (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );
 //write old environment keys to new motor key  //U DO IT FOR LODS.
 RunComputeShader(dc, drone_run_pop, 1, views, nullptr, nullptr, 0, drone.blended_motor_key_uav[0], (1<<drone.logretina)/32, (1<<drone.logretina)/32, 1 );

 //keep history.

 //troublesome VIDEO to SYSTEM copy.
 ID3D11Buffer* debugbuf = CreateAndCopyToDebugBuf( g_pDevice, g_pContext, drone.blended_motor_key[0]);
 D3D11_MAPPED_SUBRESOURCE MappedResource;   
 BufType *p;
 g_pContext->Map(debugbuf,0,D3D11_MAP_READ,0,&MappedResource );   
 p = (BufType*)MappedResource.pData;
 memcpy(&key,p,sizeof(DRONE_KEY)); //not right. its wrong.
 g_pContext->Unmap(debugbuf, 0);
 SAFE_RELEASE( debugbuf );

 return key;
Title: Re: new demo on the way
Post by: keghn on December 15, 2017, 03:08:59 pm
 I would really like to program in cuda, Nvidia. Difficult to find good GPU programming on the web.

 OpenCL is generic GPU programming. That will work with AMD, INTEL, and Nvidia's old slow commands.

 Cuda is Nvidia's only gpu programming.  Very fast.

 The memory model is pretty much the same in this video:

Simple tutorial
 An Introduction to GPU Programming with CUDA:

Title: Re: new demo on the way
Post by: ranch vermin on December 15, 2017, 04:26:30 pm
Especially direct compute, theres not much there except demos,  no real tutorial things.

its a 500 times speed up on my computer,  but ive only got 4 gigs of ram to do the brain store.   Im running the rule program per access of its copy of the environment, so itll definitely add up to the workload for the gpu.

I was just writing the shaders then,  nearly done, i want it done tonight!   then testing can be probably in a couple of days.
Im just passing it a depth map instead of concocting it from the colours, but the finished one will have a 3d from rgb element on it.

So Keghn, keep watching here, and ill have my first walker going!  but hopefully hell be a run and jumper! :)
I want the robot to actually charge itself from the aussie power points by itself when it runs low on battery.   Its gonna be kewl!

And solar power will be there as well,  i might end up probably doing the easy thing and make it sun bake like a lizard,  thats an easier option,  but i might do both,  cause i need this thing to be really as good as its going to be.