Sunday, February 5, 2012

Sex System and Alchemy Rewrites

I must post my personal frustrations at the sex system and alchemy. I feel conceptually they are a great idea but they simply DO NOT function as intended. The combat system, magic, and equipment all work great however, and the primary reason for this is that I accumulated more (and proper) knowledge on how to program.

I've decided to rewrite the sex system and alchemy for the next update, it shouldn't take too long (I know, I say that a lot sometimes :P) but it really has to be done. I'm really frustrated that people are having the sex system pretty much lock up the game on them, that's unacceptable in my book as it pretty much disrupts the entire flow of the game. The good news is that since the UI is done for both systems, I just have to rewrite the parts of the code that are mind boggling stupid. For example, I rewrote this part of the sex system last night:

Before


Click on a button, game tells sex system what button you pressed via a string (it basically sends a word that I typed manually to the code that handles what you pressed), then goes through a loop in which it checks the string it sent, then sees how an NPC will react, then it fires the action and each action individually tells the continue button to appear and then disables all the buttons so the NPC can act.

What the?!


Now


You right click anywhere on the screen to pull up a menu and enjoy the larger text box and it then simply runs each action. Each action calls a function to check how an NPC would react (so it's not being calculated separately for each action) and then runs a subroutine to simply turn the action over to the NPC.

The best way I can explain it is that now the logic behind this process is a straight line instead of some weird highway that makes you get off one exit, go into rotary only to get back on the same highway and then exit off into another rotary, and then drive 10 miles before getting back on the same highway before arriving at your destination.


I haven't looked at alchemy but it's really simple to rewrite for me (at least conceptually). I simply will make a dictionary which contains each alchemy recipe and the ingredients required rather then what it is now:

Incomprehensible.


Hope this made sense, I'm just venting a bit about how stupid I used to code some things :P I know there are probably still better ways to do what I'm doing now, but this is also paradoxically part of the fun for me. I enjoy learning from some of my horrid mistakes because not only does it make me laugh a bit at myself, but I learn quite a bit which is one of the reasons I'm undertaking this project.

I won't have a preview build for a bit as I totally screwed up the UI for the sex system (to the point where it's unplayable) but in case I really screw it up I backed up everything before I began reworking this so nothing will be lost :P I'll post the update notes for the next version as I work on them and also will put a post up here when a preview is available so those that want to get a jump on testing the new stuff will be able to.


4 comments:

  1. trust me i understand your frustration x.x I started programming a flash game in AS3 about a year ago for fun and have had to rewrite how the combat functions work several times to streamline the process x.x oh well the good thing is you are now better prepared for when you finish with pornarium and start another game some day in the future :) either way take your time when you rewrite the code and make sure it does everything you need or you might be forced to rewrite it again in the future x.x

    ReplyDelete
  2. Oh man, I know what you're going through. I just had to optimize out a hundred lines of code rewriting an item handler today. It's really frustrating to have to do it, but when it's done your left staring and saying "mmm, dat code, I can implement whatever the fuck I want to, now!"

    ReplyDelete
  3. If you're manually backing up your files, I recommend you look into revision control software. Free recommendations: Git, svn.
    It can be a bit of a hurdle to get started with using those, but it makes tracking changes (and backing them out if necessary) much, much easier.

    ReplyDelete
  4. There are always better ways... it's your choice if you want to discover them :p

    ReplyDelete

Follow us by Email!

Total Visitors