A Flash Developer Resource Site

Results 1 to 18 of 18

Thread: [speedtest] iso, slopes and not-tilebased tiles

  1. #1
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901

    [speedtest] iso, slopes and not-tilebased tiles

    hi folks,

    some of you might have seen my iso-engine while reading the tales frome the codefront blog

    i dumped the development of the engine for some weeks, but i had some time this weekend and started to optimize the code. although the result is somewhat dis-satisfying (rewrite 50 lines of code to gain 2ms) i think in the sum of it, it will be worth the efford.

    the other option to make the thing faster would be to either drop the second screen (the option i favor) or use another way to playback the "opponent" (currently the playback uses the same physics as the player, cause this results in way less data ... but this way a second calculation cycle is needed)

    to the demo
    instructions:
    press the record button, move the player with the cursor keys, use ctrl to jump
    at any time (or after the record-buffer is full) press stop, then "rew" and afterwards "play" - the sprite on the second screen should now move the way you did before.
    NOW move your (left screen) sprite again and have a look at the fps ...

    post them along with some machine stats (os/browser/mhz/ram)

    thanks in advance, <olli/>

    ps: as for the not-tilebased tiles ... well read the first posts on crystalis for a description ...

  2. #2
    leight.com.au leight's Avatar
    Join Date
    Sep 2002
    Location
    australia
    Posts
    1,437
    Dude, that's awesome You could make a Price of Persia: The Sands of Time replica - just put it in reverse

    The fps for the recorded one:
    - lowest fps: 17
    - highest fps: 22
    - average fps: 20

    Machine stats:
    - Broadband
    - Pentium 4 1.5ghz 128mb RAM
    - 6 MSN windows upen
    - 1 word
    - 1 outlook express
    - 1 iTunes
    - 2 Firefox

    I love it!!!
    Last edited by leight; 09-06-2004 at 06:53 AM.

  3. #3
    Senior Member MiSSenLinX's Avatar
    Join Date
    Jan 2003
    Location
    Perth, Australia
    Posts
    260
    truely nice engine,

    OMG WAS I IN THOSE MSN WINDOWS

  4. #4
    ism BlinkOk's Avatar
    Join Date
    Aug 2001
    Location
    , location, location
    Posts
    5,002
    22-23
    XP|2.8Ghz|2GB
    nice work ollie
    Graphics Attract, Motion Engages, Gameplay Addicts
    XP Pro | P4 2.8Ghz | 2Gb | 80Gb,40Gb | 128Mb DDR ATI Radeon 9800 Pro

  5. #5
    doItLikeThis
    Join Date
    Jan 2004
    Location
    :noitacoL
    Posts
    1,080
    Wow, nice engine ngfx, and I mean absoultly amzing. You even got replay....cool man!

    Win Me
    750Mhz pentium 3processor.
    128 mb ram
    Avg. 20 Fps
    -Aditya

  6. #6
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901
    thanks guys, keep 'em coming ...

    leight: they paid me an horrible amount of money not to ...

    adit_ya_sharma: oop is your friend here (ok in this case also your foe) i was quite lazy when i coded the replay function ...
    i just record the keystrokes (so there's a max of 3 values to store) and pass them to the "parseKeystroke" method - viola, done.

    it would have been by far faster to record screen and player postions, but this would have required another method for playback ...

    maybe this ends in a game ...

    <olli/>

  7. #7
    leight.com.au leight's Avatar
    Join Date
    Sep 2002
    Location
    australia
    Posts
    1,437
    i do suggest making this into a game. With the different slopes you could create a variety of games. Including iso platformer's with the POP:SOT function. Or you could have a partial level preview like on POP:SOT

    Even if you don't end up using that replay/fast forward function. you could always make a war game, with terrain now you have slopes!

    Many many options with a fantastic engine!

    Ok ok, I do love that game!

  8. #8
    Official Shoe Shiner thehumanchimp's Avatar
    Join Date
    Jul 2003
    Location
    London
    Posts
    953
    750K broadband
    Pentium 4
    5 Firefox (it was run in Firefox which i find is usually slower than IE)
    1 Word
    1 Outlook Express

    Highest: 18 (stationary)
    Lowest: 8 (going up the "hills")
    Average: 10-12 (generally moving about)
    Message on a gravestone: I finished before you in the human race.

    Using: Flash MX

  9. #9
    Senior Member St. Nick's Avatar
    Join Date
    Sep 2003
    Location
    Ontario, Canada
    Posts
    312
    IE6
    Pentium III 1 Ghz
    Broadband "Lite" that really only works like dial up

    Averaged about 21 fps for me, moving with replay on brought it down to 12 fps.

    Cool stuff man
    - St. Nick

  10. #10
    n00b yellowman's Avatar
    Join Date
    May 2002
    Location
    Sweden
    Posts
    163
    xp - ie6 - amd1400 - 512mb
    runs ~20 something fps.

    Looks smooth so far. Would be cool to see how it performs on a larger map, the current one seems a little limited for speedtesting. Or maybe it´s just me who can´t get any flow... I just keep hitting those edges

    Great work!
    /klas

  11. #11
    Senior Member
    Join Date
    Jul 2004
    Posts
    153
    hey,
    i don't suppose you want to share how you did that?

    specifically, the world graphics look pre-rendered.. are they?
    and if so, how did you generate the data used for collision?

    anyway.. cool stuff.

    thanks,
    raigan

  12. #12
    Senior Member dogtown08's Avatar
    Join Date
    Jul 2004
    Location
    In a later dimension
    Posts
    201
    To through my super slow (at flash) ibook g3 os 10.3 fps:

    Low: 8fps
    High: 16 fps

    Average ~12-14 fps

    Very nice. That may seem slow, but for something like this on my computer, it is quite fast

  13. #13
    Untitled-1.fla strille's Avatar
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    1,626
    Looks great!

    I got ~14 fps during playback and moving around (AMD 1400, Win XP, IE 6, some programs open).

    About recording keystrokes, the way I do it in Sylvaniah is to have each key correspond to 1 bit in a number. That way you only need to store an integer for the current key combination (an integer 0-255 if you have 8 keys to contol the game). It's not stored each frame, but only when the number changes. When it changes, you also store the number of frames the previous number lasted.

    Again, great work, looking forward to the complete game!

  14. #14
    Feeling adventurous? T1ger's Avatar
    Join Date
    Mar 2004
    Posts
    850
    Originally posted by strille
    Looks great!

    I got ~14 fps during playback and moving around (AMD 1400, Win XP, IE 6, some programs open).

    About recording keystrokes, the way I do it in Sylvaniah is to have each key correspond to 1 bit in a number. That way you only need to store an integer for the current key combination (an integer 0-255 if you have 8 keys to contol the game). It's not stored each frame, but only when the number changes. When it changes, you also store the number of frames the previous number lasted.

    Again, great work, looking forward to the complete game!
    That's a really smart method for recording.. But how do you determine which buttons were pressed? subtract each value, starting from the highest, and check if the value is greater or equals zero? i think that would do the trick... But how are you doing it?

    The game is great. well, "game" :P

    But I can't see why a second screen is necessary? Why dont you just view the recordings on the same screen?

    Stats:
    Opera (really slow with flash) (latest v.)
    flash mx04, photoshop, notepad, winamp, ftp-server, web-server, aim and msn-messenger running in the background.
    avg. fps while playing and playing: 22

  15. #15
    Untitled-2.fla
    Join Date
    Jul 2002
    Posts
    391
    nGFX Nice work - I played this a while ago after seeing your blog, 22-23 fps XP|2.8Ghz|2GB, sorry for posting a whole load of code (below), but it may be useful to others

    strille Is your compression anything like this?:

    Code:
    var ticks :Number = 0
    var kU		:Number = Key.UP
    var kD		:Number = Key.DOWN
    var kL		:Number = Key.LEFT
    var kR		:Number = Key.RIGHT
    var lCombo	:String = undefined
    var recording	:Array  = new Array
    var lTicks	:Number = 0
    var dTicks	:Number
    
    onEnterFrame = function () :Void {
    	var combo = new String
    	// push either 0 or 1 into the combo string, and handle in-game events 
    	combo += Number (Key.isDown ( kU ) )
    	combo += Number (Key.isDown ( kD ) )
    	combo += Number (Key.isDown ( kL ) )
    	combo += Number (Key.isDown ( kR ) )
    	// compress the combo
    	combo  = parseInt( combo, 2 ).toString( 36 );
    	// is the new combo different from the previous?
    	// if so store the tick difference, last ticks, and the combo
    	if (combo != lCombo) {
    		dTicks	= ticks - lTicks
    		lCombo	= combo
    		lTicks	= ticks		
    		recording.push ( String (dTicks + combo) )
    	}		
    	// increase the ticks / frame count
    	ticks++
    }
    
    // just for testing
    var kListener		= new Object ()
    kListener.onKeyDown	= function ()  {	
    	if ( Key.getCode () == Key.SPACE ) {
    		trace ( 'full recording:\n' + recording.join ( ',' ) )
    		// initial ticks is 0, unless specified
    		var ticks 	= 0
    		var i		= -1
    		// loop throught the recording
    		while (++i < recording.length) {
    			// the length of the recording code
    			var len	= recording[ i ].length - 1
    			// tick difference is the all the recording code led the last character			
    			var tickDif	= Number ( recording[ i ].substr( 0, len ) )
    			// key code is the last character
    			var code	= recording[ i ].charAt ( len )		
    			// 'undo' the bit compression
    			var code 	= parseInt( code , 36 ).toString( 2 )
    			// add '0's to the start to pad the code if necessary
    			while ( code.length < 4 ) code = '0' + code
    			// add the stored tick difference
    			ticks      += tickDif
    			// test trace
    			trace ( 'ticks: ' + ticks + ' > combo: ' + code + ' compressed version: ' + recording[ i ] )	
    		}
    	}	
    }
    
    Key.addListener( kListener )
    Mike

  16. #16
    383,890,620 polygons nGFX's Avatar
    Join Date
    Oct 2002
    Location
    Germany / Ruhrgebiet
    Posts
    901
    wow, this means a long answer ... ok ...

    jtnw:
    non-tilebased may be the wrong word, there are tiles in it, the difference is, that the tiles don't have the same size. so "irregular tiles" would be better.

    yellowman:
    in the final "game" you would fall of the edges ...
    to the larger maps: np, the version that i have here and work with uses a VERY large map (about 500x600 "regular tiles") but with the irregular tiles there are a maximum of 30 tiles visible at one time. so if one tile disapears from the screen it is marked and reused when needed. (no attaching / removing)

    metanet:
    nope, sorry, not atm ...

    strille:
    yep, a way more practical way, but i was soooo lazy when i wrote the replay code ...
    atm i store just 3 letters :"xyj", where x is "u" or "d", y is "l" or "r" and j " " or "j". cause you can't use up and down key at the same time

    T1ger:
    never said it's agame, didn't i?
    oh, the second screen, as i started the "game", i wanted it to be multiplayer, either by playing against a recorded opponent or "one on one" using a socket connection. for speed reasons i think i have to drop the multiplayer idea 'till mm releases v10 of flash. i also thought about using the same screen for the playback, but this way you don't have the "feeling" of playing against someone else.

    token 3:
    nice piece of code ...

    <olli/>

  17. #17
    Untitled-1.fla strille's Avatar
    Join Date
    Mar 2001
    Location
    Sweden
    Posts
    1,626
    token 3:

    Yes, it's similar to yours. You can use the bits in an integer as switches though to tell if a key is pressed or not. Let's take a 4 bit integer, like 9. It looks like this in binary:

    1001

    Each bit represents a key being pressed or not. Let's say that they represent the keys up, down, left and right in that order. So, in this case (9), the up key and the right key is pressed.

    All 4 keys pressed would give a number of 15, no keys a value of 0.

    Start with a value of 0. If up key is pressed you add 2^3 = 8, if down is pressed you add 2^2 = 4, if left is pressed you add 2^1 = 2 and if right key is pressed 2^0 = 1.

    To find out if up key is pressed or not, you can type:
    code:

    if (combo & 8) {
    // up key pressed
    }


  18. #18
    =========== io3's Avatar
    Join Date
    Dec 2003
    Location
    Reality: what a concept !
    Posts
    109
    (os/browser/mhz/ram)
    w2k/ie6/p3 1GHz/400 mb and a few other apps open.

    fps: varied from 13fps to 21fps but most commonly 15-17fps.
    Looking for something different? Check out Tuti TV at http://www.tuti.tv/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  




Click Here to Expand Forum to Full Width

HTML5 Development Center