Castlevania like exploration. My methods...

Started by R4L, Fri 29/06/2007 04:04:15

Previous topic - Next topic

R4L

Its a serious project for me, and my first foray into more advanced scripting.

So far, I'm using a number of modules to do most of the work (cheater! :)) which include the following:

Grid Based Inventory
Pixel Perfect Collisions
Shadow (gfx effect, used when jumping)
Lake (gfx effect, used in the beginning)
Particle Engine (gfx effect, used for hit frames)
Parallax Scrolling (gfx effect, to give the dungeons some depth)
Bernie's Simple Platform Movement

Additional modules that didn't make it:

Finite State Machines (used for main A.I. for enemies)
NOTE: This is a bother, because I was planning to use this for A.I. but it needs to be updated for 2.72.

Credits (again, needs to be updated)

Room properties would be extremely easy. I'm thinking of using the OtherRoom module  for some key parts of the game.

Graphics, while not my forte, are going to be simple, but effective. I'm hoping to incorporate Akumayo's Particle engine for some nice effects, as well as using Steve McCrea's Lake module and the Parallax Scrolling module for some interesting environments.

Now, onto the problem. I can do most of this by myself, I think. The only thing that bothers me is the A.I., and using different button combos to do certain things. An example would be this:

Say I have a skill that requires to hit left, down, right and attack for a special 
attack. At the moment I don't have any idea as to how I could get this to work. 
I'll have to think it over.

Then again, maybe I can't do all this by myself. Just reading this, it sounds like it, but I need a second opinion on this before I attempt. Now the game won't rip-off the exact Castlevania game play elements (like secondary weapons, spells, and familiars) but I do expect it to have the traditional ones.

Awaiting your opinion...

R4L


Gilbert

One way is to save the recent inputs with a circular queue and identify patterns.

It also depends on how you accept inputs, if you use on_key_press() it would be easier to handle but may not be doing all you want in action games (like trying to check if a key is being pressed for a period, etc.), if you use IsKeyPressed() in repeatedly_execute() it's harder to handle (because even if you tap a key it's detected to be pressed for a few loops, etc.) but have more freedom in implementation.
I'll show my idea for the on_key_press() way because it's simpler to handle. Something like this (Warning: some pseudo codes ahead!):
Code: ags

int inputqueue[20];
int queuehead, queuelength;

function queueadd(int data){//add an element to the circular quque
  queuehead++;
  if (queuehead>=20)queuehead=0; //wraping
  inputqueue[queuehead]=data;
  queuelength++;
  if (queuelength>10)queuelength=20;
}

function returnqueue(int index){
  //find the data of the last indexth element, returns -1 if out of bound
  if (index>queuelength-1) return -1;
  int tempindex = queuehead-index;
  if (tempindex<0) tempindex+=20;
  return inputqueue[tempindex];
}

function clearqueue(){
  queuehead=0;
  queuelength=0;
}

function on_key_press(int keycode){
  queueadd(keycode);
  if (attack pressed){
    if ((returnqueue(3)==LEFT)&&(returnqueue(2)==DOWN)&&(returnqueue(1)==RIGHT)){
    execute special move
    clearqueue();
  } else {
    normal attack codes
  }
}




R4L

Hmm, I see what you mean. I can understand the on-key-press bit, but I see you used an array for... something. :) What does that segment do anyway?

Gilbert

That's used for implementing a circular queue.

R4L

Ooooo..... I missed that part. I'm sort of a skimmer. Thanks for the help Gilbot.

So, does this work similar to a cache of some sorts? Are the key presses saved?

Gilbert

Yes, it is somewhat a cache to save the previously pressed keys.

Shane 'ProgZmax' Stevens

You might consider another engine like Game Maker if you're really set on making a true castlevania clone.  AGS wasn't designed for that kind of game and you're making it harder on yourself than you need to.  Having used both engines to make games I can safely tell you that you will cut development time at least in half using game maker for this specific kind of game (because that's what it's designed for).  Much like ags it has plugins that handle the more mundane aspects like collisions and particles if you don't want to script it yourself.  Bear in mind this is coming from someone who has made a platformer in ags and in game maker, and I have a pretty extensive knowledge of programming in general so I'm not just blowing smoke.  It's something to think about.

R4L

I did consider Game Maker. I played a game made with it, thats similar to the Castlevania games. It's called Soldexus.

But I think this is a good way to learn. I have the whole summer to myself (well, almost) and I thought that this would be the time to work on a game. I'm tired of making adventure games, so I wanted to try something different. I'm lucky that there are modules around, or else this would be harder on me. Besides, I know AGS more than I know Game Maker, and I like AGS a lot more.

I'm planning out the game play right now actually. It isn't going to be a true Castlevania clone, but something close to it.

Well, thanks for the help. I really needed second opinions. I'll save the A.I. for last Gilbot, and Prog I will consider Game Maker, although I have to admit that I want to stray far from it.

R4L

#8
Bump.

I'm having a problem now. I thought that this would work, but it obviously isn't.

I used this bit of code I wrote myself:

Code: ags

enum Keyboard_Direction{
  eKeyboard_Direction_Left, 
  eKeyboard_Direction_Right, 
  };

int Keyboard_DirectionLeft = 375; //left arrow
int Keyboard_DirectionRight = 377; //right arrow

function Attack(char){
  
  if (IsKeyPressed(89) == 1){
    
    cEgo.LockView(2);
    
    if (Keyboard_DirectionRight){
      
      cEgo.Animate(2,3,eOnce,eBlock);
      cEgo.UnlockView();
  }
  
    if(Keyboard_DirectionLeft){
      
      cEgo.Animate(1,3,eOnce,eBlock);
      cEgo.UnlockView();
  }
  
}

  else { 

			return;
}

}


As you can see, it's for an attack animation. Now I'm not sure how this works, but I used some enum, thinking it would store the character's current direction. I think thats totally wrong :D. I need to have the direction that the character is facing to be stored, so I can check to see which loop to play (left or right) in the attack animation. Am I supposed to define the directions? Am I even close?

Gilbert

#9
I'm not quite sure what you're going to archieve with that part of code.
1. You defined the enum Keyboard_Direction but it's never used.
2. You defined the variables Keyboard_DirectionLeft(Right) to have some keycode values but check whether these variables are non-zero in the attack code? (Unless their contents would be changed ingame these variables are always non-zero (375 and 377) so the two if (KeyboardDirectionLeft/Right) parts will ALL be executed...

A suggestion (pseudo code ahead):
Code: ags

enum Keyboard_Direction{
  eKeyboard_Direction_Left, 
  eKeyboard_Direction_Right, 
  };

Keyboard_Direction current_dir; //Variable to store the current direction.


You need to check whether the character has changed the direction he's facing in game, probably in the routine to check whether left or right arrows are pressed:
Code: ags

if (player is going to face left) {
  current_dir = eKeyboard_Direction_Left;
  //blah bla bla
} else if (player is going to face right) {
  current_dir = eKeyboard_Direction_Right;
  //blah bla bla
}


Code: ags

function Attack(char){
    if (IsKeyPressed(89) == 1){
      cEgo.LockView(2);
        if (current_dir==eKeyboard_DirectionRight){
            cEgo.Animate(2,3,eOnce,eBlock);
            cEgo.UnlockView();
       } else if(current_dir == eKeyboard_DirectionLeft){
            cEgo.Animate(1,3,eOnce,eBlock);
            cEgo.UnlockView();
      }
  } else { 
    return;//This else part is not really necessary
  }
}


One problem I see is that you want to make some complicated thing but without enough knowledge to do so at the moment, I highly recommend you to try to make more simpler games first or, especially in this case, try to reconsider better alternatives for these kind of games, like Game Maker, etc., as AGS wasn't designed for these kind of games. While it isn't impossible to use AGS to make these kind of games with very decent result, it's not easy without enough advanced knowledge and patience.

R4L

Nice psuedo code Gilbot.

I know the project is hard, and it seems unfit for me, but I really want to become more flexible with AGS. I don't want to start at Game Maker; I already have once, and I don't like GM at all. I have made simpler games (unreleased of course) along the lines of non-adventure. I even made my own RPG.

I understand what you were saying about the enum. I see that all I needed was to change a few lines. I was almost on the right track!  ;)

EDIT: It also works now!

Stacy Davidson

Just my $0.02 on platformers, I have looked pretty deeply into GameMaker, and honestly unless you're just a kid wanting to get your hands dirty with some simple game design, it is very nearly useless.  The games all have issues with getting stuck, weird jumping bugs, and overall glitchy movement. 

There are a handful of Castlevania clones on the GameMaker site, and none of them come anywhere near the play control of the original.  Play control may not seem as important to people who are not fans of the thumb-candy genres, but believe me when I say it is every bit as important as any major element of an adventure game like the quality of dialogue and puzzles.  If you opened up a new adventure game today, expecting a late SCI or SCUMM experience, and you got a text parser, a movement system without pathfinding, or a keyboard-only movement system, you would most likely toss it out as totally behind the times.

The minutiae of the gameplay controls is what makes a platformer fun and unique,  and without it you really don't have anything at all.

While I agree AGS clearly wasn't made for platformers, and using it to design one would be a hefty task, it wouldn't surprise me if you'd have better luck with overall quality than with GameMaker.

That being said, platformer enthusiasts should probably check out Torque Game Builder (TBG) and the Platformer genre kit available for it.  There's also an isometric adventure kit (truly, it's more for RPGs). 

-s

-Stacy Davidson
Jack Houston and the Necronauts
Warbird Games
www.warbirdgames.com

Shane 'ProgZmax' Stevens

Any control problems you see with GM are the fault of the programmer/scripter and not the engine.  I can safely say this since I've done platformer code in it and had smooth and responsive controls.  Also, I'm not sure exactly why you necroposted a 2 year old thread just to mention something that the original poster probably doesn't even care about anymore?

SMF spam blocked by CleanTalk