Skip to content

Commit

Permalink
# This is a combination of 37 commits.
Browse files Browse the repository at this point in the history
# This is the 1st commit message:

Update 0.6.3.17a

- Add Landsknecht armour side direction armour (see the latest update in readme.md).
- Improve various animation frames.
- Various bugs fixed.

Update 0.6.3.17b

- Implement sound effect system.
- Various bug fixes.

Update 0.6.3.17c

- Move target calculation for range attack to Subunit's attack method.
- Various bug fixes.

Update 0.6.3.17d

- Sprite update.

Update 0.6.3.17d

- Sprite update.

Update 0.6.3.17e

- Reworking combat mechanic.
- Various bug fixes.

Delete body.png

Delete leg.png

# This is the commit message #2:

Delete leg.png
# This is the commit message #3:

Delete body.png
# This is the commit message #4:

Delete leg.png
# This is the commit message #5:

Delete leg.png
# This is the commit message #6:

Update 0.6.3.17f

- Fix capital letter folder problem.

# This is the commit message #7:

Update 0.6.3.17g

- Change arcade mode's volley aim to line aim.
- Change various methods' name to make them more consistent.
- Various bugs fixed.

# This is the commit message #8:

Update 0.6.3.17h

- Add troop shoot line for manual aim mechanic.
- Sound distance of attack effect now also create screen shake for loud weapon.
- Various bugs fixed.

# This is the commit message #9:

Update 0.6.3.18

- Manual aim now let player use wheel command and some other mechanics as well.
- Hit box now works properly.
- Improve wheel ui.
- Various bugs fixed.

# This is the commit message #10:

Update 0.6.3.18a

- Change how unit box size is calculated and subunit hitbox size .
- Various bugs fixed.

# This is the commit message #11:

Update 0.6.3.18a1

- Add Landsknecht leather armour.
- Add cannon sprite and some related animations for side direction.
- bugs fixed.

# This is the commit message #12:

Update 0.6.3.18a2

- Add and improve some beard sprites.
- bugs fixed.
- The game now uses only about 1gb ram after fixing animation bugs in this update

# This is the commit message #13:

Update 0.6.3.18a2

- Animation and sprite update.
- Minor bug fixed.

# This is the commit message #14:

Update 0.6.3.18a4

- Animation and sprite update.
- Minor bug fixed.

# This is the commit message #15:

Update 0.6.3.18a5

- Change how troop and effect layer work in game.
- Minor bug fixed.

# This is the commit message #16:

Update 0.6.3.18a6

- Minor bug fixed.

# This is the commit message #17:

Update 0.6.3.18a7

- Improve collision movement detection.
- Add weapon joint to hand function and button in animation maker.
- Minor bugs fixed.

# This is the commit message #18:

Update 0.6.3.18a8

- Add katana sprite.
- Minor bugs fixed.

# This is the commit message #19:

Update 0.6.3.18a9

- Minor bugs fixed.

# This is the commit message #20:

Update 0.6.3.18c

- Various bugs fixed.

# This is the commit message #21:

Update Refocus 0.6.3.20

- Refocus and rework the game mechanic to only arcade mode for now to improve the overall quality.
- Merge unit and leader object into subunit.
- Subunit now follow leader based on order instead of specific formation.
- Game now only has 1 zoom level.
- Subunit sprite now use only side direction.
- Remove unit editor (Will work on troop/leader editor later).
- Remove various unused assets and codes.
- Various bugs fixed and improvements.

# This is the commit message #22:

Update Refocus 0.6.3.21

- Improve hero ui.
- Improve formation placement.
- Various bugs fixed.

# This is the commit message #23:

Update Refocus 0.6.3.21a

- Various bugs fixed.

# This is the commit message #24:

Update Refocus 0.6.3.22

- Add some sample melee attack sprites.
- Add back broken and retreat.
- Change matchlock musket shoot animation to "restfire" that include musket rest when shooting.
- Shooting line of sight now consider height.
- Various bugs fixed.

# This is the commit message #25:

Update 0.6.3.22

- Improve melee combat.
- Implement stationary weapon check.
- Various bugs fixed.

# This is the commit message #26:

Update 0.6.3.23

- Add player skill icon ui.
- Add skill effect and sound function.
- Animation and sprite update.
- Various bugs fixed.

# This is the commit message #27:

Update 0.6.3.23a

- Add weapon impact
- Various bugs fixed.

# This is the commit message #28:

Update 0.6.3.23b

- Add more effect sounds and sprites.
- Various bugs fixed.

# This is the commit message #29:

Update 0.6.3.23b

- Add more effect sounds and sprites.
- Various bugs fixed.

# This is the commit message #30:

Update 0.6.3.24

- Add back range arc shot.
- Add weapon damage attribute scaling check.
- Add leader follower order.
- Add grit human mouth.
- Add hammer and war hammer sprites.
- Various bugs fixed.

# This is the commit message #31:

Update 0.6.3.25

- Add dodge stat.
- Add weapon holding effect to stat.
- Various bugs fixed.

# This is the commit message #32:

Update 0.6.3.26

- Troop head now has hair sprite.
- Sound and animation sprite update.
- Add charge as damage sprite.
- Various bugs fixed.

# This is the commit message #33:

Update 0.6.3.26a

- Minor bug fixed.

# This is the commit message #34:

Update 0.6.3.27

- Add back enactment mode as observation mode.
- Add back manual aim mode.
- Sound and sprite animation update.
- Minor bug fixed.

# This is the commit message #35:

Update 0.6.3.28

- Add AI skill usage for troop and leader with condition.
- Update battle result screen.
- Sound and sprite animation update.
- Various bugs fixed.

# This is the commit message #36:

Update 0.6.3.28a

- Add great mace sprite.
- Improve main.spec compiling to include all required data and gamescript folders.

# This is the commit message #37:

Update 0.6.3.29

- Add troop weapon behaviour condition to hold and release attack for bonus.
- Add range attack's sound during movement.
- Sound and sprite update
  • Loading branch information
remance committed Jun 12, 2023
1 parent fedfb76 commit a5b00a8
Show file tree
Hide file tree
Showing 3,738 changed files with 9,186 additions and 29,549 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
807 changes: 398 additions & 409 deletions animation maker.py

Large diffs are not rendered by default.

50 changes: 0 additions & 50 deletions animation maker/script/check.py

This file was deleted.

121 changes: 57 additions & 64 deletions animation maker/script/multiwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,74 +12,67 @@

read_anim_data = pool.read_anim_data

direction_list = ("front", "side", "back", "sideup", "sidedown")

pool = []
for direction in direction_list:
with open(os.path.join(main_dir, "data", "animation", "generic", direction + ".csv"), encoding="utf-8",
mode="r") as edit_file:
rd = csv.reader(edit_file, quoting=csv.QUOTE_ALL)
rd = [row for row in rd]
part_name_header = rd[0]
animation_pool = {}
for row_index, row in enumerate(rd):
if row_index > 0:
key = row[0]
row = row[1:]
animation_pool[key] = {part_name_header[1:][item_index]: item.split(",") for item_index, item in enumerate(row)}
pool.append(animation_pool)
edit_file.close()
with open(os.path.join(main_dir, "data", "animation", "generic", "side.csv"), encoding="utf-8",
mode="r") as edit_file:
rd = csv.reader(edit_file, quoting=csv.QUOTE_ALL)
rd = [row for row in rd]
part_name_header = rd[0]
animation_pool = {}
for row_index, row in enumerate(rd):
if row_index > 0:
key = row[0]
row = row[1:]
animation_pool[key] = {part_name_header[1:][item_index]: item.split(",") for item_index, item in enumerate(row)}
pool = animation_pool
edit_file.close()


def frame_adjust(pool, pool_name, header, filter_list, direction, part_anchor, exclude_filter_list=()):
def frame_adjust(pool, pool_name, header, filter_list, part_anchor, exclude_filter_list=()):
"""Move every parts in animation pool of specific direction based on specific input part and desired new position"""
for index, this_direction in enumerate(direction_list):
if this_direction == direction:
for key, value in pool[index].items():
for key, value in pool.items():
match = False
for this_filter in filter_list:
if this_filter in key:
match = True
for this_filter in exclude_filter_list:
if this_filter in key:
match = False
for this_filter in filter_list:
if this_filter in key:
match = True
for this_filter in exclude_filter_list:
if this_filter in key:
match = False
if match:
if type(value[part_anchor[0]]) == list and len(value[part_anchor[0]]) > 1:
if "weapon" in part_anchor:
pos = (float(value[part_anchor[0]][2]), float(value[part_anchor[0]][3]))
else:
pos = (float(value[part_anchor[0]][3]), float(value[part_anchor[0]][4]))
offset = (part_anchor[1][0] - pos[0], part_anchor[1][1] - pos[1])
for key2, value2 in value.items():
if "property" not in key2 and type(value[key2]) == list and len(value[key2]) > 1:
if "weapon" in key2:
pool[index][key][key2][2] = str(float(pool[index][key][key2][2]) + offset[0])
pool[index][key][key2][3] = str(float(pool[index][key][key2][3]) + offset[1])
else:
pool[index][key][key2][3] = str(float(pool[index][key][key2][3]) + offset[0])
pool[index][key][key2][4] = str(float(pool[index][key][key2][4]) + offset[1])
if match:
if type(value[part_anchor[0]]) == list and len(value[part_anchor[0]]) > 1:
if "weapon" in part_anchor:
pos = (float(value[part_anchor[0]][2]), float(value[part_anchor[0]][3]))
else:
pos = (float(value[part_anchor[0]][3]), float(value[part_anchor[0]][4]))
offset = (part_anchor[1][0] - pos[0], part_anchor[1][1] - pos[1])
for key2, value2 in value.items():
if "property" not in key2 and type(value[key2]) == list and len(value[key2]) > 1:
if "weapon" in key2:
pool[key][key2][2] = str(float(pool[key][key2][2]) + offset[0])
pool[key][key2][3] = str(float(pool[key][key2][3]) + offset[1])
else:
pool[key][key2][3] = str(float(pool[key][key2][3]) + offset[0])
pool[key][key2][4] = str(float(pool[key][key2][4]) + offset[1])

for index, this_direction in enumerate(direction_list):
if this_direction == direction:
for key in pool[index]:
for key2, value in pool[index][key].items():
new_value = str(pool[index][key][key2])
for character in "'[]":
new_value = new_value.replace(character, "")
new_value = new_value.replace(", ", ",")
pool[index][key][key2] = new_value
for key in pool[index]:
pool[index][key] = [value for value in pool[index][key].values()]
save_list = pool[index]
final_save = [[item for item in header]]
for item in list(save_list.items()):
final_save.append([item[0]] + item[1])
with open(os.path.join(main_dir, "data", "animation", pool_name, this_direction + ".csv"), mode="w",
encoding='utf-8',
newline="") as edit_file:
filewriter = csv.writer(edit_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL)
for row in final_save:
filewriter.writerow(row)
edit_file.close()
for key in pool:
for key2, value in pool[key].items():
new_value = str(pool[key][key2])
for character in "'[]":
new_value = new_value.replace(character, "")
new_value = new_value.replace(", ", ",")
pool[key][key2] = new_value
for key in pool:
pool[key] = [value for value in pool[key].values()]
save_list = pool
final_save = [[item for item in header]]
for item in list(save_list.items()):
final_save.append([item[0]] + item[1])
with open(os.path.join(main_dir, "data", "animation", pool_name, "side.csv"), mode="w",
encoding='utf-8',
newline="") as edit_file:
filewriter = csv.writer(edit_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL)
for row in final_save:
filewriter.writerow(row)
edit_file.close()

frame_adjust(pool, "generic", part_name_header, ("Chariot", ), "back", ("p4_body", (201.8, 222)), exclude_filter_list=("Die", ))
# frame_adjust(pool, "generic", part_name_header, ("Chariot", ), ("p4_body", (201.8, 222)), exclude_filter_list=("Die", ))
185 changes: 85 additions & 100 deletions animation maker/script/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,125 +15,110 @@
stat_convert = datastat.stat_convert


def read_anim_data(direction_list, pool_type, anim_column_header):
pool = []
for direction in direction_list:
with open(os.path.join(main_dir, "data", "animation", pool_type, direction + ".csv"), encoding="utf-8",
mode="r") as edit_file:
rd = csv.reader(edit_file, quoting=csv.QUOTE_ALL)
rd = [row for row in rd]
part_name_header = rd[0]
list_column = anim_column_header # value in list only
list_exclude = ["Name", "size", "eye", "mouth"]
list_column = [item for item in list_column if
item not in list_exclude and any(ext in item for ext in list_exclude) is False]
list_column = [index for index, item in enumerate(part_name_header) if item in list_column]
part_name_header = part_name_header[1:] # keep only part name for list ref later
animation_pool = {}
for row_index, row in enumerate(rd):
if row_index > 0:
key = row[0].split("/")[0]
for n, i in enumerate(row):
row = stat_convert(row, n, i, list_column=list_column)
row = row[1:]
if key in animation_pool:
animation_pool[key].append(
{part_name_header[item_index]: item for item_index, item in enumerate(row)})
else:
animation_pool[key] = [
{part_name_header[item_index]: item for item_index, item in enumerate(row)}]
pool.append(animation_pool)
part_name_header = [item for item in part_name_header if item != "effect" and "property" not in item]
def read_anim_data(pool_type, anim_column_header):
with open(os.path.join(main_dir, "data", "animation", pool_type, "side.csv"), encoding="utf-8",
mode="r") as edit_file:
rd = csv.reader(edit_file, quoting=csv.QUOTE_ALL)
rd = [row for row in rd]
part_name_header = rd[0]
list_column = anim_column_header # value in list only
list_exclude = ["Name", "size", "eye", "mouth"]
list_column = [item for item in list_column if
item not in list_exclude and any(ext in item for ext in list_exclude) is False]
list_column = [index for index, item in enumerate(part_name_header) if item in list_column]
part_name_header = part_name_header[1:] # keep only part name for list ref later
animation_pool = {}
for row_index, row in enumerate(rd):
if row_index > 0:
key = row[0].split("/")[0]
for n, i in enumerate(row):
row = stat_convert(row, n, i, list_column=list_column)
row = row[1:]
if key in animation_pool:
animation_pool[key].append(
{part_name_header[item_index]: item for item_index, item in enumerate(row)})
else:
animation_pool[key] = [
{part_name_header[item_index]: item for item_index, item in enumerate(row)}]
pool = animation_pool
part_name_header = [item for item in part_name_header if item != "effect" and "property" not in item]
edit_file.close()
return pool, part_name_header


def read_joint_data(direction_list):
weapon_joint_list = []
for direction_index, direction in enumerate(direction_list):
with open(os.path.join(main_dir, "data", "sprite", "generic", "weapon", "joint.csv"), encoding="utf-8",
mode="r") as edit_file:
rd = csv.reader(edit_file, quoting=csv.QUOTE_ALL)
rd = [row for row in rd]
header = rd[0]
list_column = direction_list
list_column = [index for index, item in enumerate(header) if item in list_column]
joint_list = {}
for row_index, row in enumerate(rd):
if row_index > 0:
for n, i in enumerate(row):
row = stat_convert(row, n, i, list_column=list_column)
key = row[0].split("/")[0]
position = row[direction_index + 1]
if position == ["center"] or position == [""]:
position = "center"
else:
position = pygame.Vector2(position[0], position[1])

if key in joint_list:
joint_list[key].append({row[0]: position})
else:
joint_list[key] = [{row[0]: position}]
weapon_joint_list.append(joint_list)
edit_file.close()
def read_joint_data():
with open(os.path.join(main_dir, "data", "sprite", "generic", "weapon", "joint.csv"), encoding="utf-8",
mode="r") as edit_file:
rd = csv.reader(edit_file, quoting=csv.QUOTE_ALL)
rd = [row for row in rd]
header = rd[0]
list_column = ["side"]
list_column = [index for index, item in enumerate(header) if item in list_column]
joint_list = {}
for row_index, row in enumerate(rd):
if row_index > 0:
for n, i in enumerate(row):
row = stat_convert(row, n, i, list_column=list_column)
key = row[0].split("/")[0]
position = row[1]
if position == ["center"] or position == [""]:
position = "center"
else:
position = pygame.Vector2(position[0], position[1])

joint_list[key] = position
weapon_joint_list = joint_list
edit_file.close()
return weapon_joint_list


def anim_to_pool(animation_name, pool, char, activate_list, new=False, replace=None, duplicate=None):
"""Add animation to animation pool data"""
if replace is not None: # rename animation
for direction in range(0, 5):
pool[direction][animation_name] = pool[direction].pop(replace)
pool[animation_name] = pool.pop(replace)
elif duplicate is not None:
for direction in range(0, 5):
pool[direction][animation_name] = [
{key: [small_value for small_value in value] if type(value) == list else value for key, value in
this_frame.items()} for this_frame in pool[direction][duplicate]]
pool[animation_name] = [
{key: [small_value for small_value in value] if type(value) == list else value for key, value in
this_frame.items()} for this_frame in pool[duplicate]]
else:
if animation_name not in pool[0]:
for direction in range(0, 5):
pool[direction][animation_name] = []
if animation_name not in pool:
pool[animation_name] = []
if new:
for direction in range(0, 5):
pool[direction][animation_name] = [frame for index, frame in enumerate(char.frame_list) if
frame != {} and activate_list[index]]
pool[animation_name] = [frame for index, frame in enumerate(char.frame_list) if
frame != {} and activate_list[index]]
else:
pool[char.side][animation_name] = [frame for index, frame in enumerate(char.frame_list) if
frame != {} and activate_list[index]]
pool[animation_name] = [frame for index, frame in enumerate(char.frame_list) if
frame != {} and activate_list[index]]


def anim_save_pool(pool, pool_name, direction_list, anim_column_header):
def anim_save_pool(pool, pool_name, anim_column_header):
"""Save animation pool data"""
for index, direction in enumerate(direction_list):
with open(os.path.join(main_dir, "data", "animation", pool_name, direction + ".csv"), mode="w",
encoding='utf-8', newline="") as edit_file:
filewriter = csv.writer(edit_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL)
save_list = pool[index]
final_save = [[item for item in anim_column_header]]
for item in list(save_list.items()):
for frame_num, frame in enumerate(item[1]):
subitem = [tiny_item for tiny_item in list(frame.values())]
for item_index, min_item in enumerate(subitem):
if type(min_item) == list:
min_item = [this_item if type(this_item) != float else round(this_item, 1) for this_item in
min_item]
new_item = str(min_item)
for character in "'[]":
new_item = new_item.replace(character, "")
new_item = new_item.replace(", ", ",")
subitem[item_index] = new_item
new_item = [item[0] + "/" + str(frame_num)] + subitem
final_save.append(new_item)
for row in final_save:
filewriter.writerow(row)
with open(os.path.join(main_dir, "data", "animation", pool_name, "side.csv"), mode="w",
encoding='utf-8', newline="") as edit_file:
filewriter = csv.writer(edit_file, delimiter=",", quotechar='"', quoting=csv.QUOTE_ALL)
save_list = pool
final_save = [[item for item in anim_column_header]]
for item in list(save_list.items()):
for frame_num, frame in enumerate(item[1]):
subitem = [tiny_item for tiny_item in list(frame.values())]
for item_index, min_item in enumerate(subitem):
if type(min_item) == list:
min_item = [this_item if type(this_item) != float else round(this_item, 1) for this_item in
min_item]
new_item = str(min_item)
for character in "'[]":
new_item = new_item.replace(character, "")
new_item = new_item.replace(", ", ",")
subitem[item_index] = new_item
new_item = [item[0] + "/" + str(frame_num)] + subitem
final_save.append(new_item)
for row in final_save:
filewriter.writerow(row)
edit_file.close()


def anim_del_pool(pool, animation_name):
"""Delete animation from animation pool data"""
if animation_name in pool[0]:
for direction in range(0, 5):
try:
del pool[direction][animation_name]
except:
pass
if animation_name in pool:
del pool[animation_name]

Loading

0 comments on commit a5b00a8

Please sign in to comment.