2023-12-11

Goal

Build out Django Models for our different apps (accounts, bets, fighters, and fights)

Notes

I still need to handle pre-signed URLs wen referencing media files via S3, however I wanted to take a break from all that and work on establishing the actual data that will go into each of these different apps. I can use these notes to build out my ideas about the type of information I'll need to have access to for my bets / users.

I started with the fighters class because that is the one I'm most interested in building up. A fighter's stats that determine the odds of their fight are listed below:

{'strike_attempt_successes': 115.0,
 'strike_attempt_failures': 65.0,
 'strike_defense_successes': 37.0,
 'strike_defense_failures': 28.0,
 'sig_strike_attempt_successes': 45.0,
 'sig_strike_attempt_failures': 59.0,
 'head_strike_attempts': 35.0,
 'body_strike_attempts': 35.0,
 'leg_strike_attempts': 5.0,
 'takedown_attempt_successes': 2.0,
 'takedown_attempt_failures': 1.0,
 'takedown_defense_successes': 2.0,
 'takedown_defense_failures': 1.0,
 'submission_attempt_successes': 0.0,
 'submission_attempt_failures': 0.0,
 'submission_defense_successes': 0.0,
 'submission_defense_failures': 1.0,
 'control_time_success': 8.85,
 'control_time_failure': 2.033333333333333,
 'total_fight_time': 1047.0,
 'strikes_per_second': 0.1728748806112703,
 'submissions_per_second': 0.11299435028248588,
 'takedowns_per_second': 0.006269592476489028,
 'movements_per_second': 0.01,
 'knock_downs': 1.0,
 'strike_victories': {'distance': {'Punch': [5.2, 0.0, 0.0],
   'Kick': [0.0, 0.0, 0.05],
   'Elbow': [0.0, 0.0, 0.0],
   'Knee': [0.0, 0.0, 0.0]},
  'clinch': {'Punch': [0.1, 0.0, 0.0],
   'Kick': [0.0, 0.0, 0.0],
   'Elbow': [0.05, 0.0, 0.0],
   'Knee': [0.0, 0.0, 0.0]},
  'dominant_ground': {'Punch': [0.7000000000000001, 0.0, 0.0],
   'Elbow': [0.25, 0.0, 0.0],
   'Knee': [0.05, 0.0, 0.0]},
  'unsecure_ground': {'Punch': [0.44999999999999996, 0.0, 0.0],
   'Kick': [0.0, 0.0, 0.0],
   'Elbow': [0.0, 0.0, 0.0]}}}
  • fighters
    • Fighter
      • id
      • date_of_birth
      • prefix (from the Name class)
      • name (from the Name class)
      • suffix (from the Name class)
      • title (prefix + name + suffix)
      • biography
      • is_athiest
      • is_abstinent
      • is_badboy
      • has_visited_ancient_temple
      • has_monastic_training
      • is_roastmaster
      • is_derranged
      • is_radioactive
      • is_on_drugs
      • is_retired
      • is_deceased
      • current_rank
      • spirit_fighter
      • rarity?
        • common
        • uncommon
        • rare
        • exotic
        • legendary
      • height
      • weight
      • reach
      • stance
      • FK cosmetics
    • Name
      • id
      • value
      • type
        • prefix
        • name
        • suffix
      • rarity
        • common
        • uncommon
        • rare
        • exotic
        • legendary
    • Cosmetic
      • id
      • type
        • beard
        • body
        • earring
        • glasses
        • gloves
        • hair
        • necklace
        • shoes
        • tattoos
        • shorts
      • rarity
        • common
        • uncommon
        • rare
        • exotic
        • legendary
      • color_shift_r
      • color_shift_g
      • color_shift_b
      • img
      • metadata

Continued to implement this into my app. I got the fighter stats up (with the exception of some time stats) then started to work on cosmetics. What's cool about the way I'm setting it up is that I only have to reference the cosmetic in the database to pull it. I can also reference all fighters with a given cosmetic using the ForeignKey Django Model using a command like the following:

some_cosmetic.fighters_hair.all()

which would return all of the fighter ids associated with a given cosmetic (some_cosmetic)

I also found out that Django supports saving JSON files, even within PostgreSQL databases. This makes storing metadata for Spritesheets much easier.

I also found out that there is a faker package in Python that allows a user to generate fake data. This could be fun to use when generating fighters...

Results

Next Time


Previous Note 2023-12-10 Next Note 2023-12-12