SFML community forums

General => SFML projects => Topic started by: SuperV1234 on September 26, 2013, 03:46:39 pm

Title: operation bloodshed - (WIP)
Post by: SuperV1234 on September 26, 2013, 03:46:39 pm
(http://i.imgur.com/fRP7kGO.png?1?4281)

operation bloodshed

GitHub: https://github.com/SuperV1234/SSVBloodshed (https://github.com/SuperV1234/SSVBloodshed)
Main devlog: http://forums.tigsource.com/index.php?topic=36131.0 (http://forums.tigsource.com/index.php?topic=36131.0)



what
This is my attempt at the creation of a spiritual successor to Operation Carnage, one of my favorite childhood games.
Operation Carnage is a 1996 abandonware arcade game (http://www.midnightsynergy.com/ancient.htm) with a very simple but addicting and fun gameplay. It has a very interesting shooting/strafing mechanic that is easy to learn but hard to master.
Unfortunately, it also has some design flaws that I'll try to solve in my game.

why
I'll attempt creating this game for various reasons:
1) I feel that Operation Carnage has never got the attention it deserved. Even if it's not a very innovative game, it's certainly a very fun 90's arcade experience, that has some interesting ideas which can be improved.
2) A `clone` of the game, Hyper Princess Pitch (http://www.remar.se/daniel/pitch.php), was created by Daniel Remar. It is awesome and you should play it, but, in my opinion, it doesn't solve the design issues the original game had.
3) I haven't done much work since LD27 (http://www.ludumdare.com/compo/ludum-dare-27/?action=preview&uid=26255) and I want a project to work on.

how
My language of choice is C++11.
I'll use QTCreator and Sublime Text as my coding tools.
PyxelEdit will be used for graphics.
I will use my own framework, the SSV Framework (https://github.com/SuperV1234), and SFML2.1.
As my previous projects, the end result will be free, open-source and cross-platform.



(http://i.imgur.com/fjoC818.png)

Devlog (audio-commented) videos:
Code: [Select]
devlog #16 - http://www.youtube.com/watch?v=JG960pauKVs
(GUI, force fields, bullet boosters)

devlog #15 - http://www.youtube.com/watch?v=RHwQIXKO1n4
(on-off pressure plates, explosives, new elements/tweaks)

devlog #14 - http://www.youtube.com/watch?v=1iPkM9olna0
(new elements, multi-level sectors)

devlog #13 - http://www.youtube.com/watch?v=pIcEywsZ5eE
(many new elements)

devlog #12 - http://www.youtube.com/watch?v=hV5kkPBYfXI
(fully working level editor)

devlog #11 - http://www.youtube.com/watch?v=43gyuU-FdCY
(particle blendmodes, ai changes, wip editor)

devlog #10 - http://www.youtube.com/watch?v=blq33UhomBE
(wall autotiling, charge particles, raycasting, new gfx)

devlog #9 - http://www.youtube.com/watch?v=8GT8zbgt0ow
(turrets, new enemies, bar hp counter)

devlog #8 - http://www.youtube.com/watch?v=Za2w-nNwe0g
(all enemies can now have weapons)

devlog #7 - http://www.youtube.com/watch?v=5JmZmp_x5Uc
(major progress: ai, gfx, etc...)

devlog #6 - http://www.youtube.com/watch?v=_y_xcvS_aIk
(possible enemy types demonstration)

devlog #5 - http://www.youtube.com/watch?v=wkPzUk5oSMA
(testing enemies that shoot)

devlog #4 - http://www.youtube.com/watch?v=mcRPckkV1XM
(test particles redux)

devlog #3 - http://www.youtube.com/watch?v=KW-cqoaXmVk
(test particles)

devlog #2 - http://www.youtube.com/watch?v=DaIqr5thCQ0
(shooting test, enemy test)

devlog #1 - http://www.youtube.com/watch?v=0KVp2j5hbxI
(new possible project)
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on September 26, 2013, 03:47:05 pm
new video - (wall autotiling, charge particles, raycasting, new gfx)
http://www.youtube.com/watch?v=blq33UhomBE

This video shows:
* wall autotiling: the walls now look "joined"
* charge particles: when an enemy is about to shoot or perform an action, "inverse" charging particles are displayed
* raycasting tests: instead of mindlessly shooting, enemies draw their gun only if they can "see" the player (the player can hide behind walls)
* gfx changes: new font made from scratch and turret has a new tile
Title: Re: operation bloodshed - (WIP)
Post by: G. on September 26, 2013, 07:13:28 pm
What are the design flaws and issues that were in the original game?
Title: AW: operation bloodshed - (WIP)
Post by: eXpl0it3r on September 26, 2013, 07:36:12 pm
As said before, it looks awesome and I'm amazed at your daily progress! :)
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on September 26, 2013, 08:00:23 pm
What are the design flaws and issues that were in the original game?

I talked about them in the main devlog:

Quote
design thoughts
The following thoughts apply both to Operation Carnage and Hyper Princess Pitch.
The main problem I have with the original game is that it is very luck based.
Getting a random powerup drop could mean the difference between clearing a room or losing a life.
How to preserve the fun "overpowered" powerup mechanics while preventing luck based gameplay?
Maybe, instead of random drops, have enemies drop money (or any other resource) that can be spent to buy powerups? Or just place powerups manually in the levels?

Also, constantly getting flamethrower ammunition would give an advantage, since flames stop bullets.
And this is my second complaint: the flamethrower is overpowered.
The bullet-blocking flamethrower is the "iconic" weapon of Operation Carnage. How can it be balanced?
Maybe have very limited and expensive ammunition. Maybe have some kind of enemy projectiles that cannot be blocked by the flamethrower at all.
Or maybe add an overheating mechanic, so that the player cannot be constantly shielded by the flamethrower but has to time its usage.

Another major complaint: the "I fucked up early, let's restart" syndrome.
In arcade games like Operation Carnage, where you have a limited amount of lives, dying on the first or second level usually means a restart, as you need the extra lives for later levels. This is incredibly annoying. You have to play those levels perfectly or else you have to restart.
The same problem applies to games like Touhou, for example.
How to preserve unforgiving game difficulty while solving the early-restart problem?
Maybe, the player could have a limited amount of lives per level, that gets refilled on every level. It's basically saying "You're allowed to fuck up twice per level", and levels obviously become harder over time.
Actually, I think I like this solution.

pro modes
The original game offers 4 difficulty modes, that increase enemy speed/health and decrease player health.
I'm planning to have the following modes:
Easy mode: for newcomers - enemy damage output decreased, more lives per level, etc.
Official mode: the regular gameplay mode. Easy in the early levels, incredibly hard in the later levels. Comes with a built-in speedrun timer.
Mayhem mode: the ħardcore gameplay mode. Same parameters as Official Mode. 1-hit kill. 1 life. Comes with a built-in speedrun timer.
Sandbox mode: the user can choose starting levels, mess around with game parameters, etc. Useful for practice and fun to play around with.



As said before, it looks awesome and I'm amazed at your daily progress! :)

Thank you! :D
Title: Re: operation bloodshed - (WIP)
Post by: G. on September 26, 2013, 08:14:56 pm
Sorry I didn't see that link to tigsource!  :-X
Anyway, it looks good! I don't know Operation Carnage, but I loved Smash TV. ^^
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on September 27, 2013, 05:32:14 pm
Sorry I didn't see that link to tigsource!  :-X
Anyway, it looks good! I don't know Operation Carnage, but I loved Smash TV. ^^

Try it! It's abandonware (free) and a lot of fun. :)
http://www.midnightsynergy.com/ancient.htm

---

Today I spent all day on a weapon system.
It sucks, it introduces unnecessary complexity and makes heavy use of capturing lambdas... but:

* Creating new weapons is very easy
* Weapons have a lot of flexibility (it's not a bunch of parameters, it's a lambda that can do anything)
* Thanks to value semantics, I can have copies of weapons with slight variations
* I can easily give an enemy, the player or a turret a certain weapon both at compile-time and run-time and it will work

Example code explained:
(http://i.imgur.com/WN1iTpD.png)

1. Notice the return type, `OBWpn`. It's not a reference or a pointer, it's a copy. This allows, for example, to have an enemy use a special version of an existing weapon.
2. For simple weapons, such as the first one (`EPlasmaBulletGun`), the `onShoot` delegate does not capture anything. Non-capturing lambdas with Don Clugston's fast delegates (http://www.codeproject.com/Articles/7150/Member-Function-Pointers-and-the-Fastest-Possible) get inlined by clang++ as a normal function call. Yes. (g++ does a worse job, but it's still faster than capturing lambdas).
3. Every projectile the weapon creates goes through `mWpn.shotProjectile`, which fires a callback other entities can attach to. So I could have a "piercing bullets power-up", that, when active, attaches to `OBWpn::onShotProjectile(OBCProjectile&)` delegate, and sets every spawned projectile as piercing.
4. In case of a power-up that modifies the way the weapon shoots, and not projectile parameters, there is a similar delegate in `OBCWpnController`, a component attached to entities with guns that controls fire delay and contains a `OBWpn` object.

So, let's analyze `createEPlasmaGun(int mFanCount)`.

The first instruction creates a `OBWpn` object called result, with parameters:
* Shoot delay: 75.f
* Projectile damage: 1.f
* Projectile speed: 260.f
* Sound ID: "Sounds/machineGun.wav"

The second instruction subscribes (`+=`) a capturing lambda to the weapon's `onShoot` delegate. Inside the lambda we tell the weapon to create `PJStarPlasma` projectiles and fire them in a fan-like formation. When the shots have been fired, we adjust their speed so that "outer" shoots are slower.

Then we return the weapon to the caller.



It works, but it's very messy. Does anyone have any suggestion on how to improve it?
Title: Re: operation bloodshed - (WIP)
Post by: Nexus on September 27, 2013, 07:15:54 pm
It doesn't look very messy, what exactly do you have in mind? If different projectiles can be created with a position and angle, you could directly call a function with 3 parameters: Type of projectile, position, angle. So you can get rid of the indirection through MGame.getFactory().createXY(), at least in calling code. Maybe you're overengineering a bit here; do the factories and all the separate classes give you a real advantage? You should also consider an enum (struct) for the sound, or you'll have to adapt paths in multiple place and risk typos.

Furthermore, you should avoid premature optimization. It's good to think about efficiency, but some parts would be simpler and with high probability still efficient enough. Examples: inline, passing vectors by const reference, fast delegates, worries about lambda captures.
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on September 28, 2013, 04:34:04 pm
new video - particle blendmodes, ai changes, plasma bombs, wip level editor
http://www.youtube.com/watch?v=43gyuU-FdCY

In the video:
* Particle systems now can have a specific blendmode: addition works great for plasma effects!
* Minor ai changes: when an enemy doesn't see you, he moves around to find a trajectory
* Plasma bombs: new projectile type that explodes into plasma bolts
* wip level editor: just started creating a level editor that saves/loads from JSON
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on September 29, 2013, 04:05:54 pm
new video - fully working level editor
http://www.youtube.com/watch?v=hV5kkPBYfXI

In the video:
* Level saving/loading: levels created in the editor are now playable
* Simple editor mouse controls: mousewheel + modifiers to change brush size, rotation and tile types
* Construction and gameplay of two example levels
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on September 30, 2013, 04:05:54 pm
new videos - many new elements / example room
http://www.youtube.com/watch?v=pIcEywsZ5eE
http://www.youtube.com/watch?v=DXvFCDVolLA

In the videos:
* New element: destructible wall
* New elements: doors and pressure plates
* New elements: laser beam turret, plasma cannon turret
* New enemy type: enforcer (shoulder-mounted plasma cannon)
* Many new editor features
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on October 08, 2013, 11:45:38 am
new video - new elements, multi-level sectors
http://www.youtube.com/watch?v=1iPkM9olna0

In the video:
* Editing 32x speed timelapse
* Playthrough of a multi-level sector
* New elements (green/red doors, trapdoors, enemy spawners)
* More aggressive enemies (tweaked bouncing)
* Energy shard collection

Also...

(http://i.imgur.com/cZ8lH6X.gif)
Title: Re: operation bloodshed - (WIP)
Post by: Sub on October 08, 2013, 08:56:52 pm
I don't know if you're intending to do this, but it might be cool if the levels could be randomly generated, sort of like the binding of isaac.  Regardless, it's looking good, keep it up  :)
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on October 22, 2013, 10:37:23 am
new video - vending machines, on/off pressure plates, explosives, ...
http://www.youtube.com/watch?v=RHwQIXKO1n4

In the video:
* Healing vending machine
* New pressure plate type
* More elements have IDs that can be bound to pressure plates
* Explosive crates!
* New trapdoor type
* Weapon sprite changes

Not in the video:
* Major refactoring and performance improvements

Probably in next video:
* Switches (alternative to pressure plates)
* Sensors (alternative to pressure plates that bullets can trigger)
Title: Re: operation bloodshed - (WIP)
Post by: foobarbaz on October 22, 2013, 02:18:14 pm
This just continues to get more epic. Keep up the awesome work, man!
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on November 09, 2013, 06:34:35 pm
Needed a GUI system for the editor, so I created one...

(http://i.imgur.com/E7r38qp.png)
Title: Re: operation bloodshed - (WIP)
Post by: eXpl0it3r on November 09, 2013, 08:36:27 pm
Looks very nice! Need to check out the code. ;)
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on November 15, 2013, 06:09:44 pm
Just thought I'd give a little update: I've been working on the editor interface.

(http://i.imgur.com/qOXF54E.png)

Never thought programming a GUI from scratch would be so hard: focusing the correct widgets in nested lists, textbox focusing and text entering, and culling off-form widgets all gave me headaches... but it seems to work now.

Video coming soon!



Looks very nice! Need to check out the code. ;)

Thanks!
Code is here (still heavy WIP): https://github.com/SuperV1234/SSVBloodshed/tree/master/include/SSVBloodshed/GUI
Title: Re: operation bloodshed - (WIP)
Post by: Raincode on November 16, 2013, 04:10:36 pm
For how long have you been programming? I think this stuff is just incredibly awesome, for being made only by one person
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on November 16, 2013, 06:26:39 pm
For how long have you been programming? I think this stuff is just incredibly awesome, for being made only by one person

Thanks!  ;D

I've been programming since I was 11 or 12 (I'm 19) -  I started with VB inside Microsoft Excel, then moved to VB.NET, then to C#. After that, I discovered GNU/Linux and C++ and never looked back :)
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on November 23, 2013, 12:37:17 pm
new video - GUI, force fields, bullet boosters

http://www.youtube.com/watch?v=JG960pauKVs

In the video:
* GUI system: A graphical user interface for the editor, written from scratch with no prior knowledge of GUI code design.
* Force fields: they prevent player and/or the enemies movement in the opposite direction. Can be turned on/off.
* Bullet force fields: they prevent player and/or enemies bullet from passing through a specific side. Can be turned on/off.
* Bullet boosters/direction changers: they alter the bullets's velocity - useful for trap creation and multi-directional turrets.
* Acceleration-based player movement
* Other minor changes...

I've also created a Facebook page for the game (WIP), which I will use for future video updates:
http://www.facebook.com/operationbloodshed

And I've also had the idea of creating tutorial screencasts about modern C++11 game development for beginners. What do you think? Is someone interested?
Title: Re: operation bloodshed - (WIP)
Post by: JuDelCo on November 24, 2013, 12:28:07 am
Like i said in Youtube, I'm interested on these tutorials (but with a bit of level, i already know how to use c++11 more or less, my interest is more like "good patterns" on game programming applied in this language)
Title: Re: operation bloodshed - (WIP)
Post by: Nexus on November 24, 2013, 10:31:50 am
And I've also had the idea of creating tutorial screencasts about modern C++11 game development for beginners. What do you think? Is someone interested?
In general, it takes a lot of time if you prepare code for educational purposes, don't underestimate that. I don't know if it's a good idea to just show the code of your game, because it might be very specific and advanced (not a typical game) and thus hard to understand. If you lay it out in a strictly incremental manner, where you add feature by feature, you will have to redo a lot, because that's most probably not how you develop otherwise. It depends of course also on how detailed you want to make it -- a complete game is definitely a lot of work, but maybe it would even be more interesting to pick out a few special techniques, e.g. the way how lambda expressions can be used to make code simpler and more powerful? This approach would also have the advantage that people don't get bored by the lengthy parts of game development (boilerplate coding without interesting functionality). And you could keep the videos rather short and directly focus on the interesting parts...

If you do it, then please make sure you really use modern C++. Not such a mix of global variables, arrays, manual memory management and macros like CodingMadeEasy... Then it would be a good contrast to these videos based on ancient code style ;)
Title: Re: operation bloodshed - (WIP)
Post by: Raincode on November 24, 2013, 03:43:35 pm
Hey,

personally, I'd say that explanations of overall techniques or concepts is more useful and not quite as time consuming as doing tutorials with specific game code.
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on November 24, 2013, 04:32:24 pm
Thank you both for the interesting comments. I have adapted and refined a 160~ lines of code C++11 + SFML arkanoid clone I have talked about at my local Linux Day and created a 30 minutes long screencast, where I analyze the code (segmented in 7 executable parts), showing the thought process behind the creation of a simple C++11 game with SFML.

After it's done uploading I will post it here on the forums.

I also really like the ideas suggested by Nexus - I could do short videos in the future about particular techniques such as Entity management or serialization, etc...

Anyway, I'm sure the feedback on my first tutorial will also be very helpful for the future ones.
Title: Re: operation bloodshed - (WIP)
Post by: Grimshaw on November 24, 2013, 04:55:06 pm
Good job on the project so far Vittorio!! I think you are a really talented programmer. This game has a really unique style, when its finished, I wonder how big will its success be ^^
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on November 24, 2013, 06:38:13 pm
Good job on the project so far Vittorio!! I think you are a really talented programmer. This game has a really unique style, when its finished, I wonder how big will its success be ^^

Thanks for the kind words! :)

Also, the tutorial was finally uploaded on YouTube.
I've created a thread in General Discussion:
http://en.sfml-dev.org/forums/index.php?topic=13677

Hope you will find it useful!
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on December 08, 2013, 05:21:57 pm
(http://i.imgur.com/0ebTU3i.png)

Spent most of my day working on automatic console formatting.
Basically, you can define template specializations that get automatically called when sending a certain object type to the log stream:

template<> struct Stringifier<ssvs::MBtn>
{
    using T = ssvs::MBtn;
    template<bool TLogify> inline static void impl(const T& mValue, std::ostream& mStream)
    {
        // TLogify determines whether to apply formatting or not,
        // since the same "Stringifier" object is used for simple toStr(...) conversions
        if(TLogify) mStream << Console::setColorFG(Console::Color::Green);
        mStream << "(" + ssvs::getBtnName(mValue) + ")";
    }
};
 

Also, I've adapted my naive GUI system to work with any font, as shown in the screenshot.
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on January 02, 2014, 04:49:18 pm
new devlog - (text editing, GUI styling, new particles)

http://www.youtube.com/watch?v=zO86YBYIgqY

Quote
http://vittorioromeo.info
Devlog: http://forums.tigsource.com/index.php?topic=36131.0
GitHub: https://github.com/SuperV1234/SSVBloodshed

In this video I'll show new minor features and changes for operation bloodshed.

Apart for fixing crashes and bugs (and optimizing the game even more), text editing is now fast and easy (comparable to your favorite text editor).

GUI elements can now be styled and they adapt to the font being used.

Particles are now loaded from easily editable .json data files, so that players can customize particles.

Example of particle file:
https://github.com/SuperV1234/SSVBloodshed/blob/master/_RELEASE/Data/Particles/bloodRed.json

A new particle parameter, "fuzziness", has been added, which basically randomly moves around vertices. It works very well for explosions, smoke, and sparks.

I haven't added any new element since I've been experimenting with other projects.
I've created an assembly language and virtual machine that I will probably show in a future video, and also fixed many Open Hexagon 2.0 bugs.

Thank you for watching!
Title: Re: operation bloodshed - (WIP)
Post by: SuperV1234 on January 30, 2014, 05:50:25 pm
Recursive functions?

(http://vittorioromeo.info/Misc/Linked/obGifs/shockwave.gif)

Recursive weapons.