Author Topic: [2012 Apocalypse Contest] Battle 4000  (Read 38717 times)

0 Members and 1 Guest are viewing this topic.

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
[2012 Apocalypse Contest] Battle 4000
« on: November 23, 2012, 04:09:01 pm »
I might enter this into the competition, provided I have enough time to work on it :) I've been working at it on and off, and so far I've put in about 10 hours into it (I did a lot of staring blankly at my calculator .__.)

Anyways, it uses 4 assembly programs at the moment.
-Shift a portion of the screen up 6 pixels
-Shift a portion of the screen down 6 pixels
-Plot the tilemap for monster zones (tilemaps are 72 bytes, using this method)
-Draw the actual map

It uses 3x3 "tiles" on the graph screen (they aren't actual tiles, its just that you move 3 pixels at a time and everything is based on 3 pixels). The first two assembly programs are just to make scrolling through the item menu more visually appealing.

The battle engine is kind of lacking in almost all areas, but I plan to add to it as a build the game up a bit more. I just threw together a quick one to make sure the monsters worked and stuff. 18 monsters are programmed, the last three are bosses, though, so you can only face the first 15, normally.

37 items are currently in the item menu with plans to add more. Only the first 10 actually do anything, at the moment

There are very few graphics. There is also no way to obtain items, except for the first 5 you start with or through cheating.

Almost all of this was programmed in the three hours that I was waiting for laundry. The rest occurred between yesterday and today. Yesterday I added in the rest of the monsters and items that are there, now, today I added the two assembly programs and I made a map maker that generated assembly code (I wrote it in BASIC, too :P)

Over all, I am kind of having fun with this, programming mostly in BASIC :) I am still not doing any hardcore programming, though, so this is a nice way to ease back into stuff.

By the way, this is a continuation of a series I made and lost about 5 years ago :) Hopefully this will help me to revive it as I lost almost all desire to make RPGs since then.

Oh, also, the houses have a symbol above the door way. The symbol tells what house it is, but currently, there is no code for each of the house types. Instead, it just goes back to the main program loop.

EDIT: I have now added in the code for the merchant, so you can buy items. Not all items are for sale, though! Now on to the blacksmith stuff >.>
EDIT2: Okay, so now I have fleshed out the save file to be a 122 element list and it is 1112 bytes. Since it is also stored to L1 while the game is being run, that takes up 2222 bytes of RAM. I could write another small ASM program to save/load pieces of data, but is that too much ASM involvement? If I do that, the main save file will be 137 bytes and I can load only the pieces I need into L1, saving possibly 2000 bytes or so of RAM.

Hmm, I feel like this is my call, since it is a contest entry XD

Offline pimathbrainiac

  • Occasionally I make projects
  • Members
  • LV10 31337 u53r (Next: 2000)
  • **********
  • Posts: 1731
  • Rating: +136/-23
  • dagaem
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #1 on: November 24, 2012, 01:19:35 pm »
Good Luck Dude! I am making my first RPG for this comp, and it seems like I'm going to have a bit of trouble if I want to win :P

Anyway, Good Luck and Have Fun!
I am Bach.

Offline Hayleia

  • Programming Absol
  • Coder Of Tomorrow
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3367
  • Rating: +393/-7
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #2 on: November 24, 2012, 02:54:26 pm »
Good Luck Dude!
Isn't "dude" for boys ?

Anyway, this looks great already, good luck :D
I own: 83+ ; 84+SE ; 76.fr ; CX CAS ; Prizm ; 84+CSE
Sorry if I answer with something that seems unrelated, English is not my primary language and I might not have understood well. Sorry if I make English mistakes too.

click here to know where you got your last +1s

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #3 on: November 24, 2012, 05:24:31 pm »
Thanks! I am on for a few minutes to post an update:

-I have all the monster sprites done (I miscounted, there are actually 19 monsters, so you can face the first 16).
-Some monsters have items that you get after you win a battle. Different monsters have different itemsets and probabilities for each item.
-Items are now more expensive at the merchant than originally planned.
-The merchant code has been added :P You can sell items and buy many of them (some items are non-buyable, but sellable).
-The position of the cursor in the item menu is saved.
-More items have been coded in. There are now only a handful left to code. Some items are only usable in battle. I need to remove this limitation for "Speed Boost", though, because otherwise, it is pointless.

I still haven't decided if I am going to incorporate any more assembly to cut down on RAM requirements,  but I feel like any more would be too much. For now, these are the biggest memory eaters:

-The main program is 6634 bytes, with at least 1216 bytes of that in sprite data
-The save file is 1112 bytes (122 element custom list) and this gets copied to L1 for in

game access.
-Pic1 is used for backing up screens, temporarily
-The item name list is 334 bytes in Str2 and also hardcoded in the main program
-There is a list when using the item menu that is 354 bytes that is also hardcoded
-The item menu uses up about 700 bytes of RAM. The data is hardcoded, but needs to be copied to lists/strings to be used :/


Here is a little screenshot for your time :)

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #4 on: November 24, 2012, 06:01:55 pm »
Very impresive

1 little question (sprry if i'm wrong) but what if you stored all of the item's name's etc in a list (letters -> numbers of alphabet) and call in a routine to convert them back into a list? Or would that be larger and slower? Just asking...

Btw: nice to see how people get a good use out of point-on(x,y,2
 ;) and how do you "tile" your map? Is it hardcoded or string or matrix?
« Last Edit: November 24, 2012, 06:03:36 pm by stevon8ter »
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #5 on: November 24, 2012, 07:21:48 pm »
1 little question (sprry if i'm wrong) but what if you stored all of the item's name's etc in a list (letters -> numbers of alphabet) and call in a routine to convert them back into a list? Or would that be larger and slower? Just asking...
That would be slower and larger. In a string, each uppercase letter and space only takes 1 byte. In a list, each element is 9-bytes.
Btw: nice to see how people get a good use out of point-on(x,y,2
 ;) and how do you "tile" your map? Is it hardcoded or string or matrix?
The drawing of the houses is an image I created using a variation of an old program I made. It was a BASIC program that let you draw on the graph screen using rectangles. It would keep track of each rectangle in L1 and L2, then when you finished, it would create an assembly opcode in Str1 that would draw the same image. By the way, when I made that program, I didn't understand assembly, I just learned how to tweak some opcodes. The modified version that I used creates a more optimised code and recognises more types of rectangles.

As for the dots, I was toying with three ideas, but I settled on one.  The first idea was going to be to use GridOn and set up the window accordingly, and erase the dots I didn't need. However, I decided instead to create an assembly opcode where I could use bits to define which dots were on or off. This made the map 72 bytes in all, to cover all 31*18 tiles. My other idea was to hardcode the map as a string, using 32 characters to represent 5 tiles at a time (as this would be optimal). It was too slow and the maps were too large for my liking (It cost about 144 bytes in all, but oh well)

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #6 on: November 24, 2012, 07:37:57 pm »
Cool
But yeah i'm bad at assembly and opcodes and i like the fact that a program can be contained in 1 file xD but i might have to use some asm after all eventually

But for now my drawing routine for pure basic is: a for loop in a foor loop, that loops trough a matrix
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #7 on: November 24, 2012, 07:57:14 pm »
Each element in a matrix uses 9 bytes, so I would suggest storing multiple pieces of data per element. Maybe you can use a list of 18 elements for the tilemap and each element has a 31-bit number for the data in each row. I might have to do that myself >.>

EDIT: Also, my sprite drawing routine is pure BASIC, so it takes about 5 seconds to draw a 16x16 sprite using hexadecimal.

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #8 on: November 24, 2012, 08:07:42 pm »
Each element in a matrix uses 9 bytes, so I would suggest storing multiple pieces of data per element. Maybe you can use a list of 18 elements for the tilemap and each element has a 31-bit number for the data in each row. I might have to do that myself >.>

EDIT: Also, my sprite drawing routine is pure BASIC, so it takes about 5 seconds to draw a 16x16 sprite using hexadecimal.

Could be a good idea ;)

How do you draw hex sprites in basic? Or do you use a sub asm prog to translate it to basic points that need to be on?
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #9 on: November 24, 2012, 09:01:14 pm »
:D Like this:

If Str2 is your 16x16 hex sprite and the coordinates are (X,Y):
Code: [Select]
For(A,0,15
For(B,1,4
inString("0123456789ABCDEF",sub(Str2,4A+B,1))-1
For(E,1,4
Ans/2
If fPart(Ans
Pxl-On(Y+A,X+4B-E
iPart(Ans
End
End
End
It isn't too fast, but it works well enough. In this way, a 16*16 sprite takes 64 bytes, but if I had used a list instead, it would have taken 72. It would probably be faster using an 8 element list (where each element handles two rows of pixels), but the hardcoded data would be larger in many cases.

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #10 on: November 25, 2012, 05:19:43 am »
Wow that's one cool code xD
With your approval i'dd like to use this in some of my programs (credits to you again xp)
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #11 on: November 25, 2012, 09:01:07 am »
Feel free to use it and modify it (you can change it to do different sized sprites).

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #12 on: November 25, 2012, 10:32:12 am »
How would i do that? In example 8x8 sprite, would that be: change the A loop end to 7 en the B loop end to 2?
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER

Offline Xeda112358

  • they/them
  • Moderator
  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 4704
  • Rating: +719/-6
  • Calc-u-lator, do doo doo do do do.
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #13 on: November 25, 2012, 10:58:06 am »
Code: [Select]
For(A,0,7              ;Changed
For(B,1,2              ;Changed
inString("0123456789ABCDEF",sub(Str2,2A+B,1))-1   ;changed to 2A, not 4A
For(E,1,4
Ans/2
If fPart(Ans
Pxl-On(Y+A,X+4B-E
iPart(Ans
End
End
End
That's it :D
EDIT: Forgot to change the 4A to a 2A :P
EDIT2: Just for a bonus, though the sprites are kind of a bother to make for this method, this will let you draw 8x8 sprites using two elements in a list:
Code: [Select]
For(A,1,2
L1(A
For(B,4A-4,4A-1
For(C,0,7
Ans/2
if fPart(Ans
pxl-On(Y+B,C+X
iPart(Ans
End
End
End
Or if D is a complex number, with the real part being the upper 4 rows and and the imaginary part being the lower four rows:
Code: [Select]
For(A,0,1
real(Di^A
For(B,4A,4A+3
For(C,0,7
Ans/2
if fPart(Ans
pxl-On(Y+B,C+X
iPart(Ans
End
End
End

Offline stevon8ter

  • LV7 Elite (Next: 700)
  • *******
  • Posts: 663
  • Rating: +10/-0
    • View Profile
Re: [2012 Apocalypse Contest] Battle 4000
« Reply #14 on: November 25, 2012, 11:13:24 am »
Ok thx ;p but it worked with 4A as well...

Oooh wait,  my string was still 64 long xD so nvm :p

EDIT: i read it very good now and i now get the logic behind it ;p
Thx for learning me yet another thing xeda ;)
« Last Edit: November 25, 2012, 11:17:42 am by stevon8ter »
None of my posts are meant offending... I you feel hurt by one of my posts, tell me ... So i can appoligise me and/or explain why i posted it


Hi there, I'm the allmighty (read as: stupid, weak...) STEVON8TER