Home 3D Art Showcase & Critiques

flash/ maxscript / 3d: race game project

1
sublime tool
Offline / Send Message
renderhjs sublime tool
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:
race_engine_concept_01.jpg
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.
nfs_reference.jpg
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:
porsche_turbo.jpg
pc_lowpoly_ferrari_gto_1984_01.jpg

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)
rE_maxscript_workflow_01.gif
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

  • nrek
    Options
    Offline / Send Message
    nrek polycounter lvl 14
    Dude Render you are a beast! I love this project. The cars, track and everything look great in the demo swf. Cant wait to see more.
  • Harry
    Options
    Offline / Send Message
    Harry polycounter lvl 13
    I seriously love the way it looks at 1/2 resolution.
  • Yngram
    Options
    Offline / Send Message
    Yngram polycounter lvl 8
    The models/textures look good for such low specs. You're a Flash wizard.

    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.
  • Harry
    Options
    Offline / Send Message
    Harry polycounter lvl 13
    Yngram wrote: »
    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...
  • DrillerKiller
    Options
    Offline / Send Message
    DrillerKiller polycounter lvl 11
    It is true, you do rock.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    Harry wrote: »
    I seriously love the way it looks at 1/2 resolution.
    so do I, and because of the reduced resolution it even runs smooth on a 1.1 Ghz computer here.
    I even planned on using it as a style, see:
    racegame_visual_concept.jpg
    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.
    racegame_mood_board_1.jpg

    On the technical side I already got the spline path working (green = input vector path)
    racegame_spline_path_generation.gif
    but I need to normalize it using equal distance vectors instead of the now eased ones.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    hmm seems more people responded o_O
    Yngram wrote: »
    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.
    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.
    Harry wrote: »
    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.....
    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.
  • Yngram
    Options
    Offline / Send Message
    Yngram polycounter lvl 8
    renderhjs wrote:
    I don't mind stripping here (show some technical background stuff) so if you guys want i can PM you the source Code...

    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.
  • JasonLavoie
    Options
    Offline / Send Message
    JasonLavoie polycounter lvl 18
    Render you're crazy man, I always look forward to your new projects :) Looking forward to the progression, weop!
  • Frump
    Options
    Offline / Send Message
    Frump polycounter lvl 12
    This is awesome. I can't wait to see how the spline track system works out and then do some racing. I really like the nostalgia filter. Cool idea.
  • Harry
    Options
    Offline / Send Message
    Harry polycounter lvl 13
    renderhjs wrote: »
    hmm seems more people responded o_O
    <heaps of cool stuff>

    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.
  • Ben Apuna
    Options
    Offline / Send Message
    renderhjs it's really awesome to see you pushing the tech as far as it can go. It's even cooler because you share your progress, experiences, and thought process right here on Polycount for all to see and learn from. Thank you very much :)

    So why haven't you made a fortune already? and start up your own AAA dev studio? ;)
  • acidrain
    Options
    Offline / Send Message
    This is incredible. I've been playing with AS3 and PaperVision3D at work and I just thought there had to be a better way. A simple app that renders 12 planes which swivel along the Y-axis ended up compiling to over a megabyte because of all that extra library junk. Not to mention it had my CPU pegged at ~60% the whole time.

    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.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    Ben Apuna wrote: »
    ...So why haven't you made a fortune already? and start up your own AAA dev studio? ;)
    I got myself a nice job and about to move soon :)

    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:
    racegame_spline_prediction.gif
    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
  • rasmus
    Options
    Offline / Send Message
    yer a beast indeed, render. keep it up.
  • Harry
    Options
    Offline / Send Message
    Harry polycounter lvl 13
  • Pedro Amorim
    Options
    Offline / Send Message
    fucking hell man!
    what can't you do?
  • Ben Apuna
    Options
    Offline / Send Message
    renderhjs wrote: »
    I got myself a nice job and about to move soon :)
    ...

    That's awesome! congrats on finding a good job :)
  • Minos
    Options
    Offline / Send Message
    Minos polycounter lvl 16
    Nice stuff, I like where this is going =)
  • SimonT
    Options
    Offline / Send Message
    SimonT interpolator
    This is cool. I hadn't time to read all your text but watching the demos is fun. I hope i can drive with the cars soon :D
  • acidrain
    Options
    Offline / Send Message
    renderhjs wrote: »
    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.

    Sure - that would be great. Thanks.
  • okno
    Options
    Offline / Send Message
    This looks really good. Can't wait to see more.
  • System
    Options
    Offline / Send Message
    System admin
    Nice work man, making a game engine is something I would love to do. I'm sure it won't be long before your swimming in the cash you deserve, maybe you are already!

    ps: are you planning on releasing a commercial product at some stage?
  • Racer445
    Options
    Offline / Send Message
    Racer445 polycounter lvl 12
    Let me know if you need any help with this, it looks rather awesome.
  • vladino
    Options
    Offline / Send Message
    vladino polycounter lvl 15
    I would pay for game like this! I love the retro nfs like look! Can't wait to play this game ;)

    You rock man!
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    GCMP wrote: »
    ps: are you planning on releasing a commercial product at some stage?
    na not me, maybe the company that wants to hire me. This is just exercise and fun for me.
    Racer445 wrote: »
    Let me know if you need any help with this, it looks rather awesome.
    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:
    racegame_path_deforming.gif
    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.
  • SimonT
    Options
    Offline / Send Message
    SimonT interpolator
    Can't wait so see more!
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    Wow, this is like the first time ever that I see somebody who has the same kind of nostalgic love for those racing games from the 90's. That moodboard perfectly captures it, I just love seeing that.
    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.
  • JohnnySix
    Options
    Offline / Send Message
    JohnnySix polycounter lvl 16
    This looks fantastic, speaking as someone who's spent the last 6 months playing flatout on PSP, can't wait to see where you go with this. :D

    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. :D
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    Xoliul wrote: »
    ...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.
    a conversion to AS3 from this:
    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.


    JohnnySix wrote: »
    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).,,
    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).
  • Muzzoid
    Options
    Offline / Send Message
    Muzzoid polycounter lvl 10
    I remember that thesplash and his firend had your thing crash both their browsers, so that could be a problem.

    Coming along ace though :O.
  • Bruno Afonseca
    The race engine dmo3 totally crashes my browsers (opera and firefox). the other one works fine.

    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
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    next time a crash occour could you guys tell me,
    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.
  • Harito
    Options
    Offline / Send Message
    Damn it, always with the cool innovative projects. Looks great!

    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.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    update:
    racegame_path_deforming_prt2.gif

    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.
  • SimonT
    Options
    Offline / Send Message
    SimonT interpolator
    you are just crazy! amazing work!
  • Muzzoid
    Options
    Offline / Send Message
    Muzzoid polycounter lvl 10
    Coming along really nicely!

    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.
  • MoP
    Options
    Offline / Send Message
    MoP polycounter lvl 18
    that's simply awesome.
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    Looking better again.
    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.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    he he thats because I hacked everything together to get some proof of concept. Once I get those damn 3d matrix things done right I will add some better navigation using cursor keys.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    and for all the ones with better hardware, here is a demo with a multiplier of 4x (moaar objects)
    demo:
    http://www.renderhjs.net/bbs/polycount/raceEngine/dmo06_xxl/

    racegame_path_deforming_prt2_xxl.gif
    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.
  • ZacD
    Options
    Offline / Send Message
    ZacD ngon master
    Needs motion blur :P
  • Xoliul
    Options
    Offline / Send Message
    Xoliul polycounter lvl 14
    RenderHJS, I fear you might have to do something about performance, since that high detail demo runs at 6FPS in the worst cases on my Quad core with Geforce 280GTX :p
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    well I am not yet at my end with optimizing + you can always reduce the resolution which will often add another 5 - 8 fps at least here. But the last demo is unrealistic,- way to many cars and no LOD models,- so it is pretty much brute force in terms of triangles.

    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.
  • kio
    Options
    Offline / Send Message
    kio polycounter lvl 15
    mh my firefox crashes very quickly when I click on the link :(
  • aesir
    Options
    Offline / Send Message
    aesir polycounter lvl 18
    kio wrote: »
    mh my firefox crashes very quickly when I click on the link :(

    me2
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    happened to another person yesterday as well - after a few tries it worked somehow later,- maybe the preloader has a bug, will check that out - because in that case the engine might try to loop through null defined objects.
  • arrangemonk
    Options
    Offline / Send Message
    arrangemonk polycounter lvl 15
    that normalized spine deform was great for racetrack design in max too
    is there any chance we see a maxscxript for that?
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    not within this project,- the idea here is to use a tile level design concept (build the level linear and let the engine deform it).
    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.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    LOD modeling test
    LOD_ferrari_models.gif

    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).
1
Sign In or Register to comment.