27 year old Geologist and amateur game dev

Report RSS The Codewich Horror

Posted by on

Preamble

Hello again everyone. As I've finally explained to almost everyone the blog's goals and the project I'm working on (That would be blogs 1 and 2 respectively, for those interested), the length of these blog reports should start growing shorter. So if ever you've looked at what I'm writing, and decided you had something better to do, than read a late 20-something prattle on about nothing for an hour: Good News! It should only slice like, 15 minutes out of your day now tops... Probably more just a hair over that when I am feeling especially verbose. Bit of quick news: this will probably be my only post for the week. I've had a tragedy in the family, and I will be away from my keyboard until Sunday. So, it'll likely be late next week before I put out another one of these. Anyway, on to the update!

Update

Well I've spent the last 2-3 days researching how to proceed from here, and this is what I've got.

Currently, there are states (These are independent scripts, swapped between, based on stimuli effecting the monster) for Idle, Chase, and Scent Tracking. The idle state handles the movement, the Chase handles the monster zeroing in on the player if the player comes inside a radius, and the scent tracking detects scent markers inside of a radius and follows them. None of these radii obey collisions as of now. The problems faced, are detailed in the last blog, but basically: The movement script that happens in the idle state, is causing the state swapping if-then functions to not work. Further, implementing detection scripts one at a time, causes all kinds of bugs. That means I have to go back and debug the existing scripts to fit the new script... screwing up the old scripts... it's just a mess.

The solution: The new states will be Idle, Chase, Scent Tracking, Hearing Alert, and attack. General movement, will be handled by coding the monster object, rather than in it's own standalone idle script. For those who aren't familiar with Game Maker Language: You can apply code directly to objects, or you can get the objects to reference scripts, when you are constructing AI. If you push everything off onto scripts and states, then you don't have to have uber complicated if/then statements set up for every possible situation the object will encounter, while it rolls through the lines of logic necessary to decide what to do. The movement code I am using will be built into the monster, and not be part of the scripts from now on, because that way the scripts can reference variables used in the movement script, without needing to clog up the script by re-declaring the variables for each state for different styles of movement. Rather, the references can be pulled from the main object's code and applied to the scripts themselves. This was already somewhat built into the existing system, yet the aforementioned problems were causing me to have to restate variables over and over while I tried to patch up the code.

Further, the state switching will be unloaded onto a step event (A check that happens once every Step of the game, there being 30 steps a second), that checks each step which state applies. This will be done with a Switch function. Currently I'm using a series of if-then statements in each script. The problem is, that while now it looks like:

If (track <= scent_Range && object_exists (obj_scentMarker)

{

state = scr_enemy_scent

} else if (dis <= sight_Range)

{

state = scr_enemy_Chase

} else if... Etc.

In Each and Every script... I should be able to reduce All of that down to:

switch (state)

Case 1: "chase"

(dis <= sight_Range)

break;

Case 2: "Track"

(track <= scent_range)

...Only being checked in 1 place, once a step by the monster object. Further, if you look at the new switch function setup, where it says "Break" that means (According to what I've read) that each 'Case' to 'break' is one function, that once it's been checked, returns a simple True/False, and doesn't require going through a Long line of Boolean logic, like the If-Else statements I was using before. It reduces the CPU use in other words. Also it'll be more organized, which I can tell you, is a freaking blessing in my opinion.

Now, I know I'm probably going to regret this, but I'm JUST focusing on the monsters detection for now. Attacking, combat... I still haven't hammered that out. I will probably spend the next few days I'm away, doing some theorycrafting on the combat. I'm wanting it to be frantic and difficult. The player character isn't meant to be some avatar of martial prowess, so he shouldn't be able to beat up monsters with half their nerve endings missing, and no sense of pain, who operate via parasitic slug pulling them about like flesh marionettes. I also need to answer for myself some questions about the monsters from a story perspective. Basically, the monsters will be reanimated corpses, that things didn't quite work right. They were either incomplete, or too far degraded to bring back as something quite human, so the badguy started cutting corners. In doing so, he found a way to animate them, to get what he wanted... but the result is less: Coherent person awaken from long sleep, and more: Forcing the consciousness through the pain and lack of neural connectivity, and putting it in the hands of something that... well... controls the dead person like a fleshy marionette. So... how much coherent thought and memory would that monster have? That'll determine some of the mechanics of monster detection.

Still, got tonight and tomorrow, So I'm going to try and throw the framework I discussed above, in tonight and see how it works. Wish me luck, and as always, thanks for reading!

Post a comment

Your comment will be anonymous unless you join the community. Or sign in with your social account: