Goplanes

Announce (tech) demos or games releases

Moderator: Mask of Destiny

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Sat Oct 20, 2012 10:07 pm

djcouchycouch wrote:
- New status bar. While not as nice as the floating UI icons from the previous versions, it takes much less CPU to compute. I might revisit this.
Sure enough, as soon as I posted the video last week I started really disliking the status bar. It felt like it "cut off" the sky, not making it look open enough for my tastes. So I just spent a few hours trying to optimize the old hud. Got performance using the old hud close enough to the status bar. So I've gone back to the old hud.

Now I feel bad about bugging Stef about the Window plane stuff :)
No problems about the windows plan, it should be functional and it appears that right now it is not the case, so i will fix that :)
I agree about the sprites hud which look better than the window one, just because of the larger scroll space :)

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Oct 22, 2012 2:21 am

More optimization work today. Changed the breakable blocks to be background tiles. Before the blocks were all sprites which were pretty heavy computationally. Now they're treated internally like coins that disappear when the plane is in the afterburner state.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Mon Oct 22, 2012 1:23 pm

I'm going to try and explain how I currently handle coins and breakable blocks.

I call coins and breakable blocks "special tiles".

Special Tile Data Format

In the simple case, level data is an array where each element is a VDP tile. As a reminder, the data per tile looks like:

Code: Select all

    pccvhnnnnnnnnnnn

    p = Priority flag
    c = Palette select
    v = Vertical flip
    h = Horizontal flip
    n = Pattern name

Because it's already formatted, I can simply copy a part of the level directly to the VDP. But with special tiles, it's not that simple anymore.

I needed to be able to identify a special tile from a regular one, so I chose the 11th bit. It reduces the number of regular tiles from 2k to 1k, but it opens up a few things for me.

Once a tile has it's 11th bit set, the tile data is parsed like this:

Code: Select all

    AAAAABCCDDDDDDDD
    
    AAAAA         = pattern name (0 - 31)
    B                 = special tile bit
    CC               = special tile type (0 - 3)
    DDDDDDDD = index into a state table (0 - 255)

AAAAA is the index of the pattern to use, offset by a known location stored elsewhere. For example, the four tiles that make up a coin go from 0 to 3. The actual coin tiles are stored at a known location in memory. The AAAAA number is added to the known memory location to get the actual tile in memory.

B when the bit is set, it means it's a special tile.

C A value of 0 means a coin, 1 means a breakable block. I'm currently feeling pretty limited by this as there are only 4 values, so I might steal an extra bit from AAAAA since I don't think special tile patterns will be bigger than 4x4 tiles. The bits won't be contiguous so I'll have to do some bit gymnastics to get the 3 bits together. Annoying but doable.

DDDDDDDD is an index to state table of 256 values. Each type of special tile has a state table. The tiles that make up a coin or breakable block all point to the same element in the state table. If the element is 1 then the special tile is visible, if 0, then invisible. At the moment, I can have up to 256 instances of a type of special tile. This is a pretty good number.

Drawing Special Tiles

I draw the background by drawing rows or columns in the direction the screen is scrolling. A "strip of tiles" that make up a row or column is pre-computed into a buffer during gameplay and DMA'd into the VDP during vblank.

For each tile when building a strip of level data, if it's not a special tile then I simply copy its data to the strip. If it's a special tile, then I go through a procedure of:

1 - get the special tile type (0 - 3)
2 - get the index into the state array (0 - 255)
3 - if the state is 1, then compute the actual pattern name (offset + known memory location) and copy that into the strip of tiles, else return a known blank tile.

This will definitely change since the level data is currently stored uncompressed. Once I introduce compression, the building of tile strips will have to change.

Interacting With Special Tiles

When flying, the Goplanes continuously detects the tile it's currently on for collisions. The current collision algorithm goes like:

Code: Select all

- get the current tile
- if it's a regular tile:
    - look up the tile with the tile collision type table. Each regular tile has a type (solid, transparent, etc)
    - if it's solid, compute collision stuff. 
    - Else, do nothing.
- if it's a special tile:
    - get it's type
    - if it's a coin
        - get the index into the coin state array
        - check the coin state
        - if the coin state is 1, add 1 coin to the coins counter, turn state to 0, erase the coin from the plane and play a sparkle effect.
        - Else, do nothing.
    - if it's a breakable block
        - get the index into the breakable block state array
        - check the breakable block state
        - if the state is 1, 
            - if the plane is not in afterburner mode, then treat as regular tile collision. 
            - Else set the state to 0, erase the block from the plane and play an explosion effect.

Exporting Special Tiles

I use Tiled to build levels and have made my own exporter for Goplanes.

In Tiled you can use multiple tilesets in one map. In my latest map (which is seen in my last few youtube videos) I use three tilesets:
- a tileset that contains the regular background tiles
- a tileset named "coins" that contains the 16x16 pixel coin image, broken up into 8x8 tiles
- a tileset named "breakableblocks" that contains the 32x32 pixel breakable block image, broken up into 8x8 tiles

Building a map this way means I can reuse the coin and breakable block tilesets without having to add them to the regular background tiles.

When I export the level, for each tile:
- check which tileset it belongs to
- if it belongs to the regular tileset, save the tile in the regular VDP format
- if it belongs to a special tileset ("coins" or "breakableblocks"), save the tile in the special tile format

I also have to make sure that the 2x2 tiles that make up a coin or the 4x4 tiles that make up a breakable block all point to the same element in the state array.

Conclusion

That's it!

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Tue Oct 23, 2012 12:15 am

Reread my previous post and realized that I didn't need to update the scrolling every frame, only when the player object has moved from one tile to another. One simple if statement won me an easy 10fps. Without waiting for vsync, I'm running around 95 to 105 fps. Still got a lot of room to write sloppy code :)

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Oct 23, 2012 1:07 am

This thread is valuable if only to see the progress as you've worked on the game. Reading through it, you gain insight into game design on a practical level.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Tue Oct 23, 2012 12:15 pm

Changed the large explosion sprite to be one bit 32x32 sprite instead of four 16x16 sprites. When I originally implemented it I wanted to save video memory by using one 16x16 sprite and flipping it, but the function calls for four sprites plus the computation for updating and placing them was too much for my tastes. So now I use more memory, but there's only one function call that takes two parameters (VDP_SetSpriteP) instead of four that takes six parameters (VDP_SetSprite). I can also go and make the explosion sprite prettier since the corners don't have to be mirrored any more.

I have other objects like the "poof" animation when hitting a wall that are 4 16x16 sprites, but they don't happen as much so they'll stay the same for now.

There, my current optimization to-do list is empty! I can start on new stuff! OMG! New stuff!

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Wed Oct 24, 2012 5:39 pm

And where is the last video? :mrgreen:

What kinf of new stuff you're thinking about?

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Thu Oct 25, 2012 1:17 am

I can't believe I never posted the last video.

Goplanes Dev Video 020.

http://www.youtube.com/watch?v=1jyG4kZ8GoE

From the description:

Nothing major, just something to show off the current state.

- Added coins in the level. Notice that they're used to help the player navigate the level by providing hints about the terrain.
- New status bar. While not as nice as the floating UI icons from the previous versions, it takes much less CPU to compute. I might revisit this.


*********************

And as I mentioned, after I posted the video I started hating the status bar and removed it, going back to the original UI, but much more optimized.

All I've been doing these past weeks is optimization, so there hasn't been any real visible changes to the game.

As for the new stuff, I don't really like to talk about what I'll be doing in the future because it always changes, and I don't want to give people unreasonable expectations. But I'll be looking at making some new background graphics (stretch out those art muscles), experimenting with background layer effects and possibly work on some enemy AI.

What I'm looking at right now is how to chose colors that work together. My color choices so far have been pretty random. I want to make sure that the graphics aren't too garish looking.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Wed Oct 31, 2012 3:25 pm

It hit me today that if anyone wants to try out a version of Goplanes that runs on PC, you can out Goplanes II on Yoyogames:

http://sandbox.yoyogames.com/games/24124-goplanes-ii

(Hit enter to change levels!)

Warning, though: The Genesis version is a different implementation of the same basic idea, based off the same assets, but it won't necessarily play or look the same when its released. But it does give you a basic idea and something to play with. :)

Charles MacDonald
Very interested
Posts: 292
Joined: Sat Apr 21, 2007 1:14 am

Post by Charles MacDonald » Wed Oct 31, 2012 5:38 pm

Just wondering, were there going to be any beta releases of Goplanes for us to try on the Genesis?

I know it's not done yet, but it already looks like a lot of fun to play from the videos. Even if still had some bugs or quirks I'd certainly like to try it.

Of course if you are holding off on a release until it's finished, that's cool too.

oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Wed Oct 31, 2012 5:50 pm

I've just tested goplanes II and if you reach this result, this would be a great achievement!

On the videos, it seems to me you're very close to original game.
Just waiting to test the handling now, as Charles Macdonald 8)

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Wed Oct 31, 2012 8:23 pm

Charles MacDonald wrote:Just wondering, were there going to be any beta releases of Goplanes for us to try on the Genesis?

I know it's not done yet, but it already looks like a lot of fun to play from the videos. Even if still had some bugs or quirks I'd certainly like to try it.

Of course if you are holding off on a release until it's finished, that's cool too.
I would love to do some kind of release for people to try out, but I'm holding off for now. Hopefully it doesn't sound like I'm waiting for it to be "absolutely perfect!" or something. There will be a release sometime, somehow. But currently as a game I feel it's still only a prototype. I'm still trying to figure out how I want to use the hardware and thinking about and testing game ideas. I don't know what kind of game play it'll have. And I still have a lot of graphics to draw. :)

So I'm afraid you'll just have to watch videos while holding a controller in the meantime.

Charles MacDonald
Very interested
Posts: 292
Joined: Sat Apr 21, 2007 1:14 am

Post by Charles MacDonald » Wed Oct 31, 2012 9:57 pm

So I'm afraid you'll just have to watch videos while holding a controller in the meantime.
Hahaha, that's a great suggestion. :)

It will be worth the wait, I'm sure.

djcouchycouch
Very interested
Posts: 710
Joined: Sat Feb 18, 2012 2:44 am

Post by djcouchycouch » Thu Nov 01, 2012 12:15 am


oofwill
Very interested
Posts: 173
Joined: Mon May 03, 2010 6:12 pm
Location: France - Niort

Post by oofwill » Thu Nov 01, 2012 12:29 am

Image

Post Reply