Friday, June 02, 2006

Hyperplanes, Normals & Vectors

Lot's of work over this week including a major overhaul of the waypoints system which was far from ideal. Previously the vehicles aimed for specific points on the track, a distance check was then used to decide whether the car had reached the waypoint - this resulted in a circular detection area.


The major drawbacks of this approach are that if you drive off the track you can completly miss a waypoint without realising and the lap wont be counted, ai cars all aim for the same point which results in them driving in a line on the same route and the start finish line is actually a circle! The solution has been to replace points with lines, the ai can then pick different points on the line to aim for resulting in a more unpredictable race. It is also possible to find if a waypoint has been passed by calculating the normal of the line and projecting the distance from the car to the line onto that - if the number is below zero then the line has been passed. For this Metanet has been a great help as always! The other great thing about this method is that the line never has to be phyisically touched as it is calculated as if the line continutes into infinity in both directions...


I have also integrated waypoint editing / saving / loading into the track editor. The ends of lines can be dragged to move the waypoint and the red arrow signifies direction. (The track is displayed half size in the editor)


I think once the AI cars are more aware of the other vehicles around them this will provide a really good level of challange, at the moment they like to cross each others paths too often, which results in cars scraping along next to each other...

Friday, April 28, 2006

Status

Hey all,

After two months with no update from me and Jon i thought it worth posting what has been going on. I would love to say that we've both been working on the game so hard there has simply been no time.. however, this is not the case!

We have both been busy with other commitments, at my end this has been coursework and exams which will be ongoing for a few more weeks yet. After that i start a new job, which for the project is actually a good thing as i will have time in the evenings to work on the game instead of coursework and revision.

Hopefully, the next post will be sooner rather than later!

Tom.

Wednesday, February 22, 2006

Through the keyhole

What kind of person would code in a place like this? A little insight into our work holes, where we spend hours perfecting blog posts like this for you guys and then a couple of minutes on the game ;-)

Jon
Tom

Monday, February 06, 2006

Solid Geometry

Well,

Since the demo i have been working hard on ironing out the little issues we had left and adding some new 3D features into the engine.

I thought i would write my first indepth post on the technology behind the game, and explain how we are achieving 3d objects while maintaining (hopefully!) high frame rates. I am using a technique that was explained to me by kirill mourzenko several years ago, and i used a less advanced version in my earlier (unfinished) game Felony (on which Jon helped with the physics, and is actually how we hooked up for this game!)


Faking It

The 3d objects in Flash Racer are faked through a combination of clever scaling, animation and paralax scrolling. Firstly, for each object the distance is found between it and the center of the screen. For buildings, this distance is then used to offset the roof by an amount depending on the buildings height. So, as the building moves further from the center of the screen the roof becomes more offset, this creates the impression of perspective.



See how the building to the left appears to be leaning more? Of course for taller buildings this effect is even more dramatically increased. The roof of the building is also scaled up according to its height as objects closer to the camera should appear bigger!

The walls are wedge shaped images that are simply scaled to fit between the base of the building and the side of the roof, at the moment this calculation is performed every frame in the Camera Class, however this could be reduced for lower spec machines and i am looking into making this one of the many graphics options we are likly to include!


The final piece of the puzzle is to skew the wall image so that it fits when the roof is no longer above the building base. This is predone animation, with one keyframe for every single pixel of movement (81 keyframes in total), this is a very efficient way of achieveing the right look.







On a side note, i have noticed that you can now dynamically skew images in flash 8, this would have been ideal for this, however we are currently coding for flash player 6 in AS1 so it would be unreasonable to code only one feature in the brand new flash player! Maybe in a future version?


Pseudo Speed

These tall objects are great, because they add that extra level of depth to the game and just as importantly - because they are closer to the camera, they move faster and dramatically increase the feel of speed when racing! All we need now is a little blurring...

Any questions? Just leave a comment! Extra points if you can work out the cryptic title ;-)

Monday, January 23, 2006

Tech Demo Release! (Finally..)

At last, the first major milestone in this mammoth project has been reached, we've kept you hanging since well before Christmas for a working demo, but now is the time! Me and Jon have been laboring all weekend over the last of our goals for this tech demo in order to get it into the wild today...


Current Features
- Different surfaces affect handling
- All game data loaded from external XML files
- Accurate collision detection
- AI with up to 6 cars on track
- HUD including lap times / lap counter and race positions
- Dynamic camera, that can swap between racers


Future Features
- More tracks
- Larger tracks
- Accurate collision response
- Solid & Tire Walls
- 3D Structures
- More advanced AI with more varied racing lines
- Career mode, saving of all race data / lap times etc
- Graphics options for slower computers
- Cheats
- Sound


Known Issues
- You can drive off the map
- Collision response not finished


We Need You

What we would love it some feedback on the engine so far, your opinions on every aspect of the game and how it can be improved in future revisions. Some information that would be nice when you comment:
  • CPU speed
  • Flash player version
  • frames per second ( top-right corner ) - min/max/average would be great!

Enough Babble, I Want To Play!

You can play the flashracer tech demo using the following controls...

Keys:
UP arrow - Accelerate
DOWN arrow - Brake
LEFT and RIGHT arrows - Steering
SPACE bar - Handbrake
1 - 4 numbers - Change camera view to other cars


The Sexy Temporary Graphics


(Jon getting beats by the computer)

Finally...

Enjoy the demo, let us know what you think in the comments for this post or on the flashkit thread which can be found here. Don't forget, this is just a tech demo, showing the engine we have achieved so far - there is much more to add and many more updates left to come so stay tuned!