AGS Kart

Started by SinSin, Sun 22/04/2012 21:33:22

Previous topic - Next topic

Calin Leafshade

Yea, mine is an optimized full translation. The only way you could improve it is with filtering which I think may be possible with more pre-computation but memory usage might be high.

The trick to mine, and the reason it runs so fast is that i only draw the line when i find a colour change which dramatically reduces the number of draw calls on a pixel art type image. Anything that was painted would run just as slow as Kweepa's probably.

Calin Leafshade

#201
With a very dodgy lateral anti-aliasing filter. I reckon you lose about 5-10 fps but my PC still kept it above 40fps at all times.

https://dl.dropboxusercontent.com/u/27247158/agsfilteredkart.zip



Press F to dis/enable the filter.

EDIT: (Sorry for the double post)

Ryan Timothy B

Quote from: Calin Leafshade on Sun 28/04/2013 17:23:43
The trick to mine, and the reason it runs so fast is that i only draw the line when i find a colour change which dramatically reduces the number of draw calls on a pixel art type image.
What did you mean by this?

Calin Leafshade

Ok, so the image is rendered in scanlines from left to right. So a line might look like this after i have selected the correct color from the source texture via a matrix transformation (imagine different characters are different colors):

*******&&&&&&&&&&$$$$$$$$**********

So my draw func steps across a line like this:

1      2         3       4
*******&&&&&&&&&&$$$$$$$$**********


1) Found a new color, store that color and keep going:
2) Found a new color that is different from the last one, set the drawing color the color at point 1 and draw a line from 1 to here.
3 & 4) repeat 2.

In this way the drawing color only needs to be set 4 times (this is quite expensive) and only 4 lines needs to be drawn (which is also quite expensive).

Ryan Timothy B

Gotcha. I figured you were doing something along those lines.

I've been bench marking my tests and they definitely need some tweaking. This might not be likely.

SinSin

#205
Quote from: DoorKnobHandle on Sun 21/04/2013 19:54:29
We run aground somewhere? Well, we had 9 pages of engaged discussion and quite a bit of productivity, until you, out of nowhere, put the lid on it and - all of the sudden - it wasn't supposed to be a swarm effort anymore:

Quote from: Sinsin on Mon 07/05/2012 11:43:44
This game is no longer to be considered a swarm.

Plenty of people were interested and I too would have really loved to contribute more (despite my frustration at people not understanding just how much of an additional difficulty actual multiplayer is haha) - I think you really screwed up there when you closed it off after the swarm got started on it (no offense, happens to the best of us). I have very little time these days but if this project was to rise again I certainly could try and help out. Still love the project idea!
Ok my bad I'm sorry everybody.

* Apologies to everyone. I just thought that too many cooks and all that jazz.

As it turns out you chaps are doing a fantastic job with this. Keep it up!

:)   again I actually feel like a massive ass right now... 
Currently working on a project!

DoorKnobHandle

As I said, everybody makes mistakes and it's clear you intended only the best for the project! It was just a bit abrupt after there was so much work put into it by SteveMcCrea, Khris and so on IIRC! No worries, and yes, I am very excited that this is being picked up again! I like the non-blurred renderer the best so far!

Ryan Timothy B

Argh. I hate math.

(I really don't.. I just get frustrated)

Khris

Oh yeah, I used the wrong angle in one line although I did use the right one on paper and it took me half an hour to find the mistake :) Good times.

Khris

I guess a double-post is in order:

I rewrote the previously hard-coded 3D translation in order to be able to have a free camera and managed to smooth out the sawtoothy look in the process. The track sprites are significantly smaller now (in filesize), and AGS loads the track much faster. Added lazy camera, horizontal and vertical objects, driving physics including driving on dirt and music.

You can move the camera up and down with I/K, pan with arrow up/down, and zoom with +/-
Controls: WASD, Esc to quit.

Only 30 MB this time :)

No screenshots on purpose :-D (also, still 40 FPS)

ThreeOhFour

Pretty sensational!

Ryan Timothy B

That's awesome man! I probably did over 30 laps.

Now I only need to work out my issues so I can upload my work. I need to google some math stuff or something - this is bugging me.

MiteWiseacreLives!

Wow, that is very credible! Out of curiosity, how big of a leap is it now to add other AI carts?

Ryan Timothy B

#213
AI is definitely another challenge. You have to have a basic pathfinding system for them to know where a turn is, objects, other karts, bonus blocks, etc. Then you have to add a level of "stupidity" to them that randomly makes them crash, turn too sharp or too late, having them crash into each other.. etc. It would definitely be one of the last things I would get running.

Edit: Khris, I want to steal your driving physics.

DoorKnobHandle

Excellent work, Khris. Your latest build runs and plays great!

Khris

Ryan:
Code: ags
float turn_speed = 1.4;
float max_speed_forward = 4.0;
float max_speed_backward = 2.0;

  // steer kart
  float factor;
  float max_factor = 1.5;
  if (current_speed == 0.0) factor = 0.0;
  else factor = max_speed_forward / current_speed;
  if (factor > max_factor) factor = max_factor;
  if (factor < -max_factor) factor = -max_factor;
  if (IsKeyPressed(eKeyA)) kart_angle -= turn_speed * factor;
  if (IsKeyPressed(eKeyD)) kart_angle += turn_speed * factor;
  
  // move kart
  float sin = Maths.Sin(Maths.DegreesToRadians(kart_angle));
  float cos = Maths.Cos(Maths.DegreesToRadians(kart_angle));

  float target_speed = 0.0;
  if (IsKeyPressed(eKeyW) && !IsKeyPressed(eKeyS)) {
    target_speed = max_speed_forward;
  }
  if (IsKeyPressed(eKeyS) && !IsKeyPressed(eKeyW)) {
    if (current_speed <= 0.4) target_speed = -max_speed_backward;
  }
  current_speed += (target_speed - current_speed) * 0.05;
  if (current_speed > -0.1 && current_speed < 0.1) current_speed = 0.0;
  
  kart_position.x += current_speed * sin;
  kart_position.z -= current_speed * cos;

SinSin

Well I'll be..
This just keeps on going and going, Fantastic work so far.
Question is there anything that artists can be doing in the mean time.. I know that further development may change the size of the sprites used etc

Just want to help out thats all.

Currently working on a project!

selmiak

wow, fascinating ;D

Ryan Timothy B

I think my initial bench marking was a little too abusive. I think I can do this and hold at 40fps. I just need to do some distance optimizations, and maybe, just maybe I will have the smoothest looking version. Maybe.

I'll keep ya's updated.

Oh and thanks Khris for the driving physics. I felt it was smooth, wanted it to be similar (especially since I'm using the same map as you).

dactylopus

This is a fascinating project.  It's amazing what you guys can do with this engine.

SMF spam blocked by CleanTalk