How much can you do with 9999 lines of code?

#10-takuPosted 8/11/2012 1:03:51 AM
I want to make an epic RPG(like dragon queet or final fantasy on the nes) but it seems like its impossible with 9999 lines of code.

Are you only limited to making simple games like score games?(tetris,,pacman,space invaders) and games like atari.

So the question is, how small or how big is your game fling to be. I'm trying to include as much info so no one misunderstands. Are we only going to be able to make like 3 rooms(each with different enemies, colour pallet, terrain). I'm thinking about the engine of the game and the players code being used as well. So tell me, doc.
#20-taku(Topic Creator)Posted 8/11/2012 1:08:49 AM
Btw, assume I am a high level basic programer. I am not wasting any code space and taking advantage of every available extra code.
#3UncleSporkyPosted 8/11/2012 6:01:50 AM
Like I just said in another thread, there are ways around the 9999 line limit.

Credit to DiscostewSM at another forum. Try this out and you'll see how it works.

Program named Test1:

PRINT "Start in Test1"
PRINT "Returned to Test1"
WAIT 120

Program named Test2:

PRINT "Inside FUNC2 of TEST2"
Print "Returning to TEST1"

It would be very complicated to write a program that works this way, though. It'd be easiest if your second program was all data or something, rather than code that needs to be executed quickly. You'd only ever "jump out" at a specific point (like the beginning of your main loop), fill an array with some specific data (like the new map the player has just entered, or all text data that NPCs say in this area), and then launch the main program again and jump back to where you left off.
#4UncleSporkyPosted 8/11/2012 6:26:27 AM
But as far as how much can be accomplished in 9999 lines, it's extremely difficult to say.

My Dragon Quest map scrolling demo includes the whole Dragon Quest 1 map. It takes up 143 lines that are almost 100 characters each (the max length). If we round up to 200 lines and say we'll allow 5000 lines to be map data, that's 25 maps as large as the Dragon Quest 1 world map.

However, it's RLE compressed, and there are definitely better compression methods out there. I don't know a ton about compression so I'd have to do some research, but I believe another method you could use for maps is Huffman. You could also break it into metatiles, another technique I described in another thread, where "1" might mean "1,1,0,0" or something. But you have to define those in data statements, so that takes up a chunk of space on its own, but the data's reusable for every map you make too. Finally, you will probably not need every map to be the size of a Dragon Quest 1 world map (around 8x8 DSi screens). Many maps could fit into the space of 2x2 or 3x3 screens.

Those are some reasons why things could be better, but there are also reasons that it could be worse. The DQ1 map is extremely simple. There are less than 16 types of tiles, which is why the RLE compression works the way it does, fitting the tile type and the run length into one byte. Any more than that and it'll require 2 or more bytes, which means more characters, which means less pieces can fit on one line, which means each map takes up more lines.

You also don't know how much space will be taken up by the engine, how much will be taken up by text data, weapon data, shop data, monster data. It all depends on how you design the game.

Text data for talking to NPCs would take up a lot of space...but you can also compress that with dictionary compression. Your NPCs will probably say certain words and phrases a lot - "and," "the," "thank you," "heroes," "weapon," "armor." All of those can have single numbers stand in for themselves. But writing and using that sort of compression is complicated, and again I don't know what the results would be, how much space it would take before and how much space after.
#5N64MarioPosted 8/11/2012 8:46:31 PM
If you run out of room, I read you can make the game load a new program, then give more lines in there. :-/