It is currently Mon Dec 17, 2018 7:23 am

All times are UTC - 7 hours





Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next
Author Message
PostPosted: Tue Dec 26, 2017 10:13 am 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2777
So do you mean, objects pointing to another structure that has the metasprite/sprite information?


Top
 Profile  
 
PostPosted: Wed Dec 27, 2017 4:22 am 
Offline

Joined: Mon Jul 01, 2013 11:25 am
Posts: 249
Exactly, Enemy for instance, is a specific Object, and any Object own a reference on a Sprite structure (which deal about handling the visual part).
For instance in SGDK the Sprite structure is just about displaying (meta) sprite, and so dealing about VRAM / hard sprite allocation / handling animation etc... but in my view in any game, we should have a more generic Object structure / class which allow to handle IA, logic, ... stuff and this Object structure own a reference on a Sprite internally which handle the display.

Here's the Sprite (and dependencies) structure of SGDK :

Code:
/**
 *  \brief
 *      VDP sprite info structure for sprite resource definition.
 *
 *  \param y
 *      Y offset for this VDP sprite relative to global Sprite position plus 0x80 (0x80 = 0 = no offset)
 *  \param size
 *      sprite size (see SPRITE_SIZE macro)
 *  \param numTile
 *      number of tile for this VDP sprite (should be coherent with the given size field)
 *  \param x
 *      X offset for this VDP sprite relative to global Sprite position plus 0x80 (0x80 = 0 = no offset)
 */
typedef struct
{
    s16 y;          // respect VDP sprite field order
    u16 size;
    s16 x;
    u16 numTile;
}  VDPSpriteInf;


/**
 *  \brief
 *      Sprite animation frame structure.
 *
 *  \param numSprite
 *      number of VDP sprite which compose this frame
 *  \param vdpSpritesInf
 *      pointer to an array of VDP sprites info composing the frame (followed by H/V/HV flipped versions)
 *  \param collision
 *      collision structure
 *  \param tileset
 *      tileset containing tiles for this animation frame (ordered for sprite)
 *  \param w
 *      frame width in pixel
 *  \param h
 *      frame height in pixel
 *  \param timer
 *      active time for this frame (in 1/60 of second)
 */
typedef struct
{
    u16 numSprite;
    VDPSpriteInf **vdpSpritesInf;
    Collision *collision;
    TileSet *tileset;
    s16 w;
    s16 h;
    u16 timer;
} AnimationFrame;

/**
 *  \brief
 *      Sprite animation structure.
 *
 *  \param numFrame
 *      number of different frame for this animation
 *  \param frames
 *      frames composing the animation
 *  \param length
 *      animation sequence length
 *  \param sequence
 *      frame sequence animation (for instance: 0-1-2-2-1-2-3-4..)
 *  \param loop
 *      frame sequence index for loop (last index if no loop)
 */
typedef struct
{
    u16 numFrame;
    AnimationFrame **frames;
    u16 length;
    u8 *sequence;
    s16 loop;
} Animation;

/**
 *  \brief
 *      Sprite definition structure.
 *
 *  \param palette
 *      Default palette data
 *  \param numAnimation
 *      number of animation for this sprite
 *  \param animations
 *      animation definitions
 *  \param maxNumTile
 *      maximum number of tile used by a single animation frame (used for VRAM tile space allocation)
 *  \param maxNumSprite
 *      maximum number of VDP sprite used by a single animation frame (used for VDP sprite allocation)
 *
 *  Contains all animations for a Sprite and internal informations.
 */
typedef struct
{
    Palette *palette;
    u16 numAnimation;
    Animation **animations;
    u16 maxNumTile;
    u16 maxNumSprite;
} SpriteDefinition;

/**
 *  \brief
 *      Sprite structure used by the Sprite Engine to store state for a sprite.<br>
 *      WARNING: always use the #SPR_addSprite(..) method to allocate Sprite object.<br>
 *
 *  \param status
 *      Internal state and automatic allocation information (internal)
 *  \param spriteDef
 *      Sprite definition pointer
 *  \param animation
 *      Animation pointer cache (internal)
 *  \param frame
 *      AnimationFrame pointer cache (internal)
 *  \param animInd
 *      current animation index (internal)
 *  \param frameInd
 *      current frame animation index (internal)
 *  \param seqInd
 *      current frame animation sequence index (internal)
 *  \param timer
 *      timer for current frame (internal)
 *  \param x
 *      current sprite X position on screen
 *  \param y
 *      current sprite Y position on screen
 *  \param depth
 *      current sprite depth (Z) position used for Z sorting
 *  \param attribut
 *      sprite specific attribut and allocated VRAM tile index (see TILE_ATTR_FULL() macro)
 *  \param visibility
 *      visibility information of current frame for each VDP sprite (max = 16)
 *  \param VDPSpriteIndex
 *      index of first allocated VDP sprite (0 when no yet allocated)<br>
 *      Number of allocated VDP sprite is defined by definition->maxNumSprite
 *  \param frameNumSprite
 *      the number of VDP sprite used by the current frame (internal)
 *  \param lastVDPSprite
 *      Pointer to last VDP sprite used by this Sprite (used internally to update link between sprite)
 *  \param data
 *      this is a free field for user data, use it for whatever you want (flags, pointer...)
 *  \param prev
 *      pointer on previous Sprite in list
 *  \param next
 *      pointer on next Sprite in list
 *
 *  Used to manage an active sprite in game condition.
 */
typedef struct _Sprite
{
    u16 status;
    u16 visibility;
    const SpriteDefinition *definition;
    Animation *animation;
    AnimationFrame *frame;
    s16 animInd;
    s16 frameInd;
    s16 seqInd;
    u16 timer;
    s16 x;
    s16 y;
    s16 depth;
    u16 attribut;
    u16 VDPSpriteIndex;
    u16 frameNumSprite;
    VDPSprite *lastVDPSprite;
    u32 data;
    struct _Sprite *prev;
    struct _Sprite *next;
} Sprite;



As you can see, it's already quite a beast but here you have the "live" Sprite structure as well as the sprite definition structure (the one that should stay in ROM, to define a sprite with its animations and frames).
Still that sprite structure just handle the sprite display, nothing else. I think it's better to separate both so you can minimize your Sprite size object for your sprites functions.


Top
 Profile  
 
PostPosted: Tue Jan 02, 2018 5:39 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2777
Oh boy, I added a new boss character, and it's flickering like crazy. It's a wolf who walks on four legs, so I think I need to make the torso smaller. If that doesn't work I'll have to do more cutting around the main character's sprite.


Top
 Profile  
 
PostPosted: Sat Jan 06, 2018 8:44 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2777
I thought of another reason why this year has been sluggish with programming. My Dad retired earlier this year, and so he is home more, and I don't get as much time on the main computer in my house.


Top
 Profile  
 
PostPosted: Sun Jan 07, 2018 11:11 am 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11013
Location: Rio de Janeiro - Brazil
Are your parents also opposed to you getting your own computer? If you have your own laptop you'll never have to worry about someone hogging the computer ever again.


Top
 Profile  
 
PostPosted: Sun Jan 07, 2018 11:44 am 
Online

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20888
Location: NE Indiana, USA (NTSC)
tokumaru wrote:
Are your parents also opposed to you getting your own computer?

The parents might oppose not the computer specifically as much as the job to afford one.


Top
 Profile  
 
PostPosted: Sun Jan 07, 2018 6:55 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2777
I have my own laptop. The front room computer has better colors though.


Top
 Profile  
 
PostPosted: Wed Jan 10, 2018 1:05 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2777
During winter break I had to binge program to finish up everything I started in 2017.
https://www.youtube.com/watch?v=mDr5zHlyLSw

I mentioned a while ago about turning Alisha's Adventure into a run'n'gun game, and last year I did do some run'n'gun animation for Alisha but I held off on it because I couldn't think of a way to implement it. The hard part is having so many different animation combinations of every move, plus each shooting direction. This might sound really hacky, but I think I'll make a subroutine that takes the current "metasprite request" register, compares it with a bunch of possible values, and replace the data with corresponding "while shooting" variant.


Top
 Profile  
 
PostPosted: Thu Jan 11, 2018 12:32 am 
Offline
User avatar

Joined: Fri Nov 12, 2004 2:49 pm
Posts: 7604
Location: Chexbres, VD, Switzerland
tokumaru wrote:
You're getting old, I guess... It seems that at as time goes by and we become more experienced, our enthusiasm decreases for whatever reason.

Man this is quite an understatement... Since a couple of years or so I am so incapable of programming anything even simple that I feel mentally disabled whenever I try, which leads to a vicious circle of not being motivated to program anymore, etc...

And this is coming from someone who just used to love programming as a hobby a couple of years ago.


Top
 Profile  
 
PostPosted: Thu Jan 11, 2018 7:22 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 1107
Location: Pennsylvania, USA
psychopathicteen, you're a brilliant programmer if you can make snes demos like this. I now am aware of at least 3 people in the homebrew scene who have no college degree and who basically showed their homebrew work to prospective employers and landed jobs in the it/software engineering field. Even though its not directly relevant it has that "wow" factor and says: "This guy can LEARN HARD THINGS." in spades. If you want to get a job and start a life outside your parents' home I personally think it is within your grasp.


Top
 Profile  
 
PostPosted: Thu Jan 11, 2018 1:56 pm 
Offline

Joined: Wed May 19, 2010 6:12 pm
Posts: 2777
GradualGames wrote:
psychopathicteen, you're a brilliant programmer if you can make snes demos like this. I now am aware of at least 3 people in the homebrew scene who have no college degree and who basically showed their homebrew work to prospective employers and landed jobs in the it/software engineering field. Even though its not directly relevant it has that "wow" factor and says: "This guy can LEARN HARD THINGS." in spades. If you want to get a job and start a life outside your parents' home I personally think it is within your grasp.


Thanks. What jobs would I be able to get?


Top
 Profile  
 
PostPosted: Thu Jan 11, 2018 2:46 pm 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 1107
Location: Pennsylvania, USA
psycopathicteen wrote:
GradualGames wrote:
psychopathicteen, you're a brilliant programmer if you can make snes demos like this. I now am aware of at least 3 people in the homebrew scene who have no college degree and who basically showed their homebrew work to prospective employers and landed jobs in the it/software engineering field. Even though its not directly relevant it has that "wow" factor and says: "This guy can LEARN HARD THINGS." in spades. If you want to get a job and start a life outside your parents' home I personally think it is within your grasp.

Thanks. What jobs would I be able to get?

I can't make any guarantees for anybody, but my expectation is that you may be able to get in to an entry level software engineering job. Given your experience with assembly, you could probably pick up java or C# or php or what not on the job. Entry level positions often don't care that much if you have a lot of depth of experience in the specific field they are hiring for. I didn't know a lick of C# when I got my first job, I did know a tiny bit of C and BASIC though and could show them personal projects I made. They were just happy to see I was eager to learn and that I was able to program, period. Employers vary a lot in their interview style. If you can find one who is interested in seeing your personal projects, it should be impressive to many of them. The type of work available out there is typically something kinda sorta boring maybe? Involving forms and databases and what not, but it can be interesting work if you have the right attitude.

There's all kinds of other types of work out there too, you may wish to seek additional advice on this matter wherever you can find it. After all I don't know very much about you personally except what you've chosen to share here on this forum.


Top
 Profile  
 
PostPosted: Fri Jan 12, 2018 1:05 am 
Offline

Joined: Tue Feb 07, 2017 2:03 am
Posts: 629
Bregalad wrote:
tokumaru wrote:
You're getting old, I guess... It seems that at as time goes by and we become more experienced, our enthusiasm decreases for whatever reason.

Man this is quite an understatement... Since a couple of years or so I am so incapable of programming anything even simple that I feel mentally disabled whenever I try, which leads to a vicious circle of not being motivated to program anymore, etc...

And this is coming from someone who just used to love programming as a hobby a couple of years ago.
This is the Snr Coders dilemma.
What you love about coding, is working out and solving problems. When you are jr everything is something that needs to be worked out and you spend more time on the problem than you do on the making a .h/.cpp file, writing the docs, pushing pull things of a stack, working out which bank to put it in etc all the "leg work".. as you get more experienced, solving the problem becomes easier and easier till you hit the point where you know how to do it all, and you spend a few minutes on the problem but the legwork doesn't change, so now the fun to leg ratio is 1:100 when before it was 3:2


Top
 Profile  
 
PostPosted: Fri Jan 12, 2018 7:31 am 
Offline
User avatar

Joined: Sun Nov 09, 2008 9:18 pm
Posts: 1107
Location: Pennsylvania, USA
Oziphantom wrote:
Bregalad wrote:
tokumaru wrote:
You're getting old, I guess... It seems that at as time goes by and we become more experienced, our enthusiasm decreases for whatever reason.

Man this is quite an understatement... Since a couple of years or so I am so incapable of programming anything even simple that I feel mentally disabled whenever I try, which leads to a vicious circle of not being motivated to program anymore, etc...

And this is coming from someone who just used to love programming as a hobby a couple of years ago.
This is the Snr Coders dilemma.
What you love about coding, is working out and solving problems. When you are jr everything is something that needs to be worked out and you spend more time on the problem than you do on the making a .h/.cpp file, writing the docs, pushing pull things of a stack, working out which bank to put it in etc all the "leg work".. as you get more experienced, solving the problem becomes easier and easier till you hit the point where you know how to do it all, and you spend a few minutes on the problem but the legwork doesn't change, so now the fun to leg ratio is 1:100 when before it was 3:2


It seems to me one can continuously increase the scope and complexity of what one is working on, augmenting the challenge of what one has achieved previously. Programming/game development can be made arbitrarily hard if one is feeling bored. I think about my dad, who has been a math professor since 1970, he still hasn't retired and still has new challenges. I feel programming/game development can be the same way, it's all about attitude.


Top
 Profile  
 
PostPosted: Fri Jan 12, 2018 4:55 pm 
Offline
User avatar

Joined: Sat Feb 12, 2005 9:43 pm
Posts: 11013
Location: Rio de Janeiro - Brazil
I do get the fun to legwork ratio thing, but I don't agree that the legwork didn't change... the truth is that I didn't care about the boring stuff at all when I was younger! As long as the on-screen results were good, I couldn't care less about how things were under the hood. Everything was fun because everything immediately translated into on-screen results. As I got older, I started caring about standards and good practices, and only then did the legwork become a problem.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 68 posts ]  Go to page Previous  1, 2, 3, 4, 5  Next

All times are UTC - 7 hours


Who is online

Users browsing this forum: Fisher, Google Adsense [Bot], ronnysingh, tepples and 5 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group