Main Restorations Software Audio/Jukebox/MP3 Everything Else Buy/Sell/Trade
Project Announcements Monitor/Video GroovyMAME Merit/JVL Touchscreen Meet Up Retail Vendors
Driving & Racing Woodworking Software Support Forums Consoles Project Arcade Reviews
Automated Projects Artwork Frontend Support Forums Pinball Forum Discussion Old Boards
Raspberry Pi & Dev Board controls.dat Linux Miscellaneous Arcade Wiki Discussion Old Archives
Lightguns Arcade1Up Try the site in https mode Site News

Unread posts | New Replies | Recent posts | Rules | Chatroom | Wiki | File Repository | RSS | Submit news

  

Author Topic: 2D Shmup development log  (Read 2922 times)

0 Members and 1 Guest are viewing this topic.

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
2D Shmup development log
« on: March 21, 2015, 08:45:48 pm »
Following from the posts in the Game Ideas thread, I decided to start up a separate thread to chronicle development of my first attempt at a real C#/Monogame video game.  It's going to be a basic space-themed 2D shmup.  Nothing ground breaking, but I'm hoping it will serve as a good learning experience for game programming.

My initial goals are as follows:

1) Create at least a single 2D shmup level with 3-4 enemy types and an end boss;
2) Support different screen resolutions and controller inputs (keyboard and gamepad);
3) Design the game in a way that will utilize scripting for enemies, levels and so on;

If I can do the latter correctly, I'm hoping I can then build a multi-level game from it.

To start this, I've started completely writing a new code base somewhat based on the prior prototype.  The difference is I'm trying to modularize the code to allow for easier construction as the game engine grows.

First, I completely rewrote the background graphics code into a new Background class.  The prior code was a spaghetti mess; now the Background class handles everything and it's very easy to add multiple layers of background graphics will different scrolling speeds and directions.

Second, I reworked the class for the Player.  Previously everything was crammed into the Player class.  Now there is a separate Ship class which handles everything associated with the ship sprite and behavior.  In addition, I added a Thruster class to add some thruster animations.  The Ship class contains one or more instances of the Thruster class.  In the below example video, there are 6 instances of the Thruster class all based on the same animation (scaled in size).  They simply activate or deactivate depending on the player pressing Up or Down.  The result is the illusion of a ship powering up or down it's thrusters relative to its movement.

Next up is to do the same with a Weapon class.



« Last Edit: March 21, 2015, 08:55:09 pm by shponglefan »

keilmillerjr

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1847
  • Last login:October 06, 2023, 10:20:39 pm
  • Web Developer.
Re: 2D Shmup development log
« Reply #1 on: March 22, 2015, 07:23:34 am »
Looks good so far! :cheers:

Since your using mono, will it be cross platform?

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #2 on: March 22, 2015, 06:00:33 pm »
Thanks keilmillerjr!

No plans for cross-platform yet.  My main focus is going to be building for various configurations of Windows.  If I can do that reasonably well, then I'll look at expanding beyond Windows.

eds1275

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2157
  • Last login:April 11, 2024, 10:50:02 am
  • Rock and Roll!
Re: 2D Shmup development log
« Reply #3 on: March 22, 2015, 07:33:58 pm »
Looks great. If it does indeed end up with a few levels, consider putting in a coin/credit system so it sits nicely with a mame cabinet!

keilmillerjr

  • Trade Count: (+5)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1847
  • Last login:October 06, 2023, 10:20:39 pm
  • Web Developer.
Re: 2D Shmup development log
« Reply #4 on: March 23, 2015, 09:17:50 am »
Looks great. If it does indeed end up with a few levels, consider putting in a coin/credit system so it sits nicely with a mame cabinet!

+1 for want of free credits, the arcade was lost.

Malenko

  • KNEEL BEFORE ZODlenko!
  • Trade Count: (+58)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 13999
  • Last login:April 09, 2024, 07:27:18 pm
  • Have you played with my GingerBalls?
    • forum.arcadecontrols.com/index.php/topic,142404.msg1475162.html
Re: 2D Shmup development log
« Reply #5 on: March 23, 2015, 09:30:10 am »
I'm a visual guy so I'll just say I think the big flames out the back is too much, backwards should be the default exhaust flame, what you have as normal should be the forward. Maybe some sort of repulser  from the front when you're going backwards?
If you're replying to a troll you are part of the problem.
I also need to follow this advice. Ignore or report, don't reply.

thomas_surles

  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2115
  • Last login:June 19, 2023, 07:20:00 pm
Re: 2D Shmup development log
« Reply #6 on: March 23, 2015, 01:50:18 pm »
What language is the game being made in? Also what engine ( if any) are you using?
Sorry if you already answered this elsewhere ( I didn't look hard)

eds1275

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2157
  • Last login:April 11, 2024, 10:50:02 am
  • Rock and Roll!
Re: 2D Shmup development log
« Reply #7 on: March 23, 2015, 02:36:06 pm »
I believe c# monogame.

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #8 on: March 23, 2015, 07:31:14 pm »
Looks great. If it does indeed end up with a few levels, consider putting in a coin/credit system so it sits nicely with a mame cabinet!

I'll keep that in mind. ;)

I'm a visual guy so I'll just say I think the big flames out the back is too much, backwards should be the default exhaust flame, what you have as normal should be the forward. Maybe some sort of repulser  from the front when you're going backwards?

Reverse thrusters is something I want to add, I just need to add code to modify the relative angle of the thruster graphics.

As for the existing thruster size, right now the graphics are all for test and not necessarily going to be the way it looks in the end.  It will more than likely be changed. :)

What language is the game being made in? Also what engine ( if any) are you using?

I'm writing it in C#.  The engine is technically my own, but using the MonoGame API/framework to write it.
« Last Edit: March 23, 2015, 09:55:54 pm by shponglefan »

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #9 on: March 23, 2015, 07:37:33 pm »
I added in the code for weapons/projectiles.  The projectile code itself is taken straight from my prototype.  But I added a Weapon class, which right now serves as a Projectile emitter of sorts.  The Ship class can have multiple Weapon instances, allowing me to create however many particle-based streams I want.  And each Weapon particle emitter can have its own attributes (angle, speed, sprite graphic).

The Weapons can also be grouped, with different weapon group selected at any given time.  In the below video, there are four different groups.  The last one is garish, but just there to test mixing of speeds, angles and particle sprites.



And here's a test video with animated projectiles:



Ultimately, I want to have four different weapon types:

1) Projectiles (as coded)
2) Homing missiles
3) Bombs
4) Solid Beams

The first three I think could be done with the existing projectile code, except changes to the basic behavior.  The last one is going to take more work.
« Last Edit: March 23, 2015, 11:12:00 pm by shponglefan »

lordnacho

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 509
  • Last login:January 21, 2023, 07:38:14 pm
Re: 2D Shmup development log
« Reply #10 on: March 23, 2015, 10:43:07 pm »
Looks good. 

Is this sprite based?  Fixed resolution? 

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #11 on: March 23, 2015, 11:06:19 pm »
Looks good. 

Is this sprite based?  Fixed resolution?

Thank you!  Yup, it's a 2D sprite based game.  I do want to be able to scale the resolution.  Right now I'm targeting 1080 vertical as a base, with plans to scale up or down depending on actual resolution.  For horizontal, I'm hoping to be able to take into account relative aspect ratios of a user's screen.

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #12 on: March 26, 2015, 07:52:42 pm »
Continued to work on a few things this week.

First, rewrote a chunk of the animation code.  The original code was based on this MonoGame animation tutorial.  However, I didn't like that it relied on passing the frame width/height, so I rewrote it to auto-detect that instead.  Then I extended it further by adding support for rotating animations.

Next, reworked the Thruster class into a more generic ShipPart class.  Now the thrusters and other ship animations are based on that class instead.  The below video demonstrates these animated elements (i.e. thrusters, pulsing glow), rotated animated elements (the reverse thrusters), and using rotation for animation (rotating gun turret).

I still have to add a lot of behavioral/state stuff to the ShipPart class.  Ideally I want to be able to define each ShipPart as contingent on whatever the ship is doing.  For example, moving, not moving, different directional movement, firing a weapon, selecting different weapons, etc.  The idea is to effectively "script" all of these parts to make a more dynamic ship both for the player and enemies.



Another video with more obvious demonstration of the rotating animated elements:



Also started working on the overall Level class.  All the background objects are now instances in that class, rather than the main game class.   Next up will be to start adding ability to script timed events to the Level class.  This will form the basis for the overall level scripting.
« Last Edit: March 26, 2015, 09:10:25 pm by shponglefan »

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #13 on: March 31, 2015, 10:33:12 pm »
Couple things in this update.

First, I wrote the Ship status code to use enumerators (enum).  This allows me to use a single variable where each bit represents a different state.  For example:

Code: [Select]
        [Flags]
        public enum ShipStatus
        {
            None = 0,
            IsNotMoving = 1 << 0,
            IsMoving = 1 << 1,
            IsMovingUp = 1 << 2,
            IsMovingRight = 1 << 3,
            IsMovingDown = 1 << 4,
            IsMovingLeft = 1 << 5,
            IsFiring = 1 << 6,
            SelectedWeaponGroupOne = 1 << 7,
            SelectedWeaponGroupTwo = 1 << 8,
            SelectedWeaponGroupThree = 1 << 9,
            SelectedWeaponGroupFour = 1 << 10,
            SelectedWeaponGroupFive = 1 << 11,
            IsFullHealth = 1 << 12,
            IsHealthThreeQuarters = 1 << 13,
            IsHealthHalf = 1 << 14,
            IsHealthOneQuarter = 1 << 15,
            IsHitByProjectile = 1 << 16
        }

All I have to do is make sure I'm updating each state correctly in the Ship class and I can create any ShipPart, Weapon, etc, instance to activate or deactivate on whatever state I want.  It seems like an elegant solution to easily add whatever particular state I want to the Ship class.  For example, I could have boss ships that start showing damage animations as their health meter drops.  Or show different animations depending on which weapon is selected.

Second, added some basic enemies to test out multiple instances of ships and all the associated behaviors.  Initially, I discovered a ton of bugs, particularly around the way I was calculating (or in some cases not calculating) positional and angular information for each instance of the Ship, ShipPart and Weapon classes.  I fixed a lot of it, but it's made me realize my code is clumsy and things aren't encapsulated as well as they could be.  I'll need to go through it and start mapping out the logic of how all the instances of classes should pass data around.  The code needs a lot of streamlining and I'll need to tackle that before moving on to more complicated items like scripted enemy spawns, movement patterns and AI.

« Last Edit: March 31, 2015, 10:39:05 pm by shponglefan »

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #14 on: April 03, 2015, 11:39:42 pm »
Started working on basic scripting for enemy movements.  Right now I've only implemented a couple patterns (straight down and a sine wave based one).  I'm going to start investing bezier curves to see if it's worth implementing more varied arcs, but for now things are quite simple.

Also added some collision detection; collision detection against the player works, but the player is invincible.  Enemies on the other hand, are not.

It's starting to look a bit more like a real video game:


shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #15 on: April 04, 2015, 08:00:28 pm »
After spending a good chunk of the day trying to get audio and music to work in MonoGame, I said "screw it" and migrated everything over to XNA 4.0.  In trying to develop under MonoGame I have run into a number of headaches, but this was one too many.  I may move back to MonoGame if I can figure out how to get audio and music to work properly, but in the meantime I will continue with XNA 4.0.

This video demonstrates music and sound effects, plus two different enemies.  The sound effects are a bit buggy, with multiple instances of the laser blast being triggered.  I've got to work on determining the best approach to handling audio code.  But at least it works reasonably well, which is more than I say for MonoGame.


eds1275

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2157
  • Last login:April 11, 2024, 10:50:02 am
  • Rock and Roll!
Re: 2D Shmup development log
« Reply #16 on: April 05, 2015, 02:38:18 am »
That art is great. The ships and stuff. Did you draw them? If so, can you give more deets on how you went about it?

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #17 on: April 05, 2015, 02:12:23 pm »
That art is great. The ships and stuff. Did you draw them? If so, can you give more deets on how you went about it?

As much as I've love to take credit, I'm afraid most of the art used isn't mine.  :)

The sprite art was obtained from OpenGameArt.org.  It's a site for providing open-license artwork for use in games.

Space ship, thruster effects, and lasers: http://opengameart.org/content/space-ship-construction-kit
Explosion animation: http://opengameart.org/content/explosion-animations

The background drawing I got from some wallpaper site I can't remember.

I have done some art and modifications to the sprites myself.  For example, the pink laser blasts the player shoots are recolored thruster animations.   The transparent cloud and star layers I created myself; ditto with the glowing light animation on the back of the player ship.  All my modifications were done using Photoshop.
« Last Edit: April 05, 2015, 09:41:17 pm by shponglefan »

eds1275

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 2157
  • Last login:April 11, 2024, 10:50:02 am
  • Rock and Roll!
Re: 2D Shmup development log
« Reply #18 on: May 22, 2015, 12:25:20 pm »
So what's happened with this?

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #19 on: May 24, 2015, 06:40:09 pm »
So what's happened with this?

I took a break from coding for a few weeks, but I'm back to chipping away at it.

Where I am at right now is trying to fix a bunch of poor design decisions.  When I initially started coding this, I wasn't too concerned with making it scriptable and ended up hardcoding a lot of things I shouldn't have.  So I have to pull apart a bunch of code and re-do a bunch of stuff (mainly to do with content management and entity management).

It's tedious which is also why I'm a bit less motivated at this stage.  But once I get over this hurdle, it will be back to the fun stuff.




Howard_Casto

  • Idiot Police
  • Trade Count: (+1)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 19400
  • Last login:April 21, 2024, 11:59:54 pm
  • Your Post's Soul is MINE!!! .......Again??
    • The Dragon King
Re: 2D Shmup development log
« Reply #20 on: May 24, 2015, 07:00:28 pm »
It's very impressive man. 

I've got a question... how much overhead do you think adding some translucency would take?  I saw this photoshop tutorial and it was talking about how if you want an object to really look like it's inside an image (in this case the background) a good way to cheat is to make it just the tiniest bit translucent... I'm talking like 2 or 3 percent.  I tried it on something I was working on and I'll be damned if it didn't immediately look integrated into the background. 

Slippyblade

  • Trade Count: (+2)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 3167
  • Last login:November 16, 2023, 11:39:51 am
  • And to the death god we say, "Not today!"
Re: 2D Shmup development log
« Reply #21 on: May 24, 2015, 07:14:49 pm »
Refactoring code sucks.  Badly.  I feel your pain man, good luck.

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #22 on: May 24, 2015, 09:23:07 pm »
It's very impressive man. 

I've got a question... how much overhead do you think adding some translucency would take?  I saw this photoshop tutorial and it was talking about how if you want an object to really look like it's inside an image (in this case the background) a good way to cheat is to make it just the tiniest bit translucent... I'm talking like 2 or 3 percent.  I tried it on something I was working on and I'll be damned if it didn't immediately look integrated into the background.

Thanks Howard!

Translucency is already built-in.  For example, the clouds that move by in the background are transparent sprites and are rendered accordingly in the game.

It's also possible to apply transparency to sprites that are not normally transparent.  So you could fade things in and out, or as you suggest, apply a little bit of translucency to an otherwise opaque sprite.

shponglefan

  • Trade Count: (0)
  • Full Member
  • ***
  • Offline Offline
  • Posts: 1600
  • Last login:December 15, 2022, 07:22:35 am
  • Correct horse battery staple
Re: 2D Shmup development log
« Reply #23 on: May 24, 2015, 09:23:47 pm »
Refactoring code sucks.  Badly.  I feel your pain man, good luck.

Thanks Slippy!  I keep telling myself it's part of the learning process.  ;)