Here are some of EVALDRAW's new features: * RScript, a new compiler written by Robert Rodgers. It's compatible with EVAL, supports more syntax from C, and it's faster too. * Errors are now highlighted in the code, making them much easier to find. * Improved net code, with UDP support and a simpler API. * New sample games & demos.
Perhaps the best feature of Evaldraw is its sample games :P
Edited by ConsistentCallsign at
Jinroh at
Awesoken said at
Ken added New Stuff
Awesome Ken! ^_^ It's still my number one evnvironment of choice for controlled tests, and it just keeps getting more and more useful.
I know it's not new, but I noticed that your Tic-Tac-Toe AI doesn't know the Winning Move. ^o^ "The only winning move is not to play." hehe.
Edited by Jinroh at
Awesoken at
For tictactoe.kc, I use a standard minimax game tree. It works fine for the 3x3 board, but for large boards it is useless. There is a better algo called "threat-space search", which I've been wanting to implement, but somehow I never find the time. Any takers? : P
Jinroh at
Awesoken said at
For tictactoe.kc, I use a standard minimax game tree. It works fine for the 3x3 board, but for large boards it is useless. There is a better algo called "threat-space search", which I've been wanting to implement, but somehow I never find the time. Any takers? : P
I tried looking up threat-space search, but didn't come up with any good descriptions of the algorithm. Just a few papers about which games it was implemented for.
Redeemer at
Hmm, this looks good. I'll have to try it out tomorrow. ;)
Also: hello everyone, I'm new here :)
Edited by Redeemer at
Jinroh at
Redeemer said at
Hmm, this looks good. I'll have to try it out tomorrow. ;)
Also: hello everyone, I'm new here :)
Hello Redeemer, welcome. ^_^
Schraubendreher at
Greetings Redeemer! Your name sounds very familiar, and so does the name Robert Rodgers. Almost as though I had heard them before somewhere...
ConsistentCallsign at
Déjà vu lol
Redeemer at
I don't know where you would've heard my name before, 90% of my work is unknown to the outside world.
BTW Ken/Robert, I just tried this new version of Evaldraw. Nice demos, the "time cow" was funny :D
DeadBarney at
An updated evaldraw ? Can't wait ! But... 5ko/s... have to wait.
Thanks Ken !
torbj?rn at
I LOVE EVALDRAW! :D
I just had to shout that out.
The difference in speed between the old EVAL compiler and Rodgers Rscript is quite staggering on this script I made of diffusion limited aggregation in 3D. It uses 250 Mcc while generating with the EVAL compiler, but only 50 with RScript. (optimizations enabled)
By the way... What does the cc stand for? clock cycles per frame? Kcc, Mcc...
enum{GRIDSIZ=128}; static particleX,particleY,particleZ; static voxel[GRIDSIZ][GRIDSIZ][GRIDSIZ]; // bruteforce voxel structure. There are structures that use less mem...
if(hasNeighbour==0){ for(signx=-1; signx <= 1; signx++){ for(signy=-1; signy <= 1; signy++){ signz = 0; if(signx != 0 && signy != 0){ // dont check self if( voxel[x+signx][y+signy][z+signz] > 0 ) // found neighbour!! { hasNeighbour = 1; // got what we need, now escape those loops: parent = voxel[x+signx][y+signy][z+signz]; // who's you daddy? breakAll = 1; break; } } } //ey if(breakAll==1)break; } //ex
for(signx=-1; signx <= 1; signx++){ for(signz=-1; signz <= 1; signz++){ signy = 0; if(signx != 0 && signz != 0){ // dont check self if( voxel[x+signx][y+signy][z+signz] > 0 ) // found neighbour!! { hasNeighbour = 1; // got what we need, now escape those loops: parent = voxel[x+signx][y+signy][z+signz]; // who's you daddy? breakAll = 1; break; } } } //ey if(breakAll==1)break; } //ex
for(signy=-1; signy <= 1; signy++){ for(signz=-1; signz <= 1; signz++){ signx = 0; if(signy != 0 && signz != 0){ // dont check self if( voxel[x+signx][y+signy][z+signz] > 0 ) // found neighbour!! { hasNeighbour = 1; // got what we need, now escape those loops: parent = voxel[x+signx][y+signy][z+signz]; // who's you daddy? breakAll = 1; break; } } } //ey if(breakAll==1)break; } //ex } // end still not found neighbour
} else if( freedom == UBER_GREAT_FREEDOM ) // 3x3 cube - where particle is (0,0,0) { // could unroll this loop for speed... hasNeighbour = 0; //try to disprove it has a neighbour breakAll = 0;
// try limiting the growth dir by changing loop limits in 1 axis // can make it grow upwards like a tree. or lighning bolt.. for(signx=-1; signx <= 1; signx++) { for(signy=0; signy <= 1; signy++) { for(signz=-1; signz <= 1; signz++) { if(signx != 0 && signy != 0 && signz != 0) // dont check self { if( voxel[x+signx][y+signy][z+signz] > 0 ) // found neighbour!! yay { hasNeighbour = 1; // got what we need, now escape those loops: parent = voxel[x+signx][y+signy][z+signz]; breakAll = 1; break; } }
if(hasNeighbour) { // Set Color hue = 360 * numpts/maxpts; r=0; g=0; b=0; hsv_to_rgb(hue % 360,1,1,r,g,b); voxel[particleX][particleY][particleZ] = numpts; // set occupied by this point
slider(sliderNum,&value,x,y,length) { enum{numSliders=10}; static mouseLock[numSliders]; // Constructor, set slider to mid position if(numframes==0) { //value = .5 * length; // this is what makes the adv slider work. :S mouseLock[sliderNum] = 0; } // Draw slider setcol(255,255,255); moveto(x,y); lineto(x+length,y); drawsph(x+value,y,-10); //moveto(x+length+5,y-5); //setfont(8,12); printf("value=%g",value);
// mouse input //mouseValue = mousx/(xres/2)-1;
// Check if anyone else has lock, if so exit. if(mouseLock[sliderNum] == 0) for(i=0; i<numSliders; i++) { if(i==sliderNum) continue; // if we have lock no problem if(mouseLock[i]) return; // someone else has lock }
if(bstatus==1) { mx = mousx; my = mousy; if(mouseLock[sliderNum]) // mouse has lock-on, move slider { setcol(255,0,0); drawsph(x+value, y,-5); if(mx <= (x+length) && mx >= x) // limit movement to slider line { intrinsicRatio = (length-0)/( (length+x)-x); value = ( mx-x)*intrinsicRatio + 0; } else if(mx > (x+length) ) { value = length; } else if(mx < x) { value = 0; } } else // check for collision { if( isColliding(mx,my,x+value,y,10) ) mouseLock[sliderNum] = 1; } } else // mouse released { mouseLock[sliderNum] = 0; }
Just got the basics working: -Enemies that follow a waypoint path. -Towers that turn at a given rate towards the enemy. -Mousepicking on the map for placing towers.
*Things to do: -make a GUI for selecting types of towers. -skybox -dont place towers on road or same tile twice. -make it into a real game with levels and some difficulty.
Here's a video: http://www.youtube.com/watch?v=L6fPxCoBdTA
And here's the code. Uses caco instead of the cannon.
Edit: -Fixed some stupid mistakes. -Towers are much less powerful -Bullets only last for so long -enemies spawn at a given timerate, not framerate dependant. -a circle shows the towers range
clz(1e32); cls(255,255,255); // clear screen white, pick colors begin with black renderPickColors(); // render battlefield tiles with unique color getPicked(); // read color and find tile mouse is over
// Now, draw actual game graphics. //cls(0); clz(1e32); renderBattleField();
renderPickColors() { static tex[1][1]; tex[0][0] = rgb(511,511,511); t = glsettex(tex,1,1); glbegin(gl_quads); num = 0; setcol(255,255,255);
r = 0; g = 0; b = 0; for(i=0; i<GRIDW; i++) for(j=0; j<GRIDH; j++) { scale = gfxscale; // store world coorinate for tile tileX[num] = (i+.5)*scale; tileZ[num] = (j+.5)*scale;
setcol(r,g,b); // any difference in color between the 2? //setcol( rgb(red,green,blue) ); gltexcoord(0,0); glvertex(i*scale,0,j*scale ); gltexcoord(1,0); glvertex( (i+1)*scale,0,j*scale); gltexcoord(1,1); glvertex( (i+1)*scale,0,(j+1)*scale ); gltexcoord(0,1); glvertex(i*scale,0,(j+1)*scale );
// Store color objcolor[num][0] = r/255; objcolor[num][1] = g/255; objcolor[num][2] = b/255;
// Since i dont know how what color evaldraw actually // will draw in 3D i increase r,g,b by a fair amount // to allow for some error in picking one color // you see, getpix doesnt return what i draw here... lighting? r+=10; if(r>255){ r=0; g+=10;
// draw circle to show turret range. j=0; ang = j*2*pi/12; ca = cos(ang); sa = sin(ang); r = turretShotRange; moveto(x+ca*r, y+1, z+sa*r); for(j=0; j<=12; j++) { ang = j*2*pi/12; ca = cos(ang); sa = sin(ang); lineto(x+ca*r, y+1, z+sa*r); }
// if predator is dead on, no not correct path. deadOnTarget = angleToPray*180/pi - turretHeading[turret]*180/pi; if( deadOnTarget < -90+bound && deadOnTarget > -90-bound ) { onTarget = 1; }
hex2rgb(mrgb,&r,&g,&b) { r = (mrgb / 2^16); g = (mrgb / 2^8) % 256; b = mrgb % 256; }
hsv_to_rgb(h,s,v,&r,&g,&b){ if( v == 0 ){r=0; g=0; b=0;} //no brightness(value) means black else if( s==0 ){r=v; g=v; b=v;} //grayscale, no colour saturation else { hf = h / 60.0; i = floor( hf ); f = hf - i; pv = v * ( 1 - s ); qv = v * ( 1 - s * f ); tv = v * ( 1 - s * ( 1 - f ) ); if(i==0){r=v; g=tv; b=pv;} if(i==1){r=qv; g=v; b=pv;} if(i==2){r=pv; g=v; b=tv;} if(i==3){r=pv; g=qv; b=v;} if(i==4){r=tv; g=pv; b=v;} if(i==5){r=v; g=pv; b=qv;} if(i==6){r=v; g=tv; b=pv;} if(i==-1){r=v; g=tv; b=qv;} } //r=int(r*255); //g=int(g*255); //b=int(b*255); //return r*2^16 + g*2^8 + b; }
/* gets the player controls and sets global camera variables. */ updateCamera() { // horiz and vertical heading (euler angles) static posh = -PI/2; // left right static posv = -PI/2 - PI/8;
playercontrols(cam,posh,posv); //if(posv > 1.5) posv = 1.5; //if(posv < -1.5) posv = -1.5; setcam(cam.x,cam.y,cam.z,posh,posv); } // Camera and movement code taken from /games/ //Handle input and player movement playercontrols(p3d_t campos,&posh,&posv) { static oldMouseX; static oldMouseY; static mouseSpeedX; static mouseSpeedY;
f = .128; if (keystatus[0x2a]) f *= 1; if (keystatus[0x36]) f *= 2; vx = (keystatus[32]-keystatus[30])*f; //D-A vy = (keystatus[17]-keystatus[31])*f; //W-S vz = (keystatus[0x52]-keystatus[0x9d])*f; //KP0-RCtrl
Wow, the new compiler is really much faster, thanks for this. However, I'll have to make minor fixes into my scripts; the old compiler allowed omiting ";" after drawing commands and calling cls() with no arguments, as well as provided the 'atn' alias which doesn't seem to work anymore.
Personally, I want Evaldraw to support integer types and bitwise logic to speed things up a bit.
Edited by CraigFatman at
Schraubendreher at
Personally, I want Evaldraw to support integer types and bitwise logic to speed things up a bit.
Maybe you are in for a pleasant surprise in a couple of months... or next year, at the latest.. ;)
Awesoken at
I'll have to make minor fixes into my scripts;
I spent many weeks beta-testing for Robert, pointing out incompatibilities with my old compiler. There are only a few minor things that need fixing in your scripts. Thanks to the new error highlighting, it should be easy to find these issues. As for the semicolons, I decided it was not a good idea to have Robert hack his compiler to support bad syntax.