tag:blogger.com,1999:blog-146376222024-03-13T14:49:13.628+00:00Flash RacerA project to produce a racing game in flash including advanced physics, handling, 3d graphics and real life tracks.Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.comBlogger12125tag:blogger.com,1999:blog-14637622.post-1149261466773213802006-06-02T15:07:00.000+00:002006-06-02T15:25:09.473+00:00Hyperplanes, Normals & VectorsLot'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.<br /><br /><br />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 <a href="http://www.harveycartel.org/metanet/tutorials/tutorialA.html">Metanet </a>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...<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5844/479/1600/trackeditor.0.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/5844/479/400/trackeditor.png" alt="" border="0" /></a><br />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)<br /><br /><br />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...Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com0tag:blogger.com,1999:blog-14637622.post-1146224378573592182006-04-28T11:36:00.000+00:002006-04-28T11:39:38.586+00:00StatusHey all,<br /><br />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!<br /><br />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.<br /><br />Hopefully, the next post will be sooner rather than later!<br /><br />Tom.Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com2tag:blogger.com,1999:blog-14637622.post-1140622416112019992006-02-22T15:26:00.000+00:002006-02-22T15:33:36.136+00:00Through the keyholeWhat 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 ;-)<br /><br /><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5844/479/1600/meatspace-desktop.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/5844/479/320/meatspace-desktop.jpg" alt="" border="0" /></a>Jon<br /></div><div style="text-align: center;"><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5844/479/1600/IMG_2777.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/5844/479/320/IMG_2777.jpg" alt="" border="0" /></a>Tom<br /></div>Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com2tag:blogger.com,1999:blog-14637622.post-1139233988901912972006-02-06T13:20:00.000+00:002006-02-06T14:43:54.563+00:00Solid GeometryWell,<br /><br />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.<br /><br />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 <a href="http://obj.suburbandesigns.com/game/">kirill mourzenko</a> several years ago, and i used a less advanced version in my earlier (unfinished) game <a href="http://www.moor47.fsnet.co.uk/felony/">Felony</a> (on which Jon helped with the physics, and is actually how we hooked up for this game!)<br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">Faking It</span></span><br /><br />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.<br /><br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5844/479/1600/blog1.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/5844/479/320/blog1.jpg" alt="" border="0" /></a><br />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!<br /><br />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!<br /><br /><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5844/479/1600/blogWall.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/5844/479/320/blogWall.png" alt="" border="0" /></a><br />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.<br /><br /><div align="center"><br /><OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" id="engine_oop" ALIGN="center"><br /> <PARAM NAME=movie VALUE="http://flashracer.atspace.com/wallAnim.swf"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="http://flashracer.atspace.com/wallAnim.swf" quality=high bgcolor=#FFFFFF NAME="engine_oop" ALIGN="center" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED><br /></OBJECT><br /></div><br /><br />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?<br /><br /><br /><span style="font-weight: bold;font-size:130%;" >Pseudo Speed<br /><br /></span>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...<br /><br />Any questions? Just leave a comment! Extra points if you can work out the cryptic title ;-)Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com5tag:blogger.com,1999:blog-14637622.post-1138045012203898192006-01-23T18:32:00.000+00:002006-01-23T19:55:43.543+00:00Tech 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...<br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">Current Features</span></span><br />- Different surfaces affect handling<br />- All game data loaded from external XML files<br />- Accurate collision detection<br />- AI with up to 6 cars on track<br />- HUD including lap times / lap counter and race positions<br />- Dynamic camera, that can swap between racers<br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">Future Features</span></span><br />- More tracks<br />- Larger tracks<br />- Accurate collision response<br />- Solid & Tire Walls<br />- 3D Structures<br />- More advanced AI with more varied racing lines<br />- Career mode, saving of all race data / lap times etc<br />- Graphics options for slower computers<br />- Cheats<br />- Sound<br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">Known Issues</span></span><br />- You can drive off the map<br />- Collision response not finished<br /><br /><br /><span style="font-weight: bold;font-size:130%;" >We Need You</span><br /><br />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:<br /><ul><li>CPU speed</li><li>Flash player version</li><li>frames per second ( top-right corner ) - min/max/average would be great!</li><br /></ul><span style="font-size:130%;"><span style="font-weight: bold;">Enough Babble, I Want To Play!</span></span><br /><br />You can <a href="http://www.bitfink.com/flashracer/">play the flashracer tech demo</a> using the following controls...<br /><br /><span style="font-weight: bold;">Keys:</span><br /><span style="font-style: italic;">UP arrow</span> - Accelerate<br /><span style="font-style: italic;">DOWN arrow</span> - Brake<br /><span style="font-style: italic;">LEFT and RIGHT</span> arrows - Steering<br /><span style="font-style: italic;">SPACE bar</span> - Handbrake<br /><span style="font-style: italic;">1 - 4 numbers</span> - Change camera view to other cars<br /><br /><br /><span style="font-size:130%;"><span style="font-weight: bold;">The Sexy Temporary Graphics</span></span><br /><br /><div style="text-align: center;"><img src="http://www.bitfink.com/flashracer/screenshot-01.jpg" width="400" height="400" /><br /></div><div style="text-align: center;"><span style="font-size:85%;">(Jon getting beats by the computer)</span><br /></div><br /><span style="font-size:130%;"><span style="font-weight: bold;">Finally...</span></span><br /><br />Enjoy the demo, let us know what you think in the comments for this post or on the <a href="http://www.flashkit.com/board/showthread.php?p=3521353">flashkit thread which can be found here</a>. 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!Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com4tag:blogger.com,1999:blog-14637622.post-1133212524005878042005-11-28T21:11:00.000+00:002005-11-28T21:20:41.836+00:00XML Fun!So,<br /><br />Its been a while! What have i been upto you may ask, well apart from shifting my life around the country i have been wrapping up our lovely engine into a more presentable game.<br /><br />As with most of the information in the game we have decided to keep all the menu info in an external XML file, this allows for ease of editing, flexibility and hopefully reusability in any future projects we undertake. An example of the menu XML for the tech demo:<br /><br /><menus><br /><menu><br /><title>Main</title><br /><orientation>horizontal</orientation><br /><x>225</x><br /><y>200</y><br /><spacing>10</spacing><br /><option><br /><text>Start Beta</text><br /><func>startBeta</func><br /><param></param><br /></option><br /><option><br /><text>Credits</text><br /><func>gotoMenu</func><br /><param>Credits</param><br /></option><br /></menu><br /></menus><br /><br />This is parsed and converted to an object structure as the game is displaying the loading screen. The menus are then created on the fly in the right positions and orientations, displaying the right text! When a button is pressed it then calls the appropriate function within the MenuManager Class and passes the appropriate parameters. I have also been working on a new class called HUDManager, this retrieves all the current information about the race (for example, lap times, positions etc) and displays it on the screen... At the moment this is all done in text format but that will be replaced with some flashy graphics in a later release..<br /><br />In other news we have been largly bug fixing since the last post, Jon is still working on the broken collision response while i have been tidying up code all over the game in order to get it ready to show you all! Thanks for the support - keep checking back (or subscribe to our Atom feed!) - were getting closer!Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com0tag:blogger.com,1999:blog-14637622.post-1125441154550938862005-08-30T22:23:00.000+00:002005-08-30T22:48:29.900+00:00All That JazzThe project has been moving forward quickly since we started working using the <a href="http://www.cvsdude.com/">SVN system</a>, having a central store of the games code that both of us can work from has been invaluable.<br /><br />Since the last update I have been working on the file manager almost exclusively. Early on we decided that most of the games resources should be kept in external files for easy editing and loaded into the game engine on runtime. This includes things like; race, track and car data aswell as all the in game graphics (which are stored in external SWFs)... All of these files need to be loaded and parsed correctly so that the data is accessible within the game. This is now almost entirely finished.<br /><br />I have also done a large clear up aswell as adding some small features like 'pause' and a countdown on the grid at the beginning of a race.<br /><br />We are hoping to post a 'tech demo' of the game on here fairly soon, which is guaranteed to impress, so keep checking back!Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com2tag:blogger.com,1999:blog-14637622.post-1123891645625650732005-08-12T23:50:00.000+00:002005-08-13T00:08:18.000+00:00Back of the ClassIt seems like a long time since i last updated here... i have spent a lot of time on the engine today, mainly organising code and class structure after a lengthy discussion with Jon last night. We have decided on a system of 'Manager' classes to keep the code in order, the main one's being:<br /><br /><span style="font-weight: bold;">PlayerManager<br /><br /></span>keeps track of players career status and track records<br /><br /><span style="font-weight: bold;"></span><span style="font-weight: bold;">RaceManager<br /><br /></span>holds information only for the current race and functions for starting / stopping / pausing<br /><br /><span style="font-weight: bold;"></span><span style="font-weight: bold;">SoundManager<br /><br /></span>loading, starting, stopping and deletion of all the sounds within the game<span style="font-weight: bold;"><br /><br /></span><span style="font-weight: bold;">FileManager<br /><br /></span>loading and saving of track, player and tileset data<br /><br /><br />Im hoping to post more technical details here over the coming weeks, aswell as hopefully some interesting code and in depth theory!<br /><br /><span style="font-weight: bold;"></span>Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com0tag:blogger.com,1999:blog-14637622.post-1122507446405501982005-07-27T23:27:00.000+00:002005-07-27T23:37:26.410+00:00Artificial Intelligence UpdateI've been hard at work on this the past few days. As my part of the engine now stands the AI car races around the track with ease, braking at the appropriate places - it also has the ability to recover after an accident.<br /><br />Elsewhere, i have corrected a few bugs that were causing problems on certain shapes of corner and in the process simplified some of the calculations. I have also added a handbrake to the physics model, allowing you to perform handbrake turns!<br /><br />I will try and post a demo (recorded or realtime) here in the next week.Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com0tag:blogger.com,1999:blog-14637622.post-1122122866707611532005-07-23T12:40:00.000+00:002005-07-23T12:47:46.713+00:00Artificial Intelligence<a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://photos1.blogger.com/blogger/5844/479/1600/ai_screen.jpg"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://photos1.blogger.com/blogger/5844/479/320/ai_screen.jpg" alt="" border="0" /></a><br />Over the past couple of nights i have been working on a basic AI, the aim for this is simply to get the car to drive around the track, when this is complete it will be advanced with braking etc. I also hope to add the ability to avoid other vehicles and recover from any accidents...<br /><br />This screen shows the current engine with debugging lines displayed, the car works out the trajectory to the next 'waypoint' (which are poistioned at critical points around the track) and adjusts its steering accordingly.Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com0tag:blogger.com,1999:blog-14637622.post-1121901007935306422005-07-20T23:04:00.000+00:002005-07-20T23:15:28.156+00:00ProgressI thought i had better let you know the progress so far, as this blog has been started a few weeks into the project.<br /><br />Me and Jon started chucking ideas around a couple of weeks back and working on a design document with features we hope to implement (this will later be expanded into how!) We decided to tackle what appeared to be the most difficult sections first, so jonmack began work on a collision detection and response system (for both rigid bodies and the track) which i hope he will post about here soon and i began to develop the car handling, camera and a basic AI model.<br /><br />As the project currently stands the collision detection and response are both semi complete, although not quite 'solid' enough yet, the camera is complete, a handling model is implemented and i have just started the AI this evening!<br /><br />Phew.<br /><br />I should update more specific details on the AI tomorrow...Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com0tag:blogger.com,1999:blog-14637622.post-1121807964662607542005-07-19T22:29:00.000+00:002005-07-19T21:30:25.683+00:00Welcome!Welcome to the racer blog, the basic idea is to document the development of a game from start to finish, with all the problems and success' that we encounter along the way! Hopefully these pages will be updated fairly regularly...<br /><br />T.Tomhttp://www.blogger.com/profile/06507238110837216204noreply@blogger.com0