• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.

Archived

This topic is now archived and is closed to further replies.

ViPeR007

bad problem...

1 post in this topic

I have a pretty good pattern AI working right now and I just finished up the last part for my last enemy. What the patter code does is it makes the enemy move left or right and then shoot when I want them to. I have been using the same struture (and sometimes code) for all of the other ememies and they have worked fine but this one has a problem. It won''t fire the weapon, I tested to see if it was preforming the drawing function and it is, then I tested to see if it was performing the firing function and it was (well I already knew that because it was playing the firing sound). I double checked that I was doing everything the same way as I was doing it before and I was. So now I am completely clueless why this is happening. Im pretty sure that its in the actual gun''s code not the AI so here is that code (this code is almost the exact same as all my other gun''s code that works find): void Init_Bosscannon(void) { Load_Bitmap_File(&bitmap16bit, "BOSSMSL.BMP"; #if 1 for (int msl=0; msl<MAX_BOSSCANNON; msl++) { Create_BOB(&bosscannon[msl],0,0,4,8,2, BOB_ATTR_VISIBLE / BOB_ATTR_MULTI_FRAME, DDSCAPS_SYSTEMMEMORY); for (int frame=0; frame<2; frame++) Load_Frame_BOB(&bosscannon[msl],&bitmap16bit,frame,frame,0,BITMAP_EXTRACT_MODE_CELL); Set_Anim_Speed_BOB(&bosscannon[msl],1); bosscannon[msl].state = BOSSCANNON_STATE_OFF; } #endif #if 0 Create_BOB(&bosscannon[0],0,0,4,8,2, BOB_ATTR_VISIBLE / BOB_ATTR_MULTI_FRAME, DDSCAPS_SYSTEMMEMORY); for (int frame=0; frame<2; frame++) Load_Frame_BOB(&bosscannon[0],&bitmap16bit,frame,frame,0,BITMAP_EXTRACT_MODE_CELL); Set_Anim_Speed_BOB(&bosscannon[0],1); bosscannon[0].state = BOSSCANNON_STATE_OFF; for (int msl=1; msl<MAX_BOSSCANNON; msl++) { memcpy(&bosscannon[msl], &bosscannon[0], sizeof(BOB)); } #endif Unload_Bitmap_File(&bitmap16bit); } void Delete_Bosscannon(void) { for (int index=0; index<MAX_BOSSCANNON; index++) Destroy_BOB(&bosscannon[index]); } void Move_Bosscannon(void) { for (int index=0; index<MAX_BOSSCANNON; index++) { if (bosscannon[index].state == BOSSCANNON_STATE_ON) { Move_BOB(&bosscannon[index]); if (bosscannon[index].y > 600 ) { bosscannon[index].state = BOSSCANNON_STATE_OFF; continue; } } } for (index=0; index<MAX_BOSSCANNON; index++) { if ((bosscannon[index].attr & BOB_ATTR_VISIBLE) && (bosscannon[index].state == BOSSCANNON_STATE_ON) && (Collision_BOBS(&ship, &bosscannon[index]) ) ) { bosscannon[index].state = BOSSCANNON_STATE_OFF; counter2 = 0; player_state = PLAYER_STATE_DYING; } } } void Draw_Bosscannon(void) { for (int index=0; index<MAX_BOSSCANNON; index++) { if (bosscannon[index].state == BOSSCANNON_STATE_ON) { Draw_BOB(&bosscannon[index],lpddsback); Animate_BOB(&bosscannon[index]); } } } void Fire_Bosscannon(int x,int y, int vel) { if (bosson == 1 // boss2on == 1) { for (int index=0; index<MAX_BOSSCANNON; index++) { if (bosscannon[index].state == BOSSCANNON_STATE_OFF) { bosscannon[index].x = x; bosscannon[index].y = y; bosscannon[index].yv = vel; bosscannon[index].curr_frame = 0; bosscannon[index].state = BOSSCANNON_STATE_ON; for (int sound_index=0; sound_index < MAX_FIRE_SOUNDS; sound_index++) { if (Status_Sound(fire_ids[sound_index])==0) { Play_Sound(fire_ids[sound_index]); break; } } return; } } } } In Game_Init() I execute Init_Bosscannon, in Game_Main() I execute Move_Bosscannon and Draw_Bosscannon, and in Game_Shutdown I execute Delete_Bosscannon. Does anyone see any errors in this code above? If you think that the AI code will help I can post that up too. Thanx, ViPeR
0

Share this post


Link to post
Share on other sites
The above post is kinda stupid because I just found out that it kinda has to be in the AI code. But if anyone sees an error in the code above let me know. Here is the pattern code:

int pattern_5[] = {OPCB_SHOOT, 0, OPCB_E, 50, OPCB_SHOOT, 0, OPCB_W, 50, OPCB_END,0};
int pattern_6[] = {OPCB_SHOOT, 0, OPCB_E, 50, OPCB_SHOOT, 0, OPCB_W, 50, OPCB_END,0};

int *patterns3[NUM_PATTERNS3] = {pattern_5, pattern_6};
int *curr_pattern3=NULL;
int boss_ip =0,
boss_counter=0,
boss_pattern_index;

Then down in the code a bit is Boss_AI():

void Boss_AI(void)
{

static int opcode3,
operand3;
int index3,
index;

if (state_ready != 0)
{
if (curr_pattern3==NULL)
{
boss_pattern_index = rand()%NUM_PATTERNS3;
curr_pattern3 = patterns3[boss_pattern_index];

boss_ip = 0;


boss_counter = 0;

}
if (--boss_counter <= 0)
{
opcode3 = curr_pattern3[boss_ip++];
operand3 = curr_pattern3[boss_ip++];

switch(opcode3)
{
case OPCB_SHOOT:
{
if (bosson == 1)
{
Set_Vel_BOB(&boss,0,0);
Fire_Bosscannon(boss.x+28-8,boss.y-8,16);
}

if (boss2on == 1)
{
Set_Vel_BOB(&boss2[1],0,0);
Fire_Bosscannon(boss2[1].x+28-8,boss2[1].y-8,16);
}
boss_counter = operand3;

} break;
case OPCB_E:
{
Set_Vel_BOB(&boss,1,0);
Set_Vel_BOB(&boss2[1],6,0);
boss_counter = operand3;

} break;
case OPCB_W:
{
Set_Vel_BOB(&boss,-1,0);
Set_Vel_BOB(&boss2[1],-6,0);
boss_counter = operand3;

} break;
case OPCB_END:
{
Set_Vel_BOB(&boss,0,0);
Set_Vel_BOB(&boss2[1],0,0);
boss_pattern_index = rand()%NUM_PATTERNS3;
curr_pattern3 = patterns3[boss_pattern_index];
boss_ip = 0;
boss_counter = 0;
} break;

default: break;
}
}
}
}

Everything is correctly defined (if it wasn''t it would probably give me a compiler error which I am not getting) and Boss_AI() is executed in the Game_Main() function. I don''t really see the problem is this code at all but if anyone else does let me know.

Thanx,
ViPeR
0

Share this post


Link to post
Share on other sites