race game project
just some personal in between project to test out new ideas booth technically and design wise. Because I am doing often work that is scattered over different territories such as scripting, modeling, texturing,... this is a thread that shows my progress in order to get inspired by others and perhaps to inspire people.
My first spark of idea was this technical drawing:
the idea is to have a engine that loads 3d mesh tiles and bends or transforms them along a spline path within the engine. That way the track can be:
- more smooth and natural
- consuming less memory booth bandwidth and RAM wise
- easier to compute some kind of rough clipping mechanic to sort out which objects are visible within the view and which not- because you can always only see a section of the spline you are on.
easier to model the 3d models of the road - because they are linear and will be bended within the engine.
then I started downloading the newest FlexSDK (free compiler to write Flash PLayer 10 stuff) and FlashDevelop (a free flash coding environment) and experimented with some of the new Flash Player 10 features such as triangle rendering and vector objects.
My first results looked very promising so I researched on games of the past that I liked to see how they did certain things. NFS came to my mind as its together with NFS2 my favorite NFS game.
I think that the average triangle count for each vehicle is roughly about 128 - 160 triangles.
So created some test subjects to see how it would do in my engine, Those models were:
But before I could use them I wrote some maxscript to write binary files into a custom file format that the flash engine can read (simplified triangulated + UV data)
its a nice workflow because I can select multiple objects, select a folder and then export them with a single click into that folder. Somewhat the same for importing - it creates a multi selection list of the files within a folder so that I can deselect some items and then update scene objects.
you can have a look at a
online demo the engine yourself:
http://www.renderhjs.net/bbs/polycount/raceEngine/dmo03/RaceEngine.swf
controls:
- mouse move = rotate / zoom camera
- mouse wheel = change resolution
- click = see wireframe + object screen clipping boxes
my next steps are to pin down the spline code so that I can display it already in the engine.
Replies
Is most of your work programmed from scratch or do you build upon and mod existing engines?
I've been doing some Actionscript programming in Flex and was wondering if you have any good resources (links, books, or otherwise) that you could point me towards.
As a kind of supplement to this question, I'd also like to know how smooth the transition is from AS2 to AS3, as i currently am..... Hmm.... "Competent" in AS2 but havent touched AS3 at all. Your stuff is inspiring me to try, but if it's like an epic time investment maybe I should stick to modelling for now...
I even planned on using it as a style, see:
It shows some technical and visual effects I want to try out- see if I can get them in real time working.
This project is much about nostalgia about what I have memories back when I played in my 2nd half of my childhood (dos, psx,..).
And mixed with that I want to focus on 80s and 90s elements such as cars, environments and atmosphere.
On the technical side I already got the spline path working (green = input vector path)
but I need to normalize it using equal distance vectors instead of the now eased ones.
all and each time a completely new engine from scratch, I don't like complicated, hyped frameworks that suggest to not think about how things are handled. It's a personal thing.
I wrote my last engine (no media available, not yet released for public) for a big commercial project and learned a lot from that one. It was a big mix of rendered sprites and realtime polygons which is why I also went more into 3dsmax maxscript development, its something I just like blending different territories with each other.
Resources: some time ago I was active at the flashkit.com board games community and I wrote some 3d related tutorials/ threads there:
- 80 lines 3d engine with texture mapping:
http://board.flashkit.com/board/showthread.php?t=778852
- curing colors tech thread:
http://board.flashkit.com/board/showthread.php?t=760371#17
- skewing/transforming triangles with mapping
http://board.flashkit.com/board/showthread.php?p=3818672#post3818672
- binary format exporting / reading
http://board.flashkit.com/board/showthread.php?t=759766
Other resources that I perhaps can recommend:
- kirupa 3d section
http://www.kirupa.com/developer/actionscript/3dindex.htm
and google image search I use it a lot to break down stuff I don't get number wise and instead study wireframe/ editor shots of other engines. It tells me often much more as some tech nut trying to explain me higher math stuff with just text.
well I know that you also know other languages and since AS3 is almost 99% identical with JavaScript because of the ECMA standard (and even pushing it faster as the consortium itself can) it should not be a to big step for your to try it out.
You have to deal with packages and class stucture but once used to it, it gives you also some advantages. My main reason to even continue with flash and switch to AS3 was speed - I dont care about anything else, as long as it executes 10x faster which it did back then.
Now with Flash Player 10 you have vector arrays (single type arrays with linear sequence and a possible fixed length) that boost the performance again and some simplified interface for rendering triangles with texture mapping.
I don't mind stripping here (show some technical background stuff) so if you guys want i can PM you the source Code (its not the big yet, like 3 classes for the rendering, 3 for the data handling and 2 handling the scene/ start). Its all work in progress but maybe you might learn something from it.
I would appreciate this very much. I haven't delved into any 3D AS3 programming at all yet, though I have picked up a couple of books that cover some simple examples. It would be great to see your working code.
Thanks for the links as well. I'll be sure to check them all out.
Also, your new concept looks sweet. I'm interested in seeing how much you can accomplish without Flash bogging down.
Thanks for the info bro. I think I might try AS3 out after all. The links seem quite useful. As for the differences between AS2 and 3, they actually make me more interested to try it out rather than shy away from it. I'm also very intrigued by an 80 line renderer... No initialisation or fucking around just getting the API to work...
About your source code, It would probably fall on deaf ears for me until I get a decent grip on AS3, but if you're really not fussed about showing it, I'll keep it somewhere til i can make sense of it.
In return if theres any little monkey tasks youd like help with you're welcome to contact me for them - if you feel my abilities might be beneficial to you. I understand if you prefer to do as much as you can yourself (as I do too) but consider this a gesture - I am quite grateful you took time to make such a detailed response.
So why haven't you made a fortune already? and start up your own AAA dev studio?
I'm definitely going to be studying your 80 line 3d engine to see how you do it because pv3d is complete overkill for what I'm doing.
Acidrain: I can PM you the source as well - its not big yet and probably easier to overlook. The most vital and important parts are the cam.get2d method and the rendering class that loops through the objects and faces to display the triangles, focus on those and you might be able to understand or learn from it.
That 80 line code thing is nice if you work for Flash Player 9 because of the affine texture mapping the code covers - but in Flash Player 10 its already included, besides that it does not feature perspective, instead it gets projected orthogonal (like iso views, because its easier to explain).
some update:
because I normalized the spline (a new spline with equal distances instead of eased different ones) I can really quick predict the position on the spline unit wise. This is important to later:
- transform meshes that need to be bended along the spline
- determine where objects are clipped
- position objects along the spline (transform linear X,Y,Z coordinates to aside spline X,Y,Z coordinates)
here is a online demo about it:
http://www.renderhjs.net/bbs/polycount/raceEngine/dmo04/RaceEngine.swf
controls:
- xMouse = defines position
- yMouse = defines draw distance
THIS GUY IS AWESOME
what can't you do?
That's awesome! congrats on finding a good job
Sure - that would be great. Thanks.
ps: are you planning on releasing a commercial product at some stage?
You rock man!
I remember some of your track and car low poly models - it would be nice at some point to compare those or use them as reference in the engine. Just to see how other styles and polycounts work out in the engine.
Other than that please some creative input every now and then
ok update:
I progressed wit the deforming stuff and the spline angle interpolation which can be witnessed in the same demo link from the last time:
http://www.renderhjs.net/bbs/polycount/raceEngine/dmo04/RaceEngine.swf
The smooth angle interpolation is responsible for the good results in the screenshot (sorry no demo of that yet). It basically linear interpolates between each corner of the path so that the transitions are smooth there and no hard changes occur.
I'll say the same thing as Racer445: if you want some help, I'd love to jump in.
Also, have you got something planned for the car physics yet ? That's not an easy topic, I've dabbled with it myself but didn't get far.
One thing - not sure if it's just that we have older (non-gaming machines) at work, but I tried your demo on both IE and FF , with both showing only the black screen and the numbers, before crashing the program.
It would be the ultimate if you could get this to run on more non-gaming spec machines. Think the issue may just be that either where I work has a fuck-ton of security patches/programs running or simply has a much older version of the flash player installed ( the latter more likely as we can't even update Acrobat without an IT bod logging in).
I'll try look Monday - can't wait to see some moving parts.
http://www.gamedev.net/community/forums/topic.asp?topic_id=470497
shouldn't be to hard, it incorporates all 4 wheels into the physics which is nice. At least I want to give it a try - if it does not work out there is always my imagination and some cheating.
will be FP 10 only but therefore I try to make it as speedy as possible - here at home I have just a old processor (single core) with 1.1 Ghz (~ 5 year old computer) and it runs at 12-17 fps which is good enough even though I plan tweaking more and more.
if it crashed for you it either means I programmed bad (but it worked fine everywhere I tested it) or that perhaps the flash player was not flash player 10, you really need that as I use some methods like Vector.<type> which are only available for the newest player.
But other than that it should not really crash , I even use a lower FPS setting (42 fps) and a focus check (switches engine on/off) to extremely minimize to freeze or hang up the system (unlike many other flash movies who use FPS / browser brute force methods to speed up their bad written actionscript).
Coming along ace though :O.
I'm using flash player 10 on a core2duo 2ghz on windows xp 64.
If i were to blame something, I'd blame windows. Hate this 64 bit thing. So unstable
what Flash Player you have (e.g 8, 9, 10) and perhaps how old your computer is. Because like I said if you have anything below FlashPlayer 10 its no wonder.
I wonder, did you ever finish that level/tile editor you were working on a while ago?
BTW It crashed for me as well. I'm using FP 10 , debug version. No messages debugger messages popped up. Firefox (3.5.2) just crashed before any loading was apparent. I suppose loading some asset or something from the web server. Vista64, core2 Quad, 4gig ram. All that is prolly irrelevant, except vista. Hope this data helps you out.
online demo:
http://www.renderhjs.net/bbs/polycount/raceEngine/dmo05/
controls:
- Xmouse move = move camera along spline
- Ymouse move = tilt camera
- click = switch debug mode true/false
- mouse wheel = change scale resolution (1-4)
I added some trees to see how it would handle several of them each with more complex polygons instead of just 2 crossed planes like many games (I think I will use planes though in the future, just faster). Also I played with some grass and bushes along the road with transparency and I think its a nice effect that does not eat much faces.
I think once LOD is build in I can even go further with the poly counts of each object, or display even more objects.
There is something about retro graphics with modern day gameplay that is just awesome. Imagine playing this with as realistic physics as in any of the gran turismos.
Proceed.
I have to admit i really hate your navigation though, that quirky X-Y mouse position camera movement drives me nuts. Do consider some decent mouse look and move controls, that way everybody can see your work in more detail.
demo:
http://www.renderhjs.net/bbs/polycount/raceEngine/dmo06_xxl/
strangely enough my 5 year old computer still handles it (5 fps or so, but still) no crashing, and as soon as I zoom in it runs again smooth
just as a sidenote: the face count in the output down left is the triangle face count that has already been culled, so expect about 2x the polycount of triangles of the models on screen per frame.
edit: your GFX card has nothing to do with performance, as the flash player pretty much does everything on the CPU. Many cores are supported and usually should boost things.
me2
is there any chance we see a maxscxript for that?
In max it might be possible with some path deform modifiers on each tile, and letting a maxscript loop over the objects so it puts each with a different offset.
next is to modify the binary file format I use to store multiple 3d models and implement the whole thing in the engine so that I can dynamically switch the LOD models depending on the objects center z-depth ray towards the camera.
The more far away the object gets the more it will switch to a smaller polygon resolution.
I plan on handling the LOD levels as editPoly modifiers so I don't get chaos with to many different objects. Each of those modifiers represents its own LOD model or level.
Additionally I could use this concept later for switchable meshes that unlike vertex animations change their shape more dramatically, liker perhaps some break lights (lens flare on/ off or destruction models in different stages (hmm I like that idea).