Jump to content

Photo

No Name Yet -- CD'awgs Non-ZC Temporary Dev Log

C++

  • Please log in to reply
101 replies to this topic

#16 Gleeok

Gleeok

    It's dangerous to dough alone, bake this.

  • Members
  • Real Name:Pillsbury
  • Location:Magical Land of Dough

Posted 07 October 2015 - 04:59 AM

Cool. Yeah, definitely need power-ups! But after playing Zodiac I don't think that will be a problem. Heh. :P And yeah, you shouldn't be loading any resources on disk every frame! Not good.

Sure, send me a line. You also might want to think about putting your project under version control. It lets you track and undo changes to any file, view previous versions, helps with tracking down newly introduced bugs, etc. It also acts as a back-up in case something bad happens, and is pretty much the easiest way for someone else (or a team) to deal with working code. There's also private repositories if you want it out of public view; I think bitbucket still offers that for free. If you ever need input on stuff or want to get me in chat, or anything else like that, you kind of have to PM me first--it's not that I'm busy in the evenings, it's just that I don't really meander around the internet as much these days.


Awesome idea #1: The Soldier is actually a bio-suit with a smaller (possibly flying) tank that comes out!!! 8)

#17 C-Dawg

C-Dawg

    Magus

  • Members

Posted 07 October 2015 - 09:18 PM

Im using dropbox for backups at the moment, but it's not really set up for collaboration, just backup.  Once I get things in some semblance of what I THINK is order, I'll look into that if you wanna join the project in an overseer-type capacity.  ("Hey, knucklehead, you're gonna cause slowdown unless you fix X and Y...")

 

Also, your Awesome Idea #1 is VERY CLOSE to something I have planned!  One of the item types for the Soldier I have planned are little helper robots that to various things.  Some will be like Item 1, Item 2, and Item 3 from MM2, and others will do other things.  (Hence why Doodads as a separate game object are so important).   A small tank-like thing is not out of the question!


Edited by C-Dawg, 07 October 2015 - 09:18 PM.


#18 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 07 October 2015 - 09:56 PM

You should totally give Gleeok your code for spike collision. Then he will be forced to might use it >:D



#19 C-Dawg

C-Dawg

    Magus

  • Members

Posted 07 October 2015 - 10:01 PM

Eh, it's just the regular collision detection function (is there a spike at your X coord plus your X velocity) with an added check to see if you're standing directly on top of it while not moving.  I'm sure ZClassic does it similarly in sideview, but it counts "standing on" as being one tile above it rather than actually touching it.



#20 newstarshipsmell

newstarshipsmell

    Musky Pawgazer

  • Members
  • Location:Skure, Dezoris

Posted 08 October 2015 - 12:08 AM

This is looking pretty sweet!

 

One thing I always thought would be cool with a Blaster Master game is having the camera zoom in when you jump out, so your character is more normal sized and whatnot, and zoom back out when you re-enter your vehicle. If the zoomed-out artwork is fine enough, you could just zoom all the pixels to 2x2 pixels in zoomed-in view; it would look more pixelated - but that isn't really a bad thing to people like me. Alternatively, you could make more detailed tiles for everything and just transform from one to the other as it zooms - dunno how that would look or work out though.

 

Anyways, your character isn't as small compared to the tank as in Blaster Master, so it's not really a suggestion for your game here, just ramblin'. Agree about the overhead areas - they were the worst part of BM. I have faith you could make them interesting, but I also suspect your desire to omit them is the best option.

 

But yeah, looking forward to eventually playing this too. You got real talent, man. I wondered what your artwork would look like, not restricted to ZC, and wow, this is fantastic.



#21 C-Dawg

C-Dawg

    Magus

  • Members

Posted 08 October 2015 - 09:16 AM

You compare the size of the screen shots, you'll see that your dream of zooming in is already a reality.

#22 newstarshipsmell

newstarshipsmell

    Musky Pawgazer

  • Members
  • Location:Skure, Dezoris

Posted 08 October 2015 - 10:06 AM

You compare the size of the screen shots, you'll see that your dream of zooming in is already a reality.

ROFL! I didn't even notice that.

#23 C-Dawg

C-Dawg

    Magus

  • Members

Posted 11 October 2015 - 06:38 PM

I can't get friggin' doodads to spawn properly.  Doodad inherents float x from GameObject class, but when I try to spawn it at a particular x coordinate, it keeps spawning at 0,0.  Because... reasons?  Argh!

 

Anyway, I did tweak some of the code controlling collision detection so that those jump-up-but-not-down type blocks work.  You know, like hills in SMB2.  Also found and voided a bug that had caused slow movement when you're in a different room from the tank.



#24 Anarchy_Balsac

Anarchy_Balsac

    Quest Builder

  • Members

Posted 11 October 2015 - 07:01 PM



I can't get friggin' doodads to spawn properly.  Doodad inherents float x from GameObject class, but when I try to spawn it at a particular x coordinate, it keeps spawning at 0,0.  Because... reasons?  Argh!

 

Anyway, I did tweak some of the code controlling collision detection so that those jump-up-but-not-down type blocks work.  You know, like hills in SMB2.  Also found and voided a bug that had caused slow movement when you're in a different room from the tank.

 

Does the spawn use a different class than the doodad?  If so, that alone could cause the problem. 

 

Try something along the lines of:

 

spawn_doodad(doodad.x, doodad.y);

 

Edit - ACTUALLY the problem is most likely that you're spawning a doodad that doesn't exist yet, so any variable assigned to it is irrelevant.  Instead, try passing the x and y variables to the class that your spawn function is located within.


Edited by Anarchy_Balsac, 11 October 2015 - 07:48 PM.


#25 C-Dawg

C-Dawg

    Magus

  • Members

Posted 11 October 2015 - 09:50 PM

I dunno about that.  Here's some relevant bits of code.

 

This little jobber lives in GameObjectManager and keeps an eye scanning the on-screen tiles for one that indicates an instruction to spawn a Doodad:

                // SPAWN DOODADS
                if((CurrentBlock->user1>=DOODAD_RANGE_START)&&(CurrentBlock->user1<=DOODAD_RANGE_END)){
                    fprintf(stderr, "X calculated by GameObjectManager = %f!\n",searchX-xOff);
                    CreateDoodad(CurrentBlock->user1,CurrentBlock->user3,searchX-xOff, searchY-yOff, 0,0, xOff, yOff); // Need to un-correct for offset before spawn
                    MapSetBlockInPixels (searchX, searchY, 0);
                }

Heres' the function it calls (in relevant part).  You can see all my trace prints along the way:

void GameObjectManager::CreateDoodad(int doodadType, int doodadSubType, float x, float y, int dirX, int dirY, int xOff, int yOff)
{

    ALLEGRO_BITMAP *setup_bitmap = NULL;
    int velX = 0;
    int velY = 0;
    int boundX = 0;
    int boundY = 0;

    if(doodadType == MOVING_PLATFORM_VERT){

        Floating_Platform_Doodad *bornDoodad = new Floating_Platform_Doodad();
        bornDoodad->Init();

        setup_bitmap = al_create_bitmap(64,64);
        al_set_target_bitmap(setup_bitmap);
        al_clear_to_color(al_map_rgb(255, 0, 255));
        setup_bitmap = al_load_bitmap("MarsFloatingPlatform.png");

        int boundX = 64;
        int boundY = 64;

        dirX = -1;
        dirY = -1;
        
        fprintf(stderr, "X use to call Doodad::Spawn = %f!\n",x);

        bornDoodad->Spawn(x, y, velX, velY, dirX, dirY, 128, 64, setup_bitmap);

        fprintf(stderr, "Doodad X = %d!\n",bornDoodad->GetX());
        fprintf(stderr, "Doodad Y = %d!\n",bornDoodad->GetX());
        // Set up movement; vertical doodads move along Y axis only, and move up and down from spawn point
        // in distance measured by user2.
        bornDoodad->ProvideRunData(bornDoodad->GetX()+xOff,bornDoodad->GetY()-doodadSubType+yOff,bornDoodad->GetX()+xOff,bornDoodad->GetY()+ doodadSubType+yOff);

        fprintf(stderr, "first X = %d!\n",bornDoodad->GetX() );
        fprintf(stderr, "first Y = %d!\n",bornDoodad->GetY()-doodadSubType+yOff );
        fprintf(stderr, "second X = %d!\n",bornDoodad->GetX()+xOff );
        fprintf(stderr, "second Y = %d!\n",bornDoodad->GetY()+ doodadSubType+yOff );

        doodadList.push_back(bornDoodad);

    }
}

Here's the chain of inheritance for the Floating_Platform_Doodad class:

 

Spoiler

 

Doodad.h1

Spoiler

 

And then, finally, the class itself:

 

Floating_Platform_Doodad.h

Spoiler

 

Floating_Platform_Doodad.cpp

 

Spoiler

 

Now, the Spawn function lives in Doodad.cpp, so that's here:

#pragma once

# include "Doodad.h"
#include "Globals.h"
#include "GameObject.h"
#include "mappy_A5.h" // I want game objects to have access to the size of the tile map, so I'll include the header.
#include <stdio.h>

Doodad::Doodad()
{}


void Doodad::Destroy()
{
        GameObject::Destroy();
}

void Doodad::Init(ALLEGRO_BITMAP *image)
{

    //GameObject::Init(0, 0, 0, 0, 0, 0, 32, 32);

    if(image!=NULL){
        Doodad::image=image;
    }
}

void Doodad::Spawn(float passedX, float passedY, int velX2, int velY, int dirX, int dirY, int boundX, int boundY, ALLEGRO_BITMAP *image)
{

    fprintf(stderr, "X passed to Doodad::Spawn = %f!\n",passedX);

    animationCounter = 0;
    curFrame = 0;
    frameWidth = al_get_bitmap_height(image);
    frameHeight = al_get_bitmap_height(image);

    SetID(DOODAD);

    if(image!=NULL){
        Doodad::image=image;
    }

    active = false;
    alive = true;

    fprintf(stderr, "X before calling GameObject = %f!\n",x);
    fprintf(stderr, "passedX to send to GameObject::Init = %f!\n",passedX);

    //GameObject::Init(passedX, passedY, velX2, velY, dirX, dirY, boundX, boundY);

    SetX(512);
    SetY(512);

    if(x!=passedX)
    {
        fprintf(stderr, "X and passed X not equal; trying again?\n");
        x = passedX;
    }
    fprintf(stderr, "passedX at end of Doodad::Spawn = %f!\n",passedX);
    fprintf(stderr, "X at end of Doodad::Spawn = %f!\n",GameObject::x);
}

The movement of the platform is screwy, too, but everything seems to stem from the Floating_Platform_Doodad's x, y, firstX, firstY, and so forth all being ZERO once the object is actually instantiated.  Even though, according to the output I get from those trace prints, all the functions (methods?) are getting the right info.


Edited by C-Dawg, 11 October 2015 - 09:57 PM.


#26 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 11 October 2015 - 10:08 PM

Do you use a debugger, and do you know how to set a watchpoint? This'd be a good time for it.
I don't see the problem immediately, but I'll look at it a bit longer.

#27 C-Dawg

C-Dawg

    Magus

  • Members

Posted 11 October 2015 - 10:13 PM

I've only recently ventured into the dark realms of C++ in depth; havn't learned to use the debugger yet.  I suppose now's as good a time as any, huh?  I'll look up some resources on Visual Studio 2010 and give a look-see.

 

EDIT: By the way, THIS is the first print statement that gives me a 0:

 

    fprintf(stderr, "X at end of Doodad::Spawn = %f!\n",GameObject::x);

 

Which is odd, since the line JUST BEFORE I told it to make x = passedX...


Edited by C-Dawg, 11 October 2015 - 10:14 PM.


#28 Deedee

Deedee

    Bug Frog Dragon Girl

  • Moderators
  • Real Name:Deedee
  • Pronouns:She / Her, They / Them
  • Location:Canada

Posted 11 October 2015 - 10:20 PM

Maybe passedX = 0?



#29 Saffith

Saffith

    IPv7 user

  • ZC Developers

Posted 11 October 2015 - 10:25 PM

Hm...
fprintf(stderr, "X at end of Doodad::Spawn = %f!\n",GameObject::x);
x is an int, so it should be %d. Whatever it prints will be wrong.

#30 C-Dawg

C-Dawg

    Magus

  • Members

Posted 11 October 2015 - 10:25 PM

Not according to the trace.  passedX (Renamed from x just in case that was the problem) shows up as like 512 which it should.

 

EDIT: x is defined as a float in GameObject.h...?  OH HO!  Its not!

 

EDIT2: Fixing Spawn and it's progeny to accept ints didnt change the behavior.  Hrm.


Edited by C-Dawg, 11 October 2015 - 10:33 PM.




Also tagged with one or more of these keywords: C++

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users