Author Topic: Standard RPG Game  (Read 16531 times)

0 Members and 1 Guest are viewing this topic.

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #15 on: September 19, 2016, 03:50:10 pm »
That's a great idea! I'll have to get more tiles written first...

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Standard RPG Game
« Reply #16 on: September 19, 2016, 03:52:07 pm »
Am I right in assuming that you aren't animating while the player is moving, only while they are stationary?
/e

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #17 on: September 19, 2016, 04:04:21 pm »
They move when Link moves, although, I have it 'animate' (aka, draw the new tile to the back buffer) the tiles that are visible. I might need to make that window a little bigger if Link moves and exposes a new tile...That should be a quick fix though.


Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Standard RPG Game
« Reply #18 on: September 19, 2016, 04:05:38 pm »
They move when Link moves, although, I have it 'animate' (aka, draw the new tile to the back buffer) the tiles that are visible. I might need to make that window a little bigger if Link moves and exposes a new tile...That should be a quick fix though.
Alright, that screenshot shows it much better. It does seem to animate much slower while link is moving though.
/e

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #19 on: September 19, 2016, 04:19:15 pm »
Yeah, that's cause of the frame counter. The main loop cycles slower when the background map is moving. When it's not moving, it cycles quicker...eventually I'll put in a delay to make the speed difference match.

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: Standard RPG Game
« Reply #20 on: September 20, 2016, 09:56:02 am »
Oh, this is turning out quite well, nice job! I've been spending the last few days cleaning up an old RPG engine of mine, so it's cool to see someone working on making one, too!

I'm not sure how you process tile animation, but I have my tiles set up as something like:
Code: [Select]
tilesprite_ptr,tiletime,tilenextAll of the tiles are accessed as an indexed array, so tile0 is the first 4 bytes, tile1 is the next, etc. During initialization, I make a buffer of "tiletime,tile#" for each kind of tile. In an interrupt, I decrement the first byte (time counter), and if it hits zero, I use tile# to access the tile data and figure out "tilenext" and load that data into the slot, essentially evolving the tile into its next form. Further, when this happens, I set a flag indicating that the tilemap has to be rerendered, which is also processed in the interrupt.

Using an interrupt for the evolving the tile animations and rendering allows for consistent animation speed regardless of how bogged down the engine gets, and regardless of using 6MHz or 15MHz. When I toggle 15MHz mode, my sprite zips around the screen without causing the tile animation to change in speed, so it looks like my sprite is Flash :P

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #21 on: September 20, 2016, 12:09:41 pm »
I was thinking of this idea. What if I store the address for the beginning of each tile in a list. The tile ID for each tile refers to the location of the address of each tile. That way I can keep the animated tiles together. To animate the tile, I just use the timer as an offset.

Maybe it would make more sense with code. I'm storing the addresses to the beginning of each tile.
Code: [Select]
//Null Tile
[FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF]→"First Element of list"
//1-GRASS
[0010542800000000000000000000000000105428000000000000000000000000]→"Second Element of list"
//2-FLOWER A-D (Animate)
[3838C6C6C638380000105428000000003838C6C6C63838000010542800000000]→"Third Element of list"
[003844C6C6BA38000010542800000000003844C6C6BA38000010542800000000]
[38BAC6C644380000001054280000000038BAC6C6443800000010542800000000]
[003844C6C6BA38000010542800000000003844C6C6BA38000010542800000000]
//3-ROAD
[022202820A02FC00022202820A02FC00022202820A02FC00022202820A02FC00]→"Fourth Element of list"

See how the Flower's animated frames follow right after the first. This way, in my hex maps I can call the address for each tile, but in my animateTile routine I can use the timer as an offset....could I store addresses in a list? cause I don't know how...

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #22 on: September 21, 2016, 04:52:20 pm »
I'll get back to the animated tiles, cause I feel I can improve it...

Since I want Link to cut a bush, I've been working on the bush mechanics. Afterwards I'll work on sword mechanics...

I added 4 new routines: Replace Tile, Add Animation, Delete Animation, Draw Animation.

When Link cuts a bush, Replace Tile changes the map ID for the bush into a grass tile. When I do that, I add an animation over it to look like the bush disintegrates. I can add multiple animations to the same screen, and even specify what animation I want. It could be a bush being cut, or a spark of a sword, blowing up bomb, etc. I've been testing out these routines, and I think it looks good.

Check out the screen shot. These bushes don't stand a chance to Link's piercing gaze!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Standard RPG Game
« Reply #23 on: September 21, 2016, 04:54:04 pm »
Looking nice!
If you want to do it like in zelda games where enemies move around on the map you might want to start i9mplementing your engine being able to handle multiple moving objects at the same time, though. IDK as a practice it might be an idea to make bushes such "movable" objects?

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #24 on: September 21, 2016, 06:38:01 pm »
Quote
If you want to do it like in zelda games where enemies move around on the map you might want to start i9mplementing your engine being able to handle multiple moving objects at the same time, though. IDK as a practice it might be an idea to make bushes such "movable" objects?

True..I think bushes and rocks are part of the map background for link's awakening.

For starting enemies, I'll probably start with some static enemy, and get it to where I can have multiple static enemies on the map. They'll take damage, hurt link, and 'blow up' when their health's gone. Then I'll start working on a way to get them moving...idk. I'll have to think it through. There's a lot to consider. They have coordinates, actions, hitboxes, health, etc...

For the animated tiles, I was thinking of storing the addresses in a list, like I have illustraited above. Is that possible/how would I do that?

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #25 on: September 26, 2016, 03:54:32 pm »
Alright, so I have reworked my Mask routine so it'll rotate or flip masked sprites as needed.

Using this and the sprites, I was able to make Link swing his sword! Link has 2 separate animations that play back to back. Just like the standing and walking sprites, there's a routine I have that works through the appropriate offsets for the program to draw the right sprite. When Link is swinging, I also draw the appropriate sword sprite flipped the appropriate way in the appropriate spot...this took a lot of trial and error! lol

Now Link swings his sword in all directions. If you hold down the sword button, Link holds still with his sword out...sorry, no spin move yet...if ever :P

I have all the animation elements I need to get Link to slash bushes. That's my next step.

In the mean time, watch him hack and slash around!

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: Standard RPG Game
« Reply #26 on: September 26, 2016, 03:55:48 pm »
This is looking awesome, love it! :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline TIfanx1999

  • ಠ_ಠ ( ͡° ͜ʖ ͡°)
  • CoT Emeritus
  • LV13 Extreme Addict (Next: 9001)
  • *
  • Posts: 6173
  • Rating: +191/-9
    • View Profile
Re: Standard RPG Game
« Reply #27 on: September 26, 2016, 05:14:19 pm »
That's looking really nice! :D

Offline coops

  • LV3 Member (Next: 100)
  • ***
  • Posts: 58
  • Rating: +3/-0
    • View Profile
Re: Standard RPG Game
« Reply #28 on: September 29, 2016, 10:54:31 am »
Alright, so it's been tricky getting this next step set up, but I think I got it.

I made a routine called CheckBush (I couldn't think of another name...). Depending on Link's direction, it checks the Tile ID for 6 points running along the sword. If any of those 6 points is in a tile with the bush ID, it replaces the bush with a grass ID, and adds a cut bush animation. Unlike the original L.A., I have it set up where you can cut 2 bushes at once if the blade lands in between both bushes. I like it...but I might change the cut bush animation to make it more leafy...

This is getting surprisingly big...i think the next step should be to put Link's sprite data, or map data in an app variable separate from the program..but I don't know how to do that, nor how to read from the app variable. Would I need to unarchive the app variable to just read from it? Any examples I can look at?

And for those who likes screen shots, watch Link mow his yard!

Offline Eeems

  • Mr. Dictator
  • Administrator
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 6268
  • Rating: +318/-36
  • little oof
    • View Profile
    • Eeems
Re: Standard RPG Game
« Reply #29 on: September 29, 2016, 12:59:45 pm »
You should be able to read the archived appvar into somewhere in memory and just use it that way. Maybe instead of calling the routine checkbush, you should call it chechandreplacetile. It's a bit more wordy, but it does explain what is happening a little bit better.