But at the start of today i had a rough time getting my hands on breakfast. And when i got my hands on it i all of a sudden got stuck watching Nekomonogatari (which is luckily only 4 episodes!) Can't blame myself on it either, it's the first good anime i've seen for a long time D: (i've been loaded up with nothing but fanservice focused animes lately, it's been driving me nuts!) Still managed to stop myself after 2 eps. I'll finish it over dinner or something.
Humans are really interesting creatures, i just stopped to wonder... There are tons of people in this world in a similar situation as mine... But for some reason i think at the same time i'm extremely different from all of them. Certain characteristics that make me unique, certain that people around me consider bad, others that they consider good, and same some that i think are good, and some that i think are bad... But i stopped to wonder "is it really bad?" i mean... The majority of people in my situation (i.e. Hikikomori NEETs...) are depressed, and many even to the point of commiting suicide. I'm the exact opposite, i feel perfectly fine, in fact over such a long period of time I've never felt better in my life. This is by choice, not by coincidence. I am living a life like this and it would take serious effort to change it, and i'm not sure i even want it to change... So instead of sulking over how my life sucks i suck it up and look at the bright side of things. "oh this is bad" "but this and that and that i get in return so it's worth it".
You can never get the best of everything. But you can always try to look past the bad things about everything. To see the beauty in rot and decay...
But what i was really wondering is one characteristic. Everytime i eat, i choose to do so in front of a computer if possible, and without exception watching something. It can be anime, it can be a movie... Hell i could make do with a youtube video, this is a habit. How many other people have this habit? surely it isn't rare right? I can imagine rich or even famous people doing this, it wouldn't surprise me.
I like to eat in privacy but food by itself is kind of "a dull experience" so i add some entertainment to it. Now that i think of it didn't kings do that in ages past? Hired jesters to entertain them as they ate and such? Hmm.
The good doesn't always outweigh the bad, but that doesn't mean you can't just look past the bad and focus on the good in every situation. Humans can live with and accept "anything" if they just try, this is knowledge i should not have, and should avoid sharing. (Because it's possible to force people to do that. Since i know how that can be done, brainwashings and such, it will play a role in my slavery mechanics, but i'll need to make it "un-obvious" and "un-real" enough so people can't actually learn anything from it... After all, making this world even worse is not one of my goals.)
Yes, i think a lot about things like this.
But now i finally started to realize, i need progress. My progress has been "halted" for long enough. I said i would finish this today, i know i can finish it today... Get the fuck on with it =_=
Instead of progressing, i have some fresh ideas for coding after that code sample i was given i talked about earlier, i am going to review all the code i've written so far and see if i can't improve it with these fresh ideas from a much more active programmer than myself.
Lets see... Here's what i've learned to break it down.
I learned that variables that aren't defined with a reference (e.g. self.variable) are shared between class instances.
I can define variables as methods howere, this means i will not need to use the .self reference for them between instances. (I.e. they aren't shared between instances) so for example i can define "hp = 100" as a method instead of as part of "__init__" or another method, then i can change that "hp" value without using "self.hp" and just type "hp" inside of the class. This doesn't stop me from using self.hp if i want to though. If i'm inside a(nother) method in fact i need to use "self."
Variables defined under methods without the self. reference(i can use anything, but self is just the most common choice, i think i might use local. though at some point, because "local" and "global") are shared between instances of the class. (instance is: variable = class())
I figured out that in "?.stuff = X" i can use a variable to define what "?" is. (so for example:
def somefunction(self, target):
target.stuff += 5
instance = class()
instance.somefunction(otherinstance)
)
^ that was valuable information and what i was asking for when i got the code sample.
self. is actually applied accross the instance. So placing self.method in the class is the same as typing instance.method after an instance has been made.
I can create a class, then use it directly in another class like so:
class class1(object)...
class class2(class1)...
--
In other words, i can use a class as a pre-phase to the instance. That is, it's kind of like a sub-class, but it means i don't have to define all the things underneath the original class. So i can for example select racials in class1, but calculate in class2.... Oh my god, genius... that was exactly what i needed to find out!! all my problems have gone away now! I can finish this!
So i understand a lot more about classes now.
This is great. Sure this is mostly just basic information i should've learned already. But... I didn't, and now i have (after looking at the code for long enough *nods*)
Now it's just how to use this newfound knowledge of mine. Just like i talked about "chaining" the classes before, what i just learned tought me an efficient method to do that!
Before i learned this, i would've tried to call upon the classes inside the other classes instead of just continuing the first class in the second.
I want to first start by making a different starting point for "player" and "npc"...
But wait... I don't need to do that O_O I can just make a method in the NPC base that i can call if the variable in question is the player.
A while later...
I've finally rewritten the whole start of my code, that is race selction, base attributes and racial values. And i've linked certain classes together in a linear fashion so say... skills class willl pick up the base class and then stats will pick up skills (and base with it) and then this will continue until modifiers and everything are all in one big (ugly) whirlpool inside one variable... huff.. puff..
I'm on the downwards slope now, but look at the time! dinner time! nekomonogatari!
...
Hours later...
Downward slope indeed, i've improved my code a whole lot although i have not actually continued it, i've made one modifier work like i want it to (just for testing purposes) while i was modifying/updating the rest of the code.
For the first time ever i am now (genuinely) worrying if code i've written is optimized enough. There's this one single method that i've got that will tell me all about it after i've written some more. But what it does is update/check the levels of everything (specializations, skills, sub levels, power level) all in one command. That is ->A LOT<- of things to do at a time, at least more than i've ever asked any program of mine to do. I haven't tested it yet though... i hope it can work. But after i test it, if i am satisfied with the performance, i'll have to test it on a low-end computer too (just to be sure it's not my 8 logical core's fault that things work) or well.. i could just assign only 1 of it's cores to the process..
I already thought of one pretty good way to optimize it though... But without it (my computer, even on only 1/8 cores) did it all in like a millisecond O_O still, a bit of optimization never hurt anybody (i think).
This optimization (in question) should boost the speed quite a bit. as it turns a whole while loop into 1 variable (That is, the while loop is already run earlier in the code, so i'd be running it twice for every-single-specialization in the code. but despited doing that it still works in a millisecond! processors are amazing!)
and... i'm... done..
Yes! I (oh so very much) complicated my cote a lot, which was the price i paid for simplifying it's use (a lot). Tradeoff is a tradeoff, and what's better is that i even optimized it, not to say i couldn't have optimized it better (i could remove a few lines not needed, for example "return ..." lines that aren't in use anymore but i kept around just in case) but this code is starting to look pretty fucking good. I'm honestly surprised, i did not expect it to turn out this well when i started (but well.. look at how long it's been taking, so it god damn bettered look good and work well damnit!)
Better news is that writing this (up till this point) has forced me to remember all of my dormant programming skills that i haven't used for a long time (like half a year or more) meaning from this point onward everything new i learn will actually be "new" and now i have a more clear access to my own personal resources than before (since i have re-awakened :3 )
At this (wonderful) point, i still have an hour or 2 left to work, so lets see how far i'll go with this...
Like i said, i'm on a downwards slope which means that the rest will be easy, but the one thing i'm wondering though is that i actually need 2 methods for stats calculations.. or do i? i was thinking i need 1 for the attributes/skills modifiers, and another for taking in items, and buffs and stuff.. but no... no i don't need another class for it, just another variable is all.
So i need "real" = "base" + "modifiers" + "items/buffs"
and for some stats like HP i need to set up certain values like
"base" (base hp with no items)
"base + modifiers" (max hp with items/buffs)
"current" (max hp - damage taken)
Oh right, i almost forgot... and then i need to make the modifiers for the skills too @_@ yeah, downward slope maybe, but i think "easy" might be a bit of an overstatement.
So let's see. the real problem is... what order do i do it in...
Ok, i'm gonna place the stats, and the modifier system in the same class (since stats are mostly modifier based from the start anyways) and i'll have one sub-class named "oddities" (or something similar) where i unfuck the system in context with skills that rely on stats and stats that rely on skills.
Yes. Something like that.
First step: sort out the oddities
Sexual Endurance(Stat) depends on Sex (Major Skill)
Vaginal Capacity(Stat) depends on Intercourse (Specialization)
Libido & Sensitivity (Stats) depend on Sex (Major Skill)
Etiquette (Stat) depends on Social (Major Skill)
Dominance (Stat) depends on Leadership (Specialization)
Seduction (Specialization) depends on Attractiveness (Stat)
(Slave)Training (Specialzation) depends on Dominance (Stat)
Speed (Stat) depends on Free Carrying Capacity (Stat) <- An oddity among oddities.
Hit & Crit Chances (Stats) depend on the weapon/magic skill <- A complication rather than oddity
Ok,i now that i have that down... I can form a system.
Lets see heres what i need to code
Variables: Base Value(Done), Modifier bonuses(not done), total/final value(not done)
Modifiers: Attributes (Perks for example, i also need a method for refreshing attribute values after.)
Modifiers: Skills (This is in most cases just attributes.)
Modifiers: Stats (This is in most cases attributes or power level)
I should start by writing the modifiers for the skills... Then in the case of Seduction and Slave Training i will have to think of a solution.
The rest of the problem solves itself already really. Hit and Crit chances should be a class or method of their own since these will be a bit more complicated than just numbers. (Dex, Skill, Enemy values are all modifiers for them...)
But before i write the modifiers for the skills, i need to write them for the attributes. Because attributes (in the end) affect everything.
I updated my Games list on this blog just now. I figured since i canceled Yrja's Torment i should well... Make it more official.
So right. Attributes!
First i changed my "attributes" variable to "base_attributes" variable...
I started this by finishing off the "Attributes" they are now finished, ready for use!! (awesome right?) they have a "Base" value, a "Modifier" value and a "Total" value, and i've got a method which prints them all together! (mostly for testing/debugging purposes, but also because i want to display all these values in-game eventually) :)
By the time i was done though... it was 3AM, but the rest really will be easy, i've made a bit of a system you see :) (The Base/Modifier/Total system that is. It will work for the stats and skills just as well as it did the attributes and when that's done i think i'm actually done with this code. It'll only take three cups of coffee to finish this off!)
I would've finished it today if i hadn't slacked as much as i did and spent so much time "thinking" instead of just "coding" and seeing how things turn out :P
No comments:
Post a Comment