A Flash Developer Resource Site

Page 1 of 2 12 LastLast
Results 1 to 20 of 32

Thread: Your longest Script...

  1. #1
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747

    Your longest Script...

    So ive been coding my latest project 'felony', and i realised its getting quite big - over 1200 lines of code so far...

    I was wondering what is the most coding other people have had to do for a game and can you post the game up?

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  2. #2
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    Not my longest - but my nicest idea and posibly best coded is the rumour engine i'm doing, it's very small for what you get out of it!

    http://www.mastersystem.org/projects/rumour/rumour.html
    (not coded well to some people of course):

    Code:
    ///////////////////////////////////////////////////////////////
    ///////////////////////////////////////////////////////////////
    // Set number of characters
    _global.char = 5;
    // Set the max distance to activate chat
    _global.chatDist = 50;
    // Set rumour 1=kill, 3=stab, 2=slap,
    _global.rumour = 1;
    // Set badness level of the rumour!
    rumourProp = [5, 3, 1];
    // Resting time after walk in ms
    _global.restTime = 0;
    // Set character speed
    _global.speed = 1;
    speed = 1;
    /////////////////////////////////////////////////////////////////
    /////////////////////////////////////////////////////////////////
    // Add the characters
    function addchars(num) {
    	for (i=1; i<=num; i++) {
    		rand = random(5);
    		// Set random character positions
    		randX = random(530);
    		randY = random(300)+20;
    		// Job array
    		job = ['Warrior', 'Wizard', 'Apprentice', 'Witch', 'Goblin'];
    		// Set level of anger/influence by Job
    		angLev = [4, 3, 2, 3, 1];
    		// Attach the characters and specify properties & x/y position
    		t = attachMovie("hero", "hero"+i, d++);
    		t._x = t.x=randX;
    		t._y = t.y=randY;
    		t.rest = restTime;
    		t.speed = speed;
    		t.player = i;
    		t.dist = null;
    		t.talking = null;
    		// Assign the characters job
    		t.job = job[rand];
    		// Set the anger level
    		t.anger = angLev[rand];
    		//
    		for (j=1; j<=num; j++) {
    			// Set hatred level 50 = neutral 100 = Good friends - (friend or foe)
    			t["p"+j] = new object();
    			t["p"+j].hatred = 50;
    		}
    		//
    		//
    		///////////////
    		// Set the rumour
    		// Initiate the first movement function for each clip
    		moveChar(t);
    		// Set first movment property to start learning
    		t.moved = true;
    	}
    }
    addChars(char);
    //
    function getJobs(num) {
    	for (i=1; i<=num; i++) {
    		j = _root["hero"+i];
    		info = "P"+i+" is a "+j.job+"\n"+info;
    	}
    }
    getJobs(char);
    //
    function moveChar(clip) {
    	clip.talking = false;
    	clip.xWalk = true;
    	clip.yWalk = true;
    	clip.walking = true;
    	clip.x = random(530);
    	clip.y = random(300)+20;
    }
    // Find the distance between the clips
    function getDistance(clip) {
    	tempStor = 5000;
    	for (i=1; i<=char; i++) {
    		t = _root["hero"+i];
    		if (i != clip.player && t.walking == false) {
    			var delX = clip.x-t.x;
    			var delY = clip.y-t.y;
    			b = int(clip.dist[i]=Math.sqrt((delX*delX)+(delY*delY)));
    			if (b<tempStor) {
    				tempStor = b;
    				numb = i;
    			}
    		}
    	}
    	if (tempStor<chatDist && _root["hero"+numb].talking != true) {
    		clip.talking = true;
    		j = clip.player;
    		if (clip["p"+numb].hatred<100) {
    			clip["p"+numb].hatred += clip.anger;
    		}
    		if (clip["p"+numb].hatred>100) {
    			clip["p"+numb].hatred = 100;
    		}
    		if (_root["hero"+numb]["p"+j].hatred<100) {
    			_root["hero"+numb]["p"+j].hatred += _root["hero"+numb].anger;
    		}
    		if (_root["hero"+numb]["p"+j].hatred>100) {
    			_root["hero"+numb]["p"+j].hatred = 100;
    		}
    		_root["hero"+numb].talking = true;
    		info = "P"+clip.player+" chats to P"+numb+" and likes him/her "+clip["p"+numb].hatred+"%\n"+info;
    	}
    }

  3. #3
    w00t io::pred's Avatar
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    163
    Little Soldiers: (sure its not a script, but its the entire code in one frame, so no MC's have stop commands or anything)

    http://members.optushome.com.au/chri.../soldiers.html

    1607 lines of code for the game.

    There a stack more for the menu/password system.

  4. #4
    Senior Member
    Join Date
    Jun 2002
    Location
    Manchester, UK
    Posts
    2,357
    gotta love that game

  5. #5
    Timetravelling Superhero AJ Infinity's Avatar
    Join Date
    Oct 2002
    Location
    The Realms of Infinity
    Posts
    203
    I've never gotten beyond 2000.
    From here to infinity,
    A J I N F I N I T Y

  6. #6
    SaphuA SaphuA's Avatar
    Join Date
    Oct 2002
    Location
    The Netherlands
    Posts
    2,182

    :)

    Haha

    For my ISO game I currently have about 300 lines

    Almost all the code is in frame 1 in different layers... also no MC on stage...

    But dude... 1500 linez... weh

  7. #7
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    I thought I'd have a quick count up of some current projects:

    X: ( Asteroids Clone )
    Rock Handler: 551
    Baddie Handler: 632
    Player: 631

    1814. ( Doesn't include frontend, preloader, functions, prototypes etc. )

    MJ-12: ( Space Invaders )
    Baddie Handler: 515
    Player: 592
    Functions: 189

    1296. ( Again no intro / outro code )

    Ionic: ( Scroller / blaster. My baby )
    Baddie Handler: 1122
    Player: 555
    Door and Object handlers: 329
    Scroller engine: 492

    2498.

    I'm quite heavy with my comments though and I do like to use a bit of white space.

    Squize.

    PS. Hey pred nice to see you back mate

  8. #8
    Timetravelling Superhero AJ Infinity's Avatar
    Join Date
    Oct 2002
    Location
    The Realms of Infinity
    Posts
    203
    The reason my games (I know I haven't uploaded them but I don't have a website yet ) use so many lines of code is because of

    !. Comments...if I die, I want someone to finish my games for me so I comment the code. Plus if I ever opensource my games the comments would help people to understand my code. Plus when I comment out lines of code like
    PHP Code:
    /* Uncomment this code to turn on lightmap loading and rendering
    myLightMap= new LightMap(); myLightMap.loadMap(game.defaultLightmap);
    myLightMap.renderLightMap();
    */ 
    2. Long AI, pathfinding, or iso implementations.
    From here to infinity,
    A J I N F I N I T Y

  9. #9
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    Yea, i should definatly comment my code more. Is there anywhere that shows good examples of commenting your code? I generally just put something like:

    code:

    // AI stuff



    which is, err.. awfull. I think those 'open source' things in my sig might not have any comments in - which is annoying... Sometimes you just get carried away in the code... *cough* geek *cough*

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  10. #10
    w00t io::pred's Avatar
    Join Date
    Mar 2003
    Location
    Sydney, Australia
    Posts
    163
    I am clinically insane, so I dont comment at all, except if I'm giving someone an example of something..

    More projects:

    RocketMan : 1080 lines of uncommented code for rocketman, 800-1000 lines of semi-commented and whitespaced code for each of the 4 big levels. and 250 lines for the boss levels..

    Hits almost 7k... Jeesus...

    My last pathfinding code: 162... (how elegant =)

    Drift (My Car Game): 600 for the player/scrolling, 200 for the level parsing and creating.. 552 for the AI... 1352 all up.

    Sped (My first platformer/tilebased game): 480 for the player, 259 for the scrolling. And about 150 for each of the 11 enemies..

    My New Platformer (Paralax scrolling etc.): 700 lines, including map drawing/scrolling/player

    Its funny to look back however, because you really do get alot better at doing things more elegantly when you code more often. (259 lines for the scrolling in Sped, to about 150 in my latest [however I the latest has been modified to handle infinite layers, so its a bit beastly])..

  11. #11
    Senior Member RazoRmedia's Avatar
    Join Date
    Oct 2000
    Location
    UK
    Posts
    3,016
    Living the dream

  12. #12
    Senior Member
    Join Date
    Oct 2001
    Location
    Belgium
    Posts
    467
    If a half life Mod counts...

    About 15000 Lines I think ;-)

    In flash... 14?

  13. #13
    the RPG i was working on was 3526 lines of code. But i just scrapped it to start over on a more inovative one. Clean up the code a little bit and make it better with more options. It was Codename: Runeblade and i had a site with art and stuff but my host (brinkster) doesnt allow any bandwith for it anymore so after one view it says i have exeaded my limit... so i would post a link so ya'all remember what it was but it would be a waste of time til i get my real host =) But anyhow, thats how many lines i had til i scrapped it.

    BTW, anyone know how i can get brinkster to let me have bandwidth again? Id like to keep that site if possible... Thanks if you know.

    Ely

  14. #14
    Vox adityadennis's Avatar
    Join Date
    Apr 2001
    Posts
    751
    This is in VB, but 25000+
    Y'all know I'm king

  15. #15
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    In VB a simple loop can be 1000 words

    Such a long-winded language... What was that anyway? 25,000 lines in VB - nasty.

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  16. #16
    Vox adityadennis's Avatar
    Join Date
    Apr 2001
    Posts
    751
    It's a kind of drag-and-drop programming language. It's hard to explain it...
    Anyways, it's still not done, and it's probably be years before it is...

  17. #17
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    "This is in VB, but 25000+"

    If you wanna talk assembler on the Amiga I can blow that away. Big time

    Mr. Tit-for-Tat Squize

  18. #18
    Senior Member random10122's Avatar
    Join Date
    Mar 2002
    Location
    Sheffield, UK
    Posts
    1,747
    You program in assembler?

    Trying to decipher a few lines when debugging is bad enough

    fracture2 - the sequel
    fracture - retro shooter
    blog - games, design and the rest

    "2D is a format, not a limitation" -Luis Barriga

  19. #19
    Hype over content... Squize's Avatar
    Join Date
    Apr 2001
    Location
    Lost forever in a happy crowd...
    Posts
    5,926
    There's this huge mythos around assembler, but I find it easier than AS ( Well I did. I'm a convert to mid-level coding now, it's just nice and quick ).

    With assembler its just pure logic, you store whatever you want wherever you want in memory, have total control over everything and the instruction set is tiny. 20 commands in 6510 or 68000 assembler is pretty much all you'd ever need.

    //68000 ( Amiga )
    moveq.l #0,score

    //6510 ( C64 )
    lda #$00
    sta score

    is the same as score=0;

    (And that's the first assembler I've written in well over 5 years )

    Squize.

  20. #20
    Vox adityadennis's Avatar
    Join Date
    Apr 2001
    Posts
    751
    alright, but mine's not done.
    I bow down to your Assembly skills, though

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