igorfs10 / rust_hero

Um jogo simples em rust
GNU General Public License v3.0
4 stars 1 forks source link

added screen shots to README.md #7

Closed 1sra3l closed 3 years ago

1sra3l commented 3 years ago

That is all I did :smile:

igorfs10 commented 3 years ago

Thanks a lot, and sorry for delay. I will try to take a day off next friday to work on the game.

1sra3l commented 3 years ago

No worries!

Do you want more enemies? Do you have some in mind, or do you want me to just create some?

I know you've mentioned .json, could we use something human-readable like .ini or .toml? I use tini for my own purposes. If you need json format, do you mind if I make functions to read/save ini files?

The reason I am asking, is that we are getting to a point where hard-coding all the asset information, and statistics will become increasingly difficult, unless it is in a separate file we read into the program.

1sra3l commented 3 years ago

Oh... one other thing. :smile: I have thought that it might be cool to make a generic statistics library for RPG games. Something where you could make variables whatever type you need u32, f64, whatever, but it would do all the normal functions. This way the cool RPG math could be used in other people's projects.

igorfs10 commented 3 years ago

No worries!

Do you want more enemies? Do you have some in mind, or do you want me to just create some?

I know you've mentioned .json, could we use something human-readable like .ini or .toml? I use tini for my own purposes. If you need json format, do you mind if I make functions to read/save ini files?

The reason I am asking, is that we are getting to a point where hard-coding all the asset information, and statistics will become increasingly difficult, unless it is in a separate file we read into the program.

I think it's better to start separating in files before we have a lot of enemies to migrate to this system. I talked about json because it's common and I know how to deal with arrays and objects in it, I think toml is easier, but I need to see how to deal with a combination of objects and arrays, and ini seems to be a little confusing with arrays, but I didn't find a good example to be sure about it, so if you show me how it looks, we can see and implement. I’m planning to merge the class and enemy struct and use just one as character base to calculate its stats, so we can use the class as enemy. It will look like this.

/// Struct to be used to load the base stat for a character and calculate its stats and given experience
pub struct BaseCharacter{
    pub id: u8,
    pub name: String,
    pub hp: u16,
    pub mp: u16,
    pub atk: u8,
    pub def: u8,
    pub m_atk: u8,
    pub m_def: u8,
    pub exp: u16,               // Base xp used to calculate the received xp after player defeats an enemy
    pub item: Option<u8>,       // Id of item that will be dropped by enemy
    pub img_idle: String,
    pub img_walking: String,
    pub img_attacking: String,
    pub playable: bool,
}

I’m adding a struct to set the enemy level to location, so we can reuse some enemies with higher level or even create a hard mode just changing levels, instead of just enemy array we will have an array of enemy with level.

pub struct EnemyData {
    pub character: u8, //Character id
    pub level: u8,
}

What you think about it?

Oh... one other thing. 😄 I have thought that it might be cool to make a generic statistics library for RPG games. Something where you could make variables whatever type you need u32, f64, whatever, but it would do all the normal functions. This way the cool RPG math could be used in other people's projects.

Good idea, we can add a crate and separate these things from data crate. You mean to put functions to calculate stats, damage and other related things in it right?

1sra3l commented 3 years ago

Not entirely sure about toml specifically, but using the tini library you can do this for arrays:

let section = "default";
let act:Option<Vec<String>>     = conf.get_vec_with_sep(section, "Actions",";");
// or use the standard `,` seperator
let act:Option<Vec<String>>     = conf.get_vec(section, "Actions");

and the ini file is:

[default]
Actions = this, that, other, more, whatever

I think merging the enemy + character together is great, and absolutely what I do in my own stuff!

I am thinking it would be great to make a good rpg math crate, like you are thinking. We could include all the things we can think of that would be helpful. I'd even be up for coding up a D&D manual type stat, if you want to play with the battle equations.

We could even use one of the D&D dice engines where you can input things like "2d6" or whatever.

I do think overall making the RPG math into a library would be much better, because then things are more reusable for both of us in any future projects, and would help others quickly get the time consuming part out of the way. Perhaps even eventually offering various stat modes, like Basic, Normal, and Full or something to that effect.

Let me know what you think. Feel free to merge this PR too, if you want the screenshots up.

1sra3l commented 3 years ago

Thanks!

I am making a little FLTK program to create characters for my kids, they really enjoy making characters :smile: and have been thinking about applying it to the same stats we use in Rust Hero, that would make it pretty easy to edit things even if we use json format. I am sure we could make it work with either backend, you seem to be a very talented programmer. I like your methodical approach!

Thanks for making a fun project during such strange times, it is a nice outlet that is starting to even look like a game. I hope the game will end up being as nice for others as it has been making it with you!