Project Ironfist is recruiting programmers! Project Ironfist is a mod for the classic game Heroes of Might and Magic II. We have an active fan community, and are busy creating the new Cyborg faction, which the fans have been waiting for since 2001. We have a lot of great content in the works, and are looking for someone to help implement new features and extend our map editor.
As a programmer, you'd be reporting to me. My name is James Koppel, and I am a computer science researcher at MIT, and the executive producer and technical director for Project Ironfist. Our creative director and designer is Roy Shapira, who was lead designer on Sniper: Ghost Warrior 3. Besides the two leaders, the team includes 3 programmers, a pixel artist, a sound designer, a composer, and a level designer. Two of the programmers and the composer were recruited off this very forum.
The game is written in rather plain C++. As a game mod, we have some pretty serious tech so that we can mod the game almost as easily as if we had the original source code. If you're interested in learning about reverse-engineering or assembly, we have that too (but it's strictly optional).
Want to know more about Project Ironfist? Check out our website, www.ironfi.st
Sound like a good place for you? Shoot me a PM!
↧
Project Ironfist seeks programmers
↧
Why are licensed game engines being used more frequently?
So recently, I noticed that some Japanese devs are starting to use licensed game engines rather than custom game engines such as how Nintendo is using Havok for Botw, or how Shenmue 3 is using Unreal 4 engine I think....
I always had this belief that custom engines are better than licensed engines simply because said engines don't require royalty fees and can be reused and modified over again saving a lot of time and effort and a good way to port games to newer systems unlike licensed engines which not only does the opposite but just makes devs like Epic games less reason to develop games since the engines they give for rent make more money than the games themselves....
Idk..I guess I have to accept that custom engines will start to become irrelevant or something of sort.
↧
↧
MechBox 2: Hardest Puzzle Ever
MechBox 2 challenges players to uncover the secrets of a mysterious post-apocalyptic puzzle box. Explore each protective layer in a series of ever-changing puzzle and logic challenges to find the secrets within.
The high-tech box is damaged and time is running out.. the fate of the world is quite literally in your hands.
Background
The Mechanical Box is one of the last fragments of the technology used by the Ancients and still existing in the post-apocalyptic world of the alternative Earth. A high-tech device created with only one purpose: to store and protect an unknown Object inside. To date, the Box is in poor condition: it’s partially damaged and overgrown with moss and other vegetation. There is a warning written on one side which is still readable: "SUBNUCLEAR CELLS MUST NOT BE REPLACED".
How to play
★ If you have no idea how to start playing, then why don’t you try some time killer.★ Every protection layer of the Mechanical Box is supplied with the BGB - Big Green Button design for moving to the next level below. You just need to press it★ If you try to solve a puzzle and eventually find yourself in a dead end, don’t give up! The MechBox has a built-in hint system. But remember, MechBox isn’t a game for casual players but rather an armored metalware bristling with security systems. And a hint is just a hint, not a ready-made solution.
More: https://ogurecapps.itch.io/mechbox-2-hardest-puzzle-ever
Any feedback is welcome! I hope you guys enjoy trying it out. If you need promo codes (for iOS), just let me know.
↧
Some minor design decisions to make
I am always feeling that I should process the movement within the movers (pathfinders) themselves.
But I have a small decision to make,
there should be some compromise by now.
Consideration 1: (one interface preferred)
When 2 different movers, such as astar and the hierarchical astar both produce waypoints of same kind, it should be more convenient to give a consistent interface for both
HPA is not part of AStar, maybe I can do it
Consideration 2: (movers responsible for moving the objects)
It provides a cleaner organization, and I can easily start and stop one mover and switch to another at my own will
↧
Shift Quantum Systems
In this article, we will cover a few aspects of the systems implemented in the code base of Shift Quantum. From how blocks composing the levels are managed, to our command system for the in-game level editor, including how we generate those commands from the HUD, you will have a better idea of how we handle all of this in code.
Separation between model and the view
Because basically our levels are a grid of blocks, early on in the development of the game we thought it would be best to separate the data from its representation. This would have several advantages:
The game would only have to manipulate some raw and abstract data without having to take care of where to place the blocks for example.
It's possible to have multiple representations of the model: a 3D representation like now, but also a complete 2D sprite based view if needed ( to generate a map for big levels for example ).
It is very easy to write unit tests to validate that the data is correctly handled by the model, enforcing the validity of the various operations on the model throughout the development.
The model contains all the information related to the level, like the width and height, the current color space (Black or White), the rotation of the grid, or all the blocks coordinates. It also contains information used only by the in-game level editor, like the cursor coordinates and rotation.
The model communicates with the other classes using events. Lots of events... Here is a non exhaustive list of the names of the events to give you a rough idea:
FOnInitializedEvent
FOnWorldRotationStartedEvent
FOnWorldRotationEndedEvent
FOnWorldColorUpdatedEvent
FOnBlockRegisteredEvent
FOnBlockUnRegisteredEvent
FOnDimensionsUpdatedEvent
etc.
The other classes which want to know when something happens in the model just need to subscribe to those events and react accordingly. For example, the level view is interested for example in knowing when the dimensions of the grid are updated, to adjust the boundaries around the play space, or when a block is registered, so the view can move the block to its correct location in the 3D world (because the model does not even know the blocks are in a 3d space), and so onaEUR| One thing to note is that the model does not perform any logic when you update its data. ItaEUR(TM)s up to the caller to take care of removing an existing block before adding a new one at the same coordinates. More about that later in the commands section.
Level Editor Commands
During the incubation meetings, maybe the first answer given to the question "What do you think is important to have in an in-game editor?" was an Undo-Redo system for all the operations available. So we obviously had to implement a command pattern. This is a very well-know pattern, so I don't think we need to dive a lot in the details. But if you need a refresher, here are some links. Nonetheless, I can give you one advice: your command classes must be as lightweight as possible. No logic should happen in the commands, because the more logic you put inside, the more complicated it will be for you to handle the Undo and Redo parts of the contract. As such, the declaration of the base command class is very simple and straightforward:
UCLASS()
class SHIFTQUANTUM_API USQCommand : public UObject
{
GENERATED_BODY()
public:
USQCommand();
FORCEINLINE const FSQCommandContext & GetContext() const;
virtual void Finalize();
virtual bool Do();
virtual void UnDo();
void Initialize( const FSQCoords & coords );
protected:
UPROPERTY( VisibleAnywhere ) FSQCommandContext Context;
};
I think you will agree it can hardly be less than that. You may notice we don't have a ReDo function, because Do will be used in both scenarios. To execute those commands (and of course to UnDo and Redo them), we have a command manager component attached to our level editor actor. As you can guess, its definition is very simple:
class SHIFTQUANTUM_API USQCommandManagerComponent : public UActorComponent
{
GENERATED_BODY()
public:
USQCommandManagerComponent();
bool ExecuteCommand( USQCommand * command );
bool UnDoLastCommand( FSQCommandContext & command_context );
bool ReDoLastCommand( FSQCommandContext & command_context );
void ClearCommands();
private:
UPROPERTY( VisibleAnywhere, BlueprintReadonly ) bool bCanUndo;
UPROPERTY( VisibleAnywhere, BlueprintReadonly ) bool bCanRedo;
UPROPERTY( VisibleAnywhere ) TArray DoneCommands;
UPROPERTY( VisibleAnywhere ) TArray UnDoneCommands;
};
And its implementation is a classic too. For example, the ExecuteCommand:
bool USQCommandManagerComponent::ExecuteCommand( USQCommand * command )
{
if ( command == nullptr )
{
UE_LOG( LogSQ_Command, Error, TEXT( "Can not execute the command because it is null." ) );
return false;
}
if ( command->Do() )
{
DoneCommands.Add( command );
for ( auto undone_command : UnDoneCommands )
{
undone_command->Finalize();
}
UnDoneCommands.Empty();
bCanUndo = true;
bCanRedo = false;
return true;
}
return false;
}
One function which deserves a bit of explanation is Finalize. You can see this function is called on commands which have been UnDone at the moment we execute a new command, before we empty the UnDoneCommands array. This allows up to do some cleanup because we know for sure the commands won't be executed again.
For example, when we want to add a new block in the world, the command generator will spawn that block, initialize it, and pass the block as a pointer to the RegisterBlock command.
When we Do that RegisterBlock command, we just kind of toggle on the block (make it visible, set up the collisions, etc.), and when we UnDo the command, we do the opposite (hide it, disable the collisions, and so on). Finalize then becomes the function of choice to destroy the actor spawned by the command generator.
void USQCommandRegisterBlock::Finalize()
{
if ( ensure( Block != nullptr ) )
{
GetOuter()->GetWorld()->DestroyActor( Block );
}
}
bool USQCommandRegisterBlock::Do()
{
Super::Do();
return ensure( GetTileManagerComponent()->RegisterBlock( *Block, Context.Coords ) );
}
void USQCommandRegisterBlock::UnDo()
{
Super::UnDo();
ensure( GetTileManagerComponent()->UnregisterBlock( Context.Coords ) );
}
void USQCommandRegisterBlock::Initialize( const FSQCoords & coords, ASQBlock & block )
{
Super::Initialize( coords );
Block = █
}
There are two things worth noting:
Because the command manager only executes one command at a time, and because any action we do is made of several commands (for example, adding a block in the grid is made of at least 2 commands : remove the existing block at the cursor coordinates, then register the new block), we have a special command class named USQCommandComposite. It stores an array of sub-commands. Those sub-commands are executed linearly in Do and in reverse order in Undo.
You may have noticed the FSQCommandContext structure. Each command holds a context internally, which is used to store some global informations at the moment the command is initialized (just before being executed for the very first time). This allows us to restore the cursor position and the zoom level of the camera when we undo / redo any command, allowing the player to have the editor in the same state as it was when he first executed an action.
Command generation
Because our commands are very simple, we need to put the logic elsewhere. And because we need a way to bind the generation of those commands to the UI, we created class hierarchy deriving from UDataAsset. This allows us to make properties editable in the UE4 editor such as the sprite to display in the HUD, the text to display under the sprite, the static mesh to assign to the cursor, or the maximum number of instances of a given actor which can be spawned in the level (for example, we only allow one start point and one exit door). Here is an excerpt of the definition of this class:
UCLASS( BlueprintType, Abstract )
class SHIFTQUANTUM_API USQCommandDataAsset : public UDataAsset
{
GENERATED_BODY()
public:
USQCommandDataAsset();
FORCEINLINE bool CanBeExecuted() const;
virtual USQCommand * CreateCommand( ASQLevelEditor & level_editor ) const PURE_VIRTUAL( USQCommandDataAsset::CreateCommand, return nullptr; );
protected:
UPROPERTY( BlueprintReadonly ) uint8 bCanBeExecuted : 1;
UPROPERTY( EditAnywhere ) TSubclassOf BasicBlockClass;
UPROPERTY( EditAnywhere, BlueprintReadonly ) UTexture2D * UITexture;
UPROPERTY( EditAnywhere, BlueprintReadonly ) FText DisplayText; // …
};
For example, here is the editor view of a command data asset used to add a game block in the level:
Our command generator assets are grouped by categories, which is another UDataAsset derived class:
In the in-game editor UI widget, we just iterate over all the commands of the selected category, and add new buttons in the bottom bar:
When the player presses the A button of the gamepad, we know the selected command data asset. Now, we just need to create the command out of this data asset, and give it to the command manager command:
bool ASQLevelEditor::ExecuteCommand( USQCommandDataAsset * command_data_asset )
{
if ( command_data_asset == nullptr ) { return false; }
if ( !command_data_asset->CanBeExecuted() )
{
UE_LOG( LogSQ, Warning, TEXT( "The command %s can not be executed." ), *command_data_asset->GetClass()->GetFName().ToString() );
return false;
}
LastCommandDataAsset = command_data_asset;
auto * command = command_data_asset->CreateCommand( *this );
return CommandManagerComponent->ExecuteCommand( command );
}
To finish this part, here is the implementation of the command data asset used to register a game block in the level:
USQCommand * USQCommandDataAssetAddGameBlock::CreateCommand( ASQLevelEditor & level_editor ) const
{
if ( !ensure( GameBlockClass != nullptr ) ) { return nullptr; }
// Get needed informations, like the cursor position, the current displayed color, and so on…
// Early return if we want to register a game block on coordinates which already has the same game block
if ( tile_infos.Block->IsA( GameBlockClass ) && tile_infos.BlockPivotCoords == coords ) { return nullptr; }
// Spawn the game block
auto * game_block = level_editor.GetWorld()->SpawnActor( GameBlockClass );
// … and initialize it
// Fill the array with all the coordinates the new game block will cover (some blocks are larger than a single tile)
TArray used_coords_array;
game_block->GetUsedTileCoords( used_coords_array );
const auto opposite_color = USQHelperLibrary::GetOppositeColor( world_color );
auto * command = NewObject( game_mode );
command->Initialize( "AddGameBlock", coords ); // For each coordinate used by the new game block, unregister the existing block
FillCompositeCommandWithUnsetCoords( *command, *tile_manager, used_coords_array, opposite_color );
auto * set_game_block_command = NewObject( game_mode );
set_game_block_command->Initialize( coords, *game_block ); // Finally, register the game block
command->AddCommand( *set_game_block_command );
game_block->FillCreationCommand( *command );
return command;
}
As you can see, there is a lot more logic than inside the various commands, because here, we take care of all the steps needed to execute a final command. As mentioned in the first part, the model does not perform any logic related to the integrity of its data. It's then up to the command generator to make sure for example that all the coordinates of the grid which will be covered by a new game block are first cleared up.
This can expand quickly, because maybe one of the coordinates to clear is part of another game block. Then the complete game block must be removed too. But as we can not leave holes in the grid, we must in a last step fill the holes left by removing this game block, but not covered by the game block we want to add, by basic blocks.
This gets really hefty in the command generator which allows to resize the level, as you can imagine. And this is where being able to unit-test the model comes in very handy. (VERY!) That's all for today's article. We hope you found it useful and helped you understand a few of the systems we currently use inside our game.
↧
↧
Are there established middleware/engines for browser based MMOs?
Like the kind of .io games... Presumably a central server backend and the client runs in your browser using HTML5.
Back in the day I would've used Flex/Flash but those days are gone, however I'm not a web developer so JavaScript isn't an area of expertise. Are there go-to libraries to let me get on with coding... primarily the front end but also the networking and back end?
I'm an experienced professional C++/C#/Java guy but a bit out of date in game dev. I've an idea for a .io game but want to leave my options open for browser, desktop and iPad clients i.e. Not have to write it several times for each platform. And I suppose in a perfect world I'd use the same stack for server and client.
All thoughts welcome... If this is in the wrong forum apologies.
↧
C Java JDBC JSP Resources
The following link contains C, Java, JSP, JDBC tutorial for beginners.
Tutorials
↧
legal needs for a PC game? If it's counter strike ?
Right said, but just wanted to know about what is the legal needs for a PC game? If it's counter strike ?
↧
IOKit has very large swapped size on iPhone6
We use OpenGL ES2.0 for our game.
On iPhone6 series, the IOKit has very large swapped size(100MB for just one resource, 0 resident size and 0 dirty size) which will lead to crash,
for the same setting, almost no swapped size on iPhone 5 and 7 series...(attached images are iphone 5,6,7 in order)
Our textures are mostly 1024x1024, 512x512, one 2048x1024
any ideas?
↧
↧
The New Titan of Gaming
It’s the 13th of April,
APPTUTTi has shared some amazing new games of their international game catalog, branding them one of the biggest names in mobile gaming content.
It’s the 13th of April, and you can feel the energy in the room. APPTUTTi and DataEye’s industry seminar poised to reveal the valuable secrets of the gaming industry has garnered eyes from all over the marketplace.
Hundreds of mobile game distributors, publishers, operators, and developers have been invited. People sit in their seats and talk in hushed murmurs about NDA-privileged up-and-coming games, new business ventures, investment opportunities, and what they think will be the next unicorn gaming app.
The event launches and action. APPTUTTi, as a co-organizer, shares some of their most amazing games from their catalog of hundreds of games and apps: Astro Lords, Knights Fight and Blocky Cars Online.
The energy in the room grows. Talent can be felt. It literally reaches out and shakes you. The taste makers and the movers and shakers of the gaming industry have been noticing high talent games for generations – and then emulating what works to reap huge profits.
APPTUTTi isn't worried about showing off the cream of their crop at all. Astro Lords wins the award for Best Graphic Design. APPTUTTi goes on, after introducing to the crowd, and sharing games that have been recently published, and those that are to be published in the near future.
It's a little astounding to everyone present. APPTUTTi has become one of the largest mobile content providers in the industry. The number of APPTUTTi partners has more than doubled in the last 200 days, the revenue has grown by 14 times and that's just the beginning. Stars from that pool of talent are emerging, and APPTUTTi has the management know-how to cherry pick them and foster incredibly entertaining games at a fast pace.
In the near future the company also plans to provide English apps to the English speaking population in China. By doing that, APPTUTTi will become the first company in the country to bring English apps to local Android users. It's part of what being a progressive and innovative gaming company is all about.
And, with established partnerships with close to thousand developers overseas, APPTUTTi is at the precipice of their meteoric rise – and they show no sign of slowing down.
Launch your app in China now.
Tips & Resources: Quick Tips for Resources Download Quick Tips before App Submission Technical Knowledge Base Partner Resources Portal FAQ
↧
Help in spelling required!
Hello, everyone!
We're making an indie global strategy game in fantasy setting. My native language is russian, so I don't know exactly how to spell correctly some of the location's names in a game. Could someone tell me please if the spelling is correct in the following names:
Scorched Lands
Hungry Garden
Land of Exile
Junk Yard
Dead Swamp
Dark Thicket
Mountains of Cold
Bat's Lair
Freezing Passage
Frozen Sea
Iced Town
The Great Desert
Trader’s Sands
Mud Land
River Port
Cyclop's Shore
Reptile's Bucht
Centaurus Beach
Green Forest
Druid's Place
Mushroom Grove
Warm Sea
Stone City
Tower of Knowledge
Hobbit’s Village
Gold Mines
Sawmill
Eagle’s Nest
Dragon’s Mountain
Oak Wood
Ice Kingdom
Flying Temple
Tundra of Giants
Are all the names spelled correctly?
Would be grateful for your help!
↧
Google logins now working
FYI, with the last site revision google logins were broken (I made a thread about it) But with the new one, google logins now seem to be working properly.
↧
Are journals still here?
I don't see them in the top nav-bar and I can't see where followed journals are listed?
↧
↧
gameplay data in a cloud for mmo?
Hi guys,
I was wondering is it a good idea, to keep gameplay data in a cloud. In MMO games you have a lot of different for example weapons.
And balancing the game is crucial. Which means for example balancing unit properties, weapon properties like speed, health, damage etc.
What is the best way to keep those properties? static in an app or in a cloud?
In cloud you can change things in realtime. So if something is overpowered you can nerf it down without doing any app updates etc.
How you would guys do it?
↧
Student looking for people to work and learn together
Hello everyone. I'm a master's student in HE Physics that have always loved the idea of making games as a hobby. During my bachelor's degree I studied C++ and Python and then I studied more programming in my spare time. The last 2 years I've done some stuff with Unity and UE4 and lately I spent some time working with Godot and learning pathfinding. The thing is that I've never started a serious project so I'm completely unexperienced about working in a team and I'm sure that I lack a lot of knowledge but I'm eager to learn everything that i need to.
Currently I'm finishing my thesis and have more free time so i would like to move a step forward by working with someone, gain experience and learn from each other. I would like to start with something simple and then increase the complexity of what we do as we have more practice. Also I'm willing to share all I know with someone that is new and wishes to start in this field.
↧
Artist Looking for Progammer for Simple Games
Hi Everyone,
I'm a veteran graphic designer (+14 years) looking to make some simple interactive games and programs for Twitch streaming. Most likely 2D art, UI/UX design but that allow Twitch users to interact and play the game through chat. I have a lot of time to work during the day and would like to work with someone that can do the same so we could knock out prototypes or projects quickly. I would also prefer to work with someone that's in the American time zones. Let me know if you're interested and I can tell you a couple projects I have in mind.
I'm not looking to make any RPGs or MMOs or anything that takes years to work on.
↧
Suggestion for drawing an isometric character
I decided to implement an isometric 2D game for iPhone, using SpriteKit and GameplayKit, and Inkscape/GIMP as graphic tools. I prefer vectorial graphics because as a iOS programmer I am required to create multiple versions of my assets, each one of different size in order to adapt to different screen resolutions. I use GIMP just rarely, in the case that I need to adjust the images created with Inkscape.
I draw my hero using Inkscape, and this is the result:
Now since it's an isometric game, the hero needs to move in all the four directions, and he also needs to aim the shotgun to different directions. I will also need to draw the hero with more weapons, but for now I have this one. Now the question is: should I draw a new version of the hero for all the possible directions in which the shotgun could be pointed, or there is a smarter way?
The only options that come to my mind are:
Drawing the hero aiming the shotgun only in the main directions (maybe 0°, 15°, 30°, etc...)
Drawing the hero aiming in 3 directions (0°, 45°, -45°) and then finding a way to interpolate the images in order to draw the hero aiming in the intermediate directions
Using two separate layers, the top layer to draw the arms and the shotgun of the hero, and rotating it in the desired direction
Clearly the best way would be to redraw the hero for each aiming direction, but it requires too much work. If instead I choose the 3rd option I think I'd get not so much realistic results. What do you suggest? or maybe there is a smarter way?
↧
↧
Looking for 3D Modelers
Hey everyone I am a programmer looking for any 3D modelers that want to help me by creating a few models of characters for my project to showcase. Here is a current update of my project:
I would be awesome if we can collab on this I use Unity and C#/JavaScript. Animations would be appreciated too but not needed if you choose not too.
↧
what did I wrong about computeshader
I wrote computeshader to blur image.
But it returns black texture.
actually I'm not using FX file and effect library.
I use hlsl file and I bind it to pipeline myself with direct api.
I have 2 hlsl files which do vertical, horizontal blur.
here my CPU code which executes computeshader.
void BoxApp::callComputeShaderandBlur(ID3D11DeviceContext * dc, ID3D11ShaderResourceView * inputSRV, ID3D11UnorderedAccessView * inputUAV, int blurcount)
{
for (int i = 0; i < blurcount; i++)
{
dc->CSSetShader(m_CSH, 0, 0);
dc->CSSetShaderResources(0, 1, &inputSRV);
dc->CSSetUnorderedAccessViews(0, 1, &mBlurOutPutTexUAV, 0);
UINT numGroupsX = (UINT)ceilf(m_Width / 256.0f);
dc->Dispatch(numGroupsX, m_Height, 1);
dc->CSSetShaderResources(1, 0, 0);
dc->CSSetUnorderedAccessViews(1, 0, 0, 0);
dc->CSSetShader(m_CSV, 0, 0);
dc->CSSetShaderResources(0, 1, &mBlurOutPutTexSRV);
dc->CSSetUnorderedAccessViews(0, 1, &inputUAV, 0);
UINT numGroupY = (UINT)ceilf(m_Height / 256.0f);
dc->Dispatch(m_Width, numGroupY, 1);
dc->CSSetShaderResources(1, 0, 0);
dc->CSSetUnorderedAccessViews(1, 0, 0, 0);
}
dc->CSSetShaderResources(1, 0, 0);
dc->CSSetUnorderedAccessViews(1, 0, 0, 0);
dc->CSSetShader(0, 0, 0);
}
If I don't call this function, everything is fine. (I rendered my scene to off screen redertarget and use this texture as quad texture. and render it to real rendertarget. it worked fined)
That means there's problem in ComputeShader code.
Every resource and view isn't null pointer, I checked it.
all HRESULTs are S_OK.
here my 2 shader codes
this is CSH.hlsl
static float gWeights[11] =
{
0.05f, 0.05f, 0.1f, 0.1f, 0.1f, 0.2f, 0.1f, 0.1f, 0.1f, 0.05f, 0.05f,
};
static const int gBlurRadius = 5;
Texture2D gInput;
RWTexture2D<float4> gOutput;
#define N 256
#define CacheSize (N + 2*gBlurRadius)
groupshared float4 gCache[CacheSize];
[numthreads(N, 1, 1)]
void main(int3 groupThreadID : SV_GroupThreadID,
int3 dispatchThreadID : SV_DispatchThreadID)
{
//
// Fill local thread storage to reduce bandwidth. To blur
// N pixels, we will need to load N + 2*BlurRadius pixels
// due to the blur radius.
//
// This thread group runs N threads. To get the extra 2*BlurRadius pixels,
// have 2*BlurRadius threads sample an extra pixel.
if (groupThreadID.x < gBlurRadius)
{
// Clamp out of bound samples that occur at image borders.
int x = max(dispatchThreadID.x - gBlurRadius, 0);
gCache[groupThreadID.x] = gInput[int2(x, dispatchThreadID.y)];
}
if (groupThreadID.x >= N - gBlurRadius)
{
// Clamp out of bound samples that occur at image borders.
int x = min(dispatchThreadID.x + gBlurRadius, gInput.Length.x - 1);
gCache[groupThreadID.x + 2 * gBlurRadius] = gInput[int2(x, dispatchThreadID.y)];
}
// Clamp out of bound samples that occur at image borders.
gCache[groupThreadID.x + gBlurRadius] = gInput[min(dispatchThreadID.xy, gInput.Length.xy - 1)];
// Wait for all threads to finish.
GroupMemoryBarrierWithGroupSync();
//
// Now blur each pixel.
//
float4 blurColor = float4(0, 0, 0, 0);
[unroll]
for (int i = -gBlurRadius; i <= gBlurRadius; ++i)
{
int k = groupThreadID.x + gBlurRadius + i;
blurColor += gWeights[i + gBlurRadius] * gCache[k];
}
gOutput[dispatchThreadID.xy] = blurColor;
}
and this is CSV
static float gWeights[11] =
{
0.05f, 0.05f, 0.1f, 0.1f, 0.1f, 0.2f, 0.1f, 0.1f, 0.1f, 0.05f, 0.05f,
};
static const int gBlurRadius = 5;
Texture2D gInput;
RWTexture2D<float4> gOutput;
#define N 256
#define CacheSize (256 + 2*5)
groupshared float4 gCache[CacheSize];
[numthreads(1, N, 1)]
void main(int3 groupThreadID : SV_GroupThreadID,
int3 dispatchThreadID : SV_DispatchThreadID)
{
//
// Fill local thread storage to reduce bandwidth. To blur
// N pixels, we will need to load N + 2*BlurRadius pixels
// due to the blur radius.
//
// This thread group runs N threads. To get the extra 2*BlurRadius pixels,
// have 2*BlurRadius threads sample an extra pixel.
if (groupThreadID.y < gBlurRadius)
{
// Clamp out of bound samples that occur at image borders.
int y = max(dispatchThreadID.y - gBlurRadius, 0);
gCache[groupThreadID.y] = gInput[int2(dispatchThreadID.x, y)];
}
if (groupThreadID.y >= N - gBlurRadius)
{
// Clamp out of bound samples that occur at image borders.
int y = min(dispatchThreadID.y + gBlurRadius, gInput.Length.y - 1);
gCache[groupThreadID.y + 2 * gBlurRadius] = gInput[int2(dispatchThreadID.x, y)];
}
// Clamp out of bound samples that occur at image borders.
gCache[groupThreadID.y + gBlurRadius] = gInput[min(dispatchThreadID.xy, gInput.Length.xy - 1)];
// Wait for all threads to finish.
GroupMemoryBarrierWithGroupSync();
//
// Now blur each pixel.
//
float4 blurColor = float4(0, 0, 0, 0);
[unroll]
for (int i = -gBlurRadius; i <= gBlurRadius; ++i)
{
int k = groupThreadID.y + gBlurRadius + i;
blurColor += gWeights[i + gBlurRadius] * gCache[k];
}
gOutput[dispatchThreadID.xy] = blurColor;
}
sorry about poor english.
plz help I'm really sad...
I spend whole day for this...
It doesn't work..
feels bad man..
↧
...KILL COMMANDO [free] [gamejolt]
Hi, I finally released KILL COMMANDO on gamejolt for free. It is a retro-funsplatter-shooter with C64 style. Give it a try.
↧