Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411775 Posts in 69685 Topics- by 58652 Members - Latest Member: theoutlier

December 10, 2024, 12:59:49 AM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsCommunityDevLogsThe Tainted Mob (previously Mages'n'Peasants)
Pages: [1] 2 3 ... 5
Print
Author Topic: The Tainted Mob (previously Mages'n'Peasants)  (Read 34617 times)
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« on: March 08, 2016, 05:13:01 AM »


As people go missing, they turn malformed and twisted. Eventually the Tainted begin forming into groups and raiding the good folk. The problem soon gets out of hand, and several villages fall prey to wretched creatures, scarcely resembling the people they once were.

The remaining settlements eventually realize that they were abandoned by the Duke, who had to turn his attention towards preserving the capital. Sentenced to die, they decide to arm themselves and stand their ground against The Tainted Mob.


LATEST MEDIA




I'm using Unity, and I'm doing both pixelart and programming myself.

GET IN TOUCH



Mages'n'Peasants has been greenlit, but I'm leaving this here for future reference Smiley
« Last Edit: July 17, 2018, 04:56:32 AM by kamac » Logged

chriswearly
Level 3
***


prince slugcat


View Profile
« Reply #1 on: March 08, 2016, 05:20:00 AM »

Looks pretty good! Definitely resembles "Kingdom" a lot, but that's a compliment Smiley

Hit me up if you want help/feedback on art stuff, especially text-based pixel things.
« Last Edit: March 08, 2016, 05:28:27 AM by chriswearly » Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #2 on: March 08, 2016, 05:26:11 AM »

Quote
Looks pretty good! Definitely resembles "Kingdom" a lot, but that's a compliment

Thanks!

Quote
Hit me up if you want help/feedback on art stuff, especially text-based pixel things.

Noted, thanks Wink
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #3 on: March 11, 2016, 03:51:43 AM »

Added some simple unit control / structures highlighting. It's still lacking some stuff, but it's there. Also, peasants.



Also added some sounds when selecting/moving units, but you obviously can't hear that from the gif.
Logged

Jasmine
Level 5
*****

Boop


View Profile WWW
« Reply #4 on: March 11, 2016, 04:02:09 AM »

MAGES'N'PEASANTS

What's this gaem about?

It's a 2d sidescroller strategy game.

The idea is to have randomly generated maps with a few settlements placed randomly over it. Each settlement has a different source of magic, which is basically a magic statue in the center of the settlement. You can pick the statue you want upon game start. You'll get to upgrade it throughout a game to have better spells at your disposal.


Upon reading this, I attest that I still have no idea what this game is about. Is it about mages ruling peasants? Or..
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #5 on: March 11, 2016, 04:08:22 AM »

Quote
Upon reading this, I attest that I still have no idea what this game is about. Is it about mages ruling peasants? Or..

Updated the first post, hopefuly it's a bit more crystalized now!
« Last Edit: March 11, 2016, 04:56:12 AM by kamac » Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #6 on: March 12, 2016, 10:55:58 AM »

Adding resources GUI!



Also, I've been working on improving the water. Previously, it was a quad that needed a texture of the scene (a render texture from the main camera), and given that, it would display the water accordingly. It was also moved along with the camera.

Now I've switched to having it as a post processing effect, which basically means that I no longer need to render the whole scene twice, which is a huge performance boost, especially if I choose to release for android/ios later on.

Having it work as a post processing effect requires some tricks, because you'd expect that water to stay in it's place when you move the camera along the Y axis or zoom out



To accomplish that, we need a script that will pass the water level in 0-1 range (because we operate on a fullscreen effect and the water is implemented in the shader completely). In Unity, (0,0) is the bottom left corner of the image, while (1,1) is the top-right corner.

Here's how you can compute water level:

Code:
Vector3 offsetPoint = Camera.main.transform.position;
float waterLevel = Camera.main.projectionMatrix.MultiplyPoint(new Vector3(0.0f, WaterLevel + offsetPoint.y * 0.5f, 0.0f)).y;

After we compute the water level, we can easily find out where the water should be displayed in the shader:

Code:
if (uv.y > _WaterLevel)
    return tex2D(_MainTex, uv);

// render water

The only other thing that could potentially be troublesome is calculating water's reflection UVs. We can find out how to do that from this image:



0.5 could be out water level, 0.4 is the uv Y we are at. We obviously want to reflect what's on uv 0.6, so we can come up with this simple equation for our reflection UV:

Code:
if (uv.y > _WaterLevel)
    return tex2D(_MainTex, uv);

uv.y = uv.y + (_WaterLevel - uv.y) * 2.0;
return tex2D(_MainTex, uv);

And we have simple reflections working all nice in 2D!
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #7 on: March 15, 2016, 05:21:37 AM »

Been working on adding options to structures, adding functionality to resources, and finally recruiting units. In this case, peasants!

Peasants are tireless - they work day and night, they don't complain and they love to get their hands dirty. Using them is almost a crime, but I'd say that it's justified. I mean, who wouldn't?



Currently making a peasant costs 20 gold and one "population point". You can increase your population points by telling your peasants to make more houses (to be implemented).
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #8 on: March 18, 2016, 01:56:41 AM »

Nothing too exciting this time. I added an units quick access / listing sorta thing, to let the player select & focus on any of his units from anywhere 'round the world.



I had to detect whether the cursor is over any GUI element, so I wouldn't do any game related things on mouse click, and I found out Unity has this cool function
Code:
EventSystem.current.IsPointerOverGameObject()
that does all the work for you. Thanks, Unity.

Next thing coming up will be building stuff, and probably chopping down trees, too.
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #9 on: March 25, 2016, 06:53:30 AM »

Been a while since last update. Unfortunately college really is draining my time sometimes. But it's holiday now, so I've got all the time I need!

I've been working on building structures, as well as improving the GUI and doing several other fixes.

I wanted to capture both the new GUI and the building, but I guess the resulting GIF is a bit messy.
The building process is sped up for the purpose of this demonstration.



What you see here is a wooden house being built. Each house increases your villagers capacity by two. Think something along the lines of "people points", where each unit takes a certain amount. A peasant counts only as one villager, but a powerful mage might count as two, for example.

I have also been looking for some music to add to the game, and stumbled across incompetech! Really nice stuff in there, and all free. I might end up using a song from that site. Apparently even Stanley Parable and Kerbal Space program uses stuff from that creator.

Next up I'll have to finish placing structures, since there are no restrictions for placing them now (you could place one in the middle of nowhere, or on another building). After that's done, I'll probably move onto the minimap & fog of war.
« Last Edit: March 25, 2016, 07:22:46 AM by kamac » Logged

Davi Vasc
Level 1
*



View Profile WWW
« Reply #10 on: March 25, 2016, 09:22:48 AM »

This looks awesome. Love the water reflection effect Smiley
Logged

Davi Vasc - Video Game Composer
Website: www.vascmusic.com     
Twitter: https://twitter.com/VascMusic
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #11 on: March 29, 2016, 02:34:04 AM »

Update!

I managed to add fog in. It was easier than I expected, which is nice.

Have a look:



How it works

Covered/uncovered parts are stored as a texture, which is map_widthx8 pixels big. Parts that haven't yet been discovered are marked as fully opaque black pixel, while parts uncovered are a fully transparent black pixel. Here's how a fog texture might look like for a 32-tiles wide map:



As you can see, the 8 pixels in height is just for adding the roundeiness at the top of the fog.

Once we have this texture, we apply it to a sprite that covers our entire map, stretching it with bilinear filtering. Add in some C# code for modifying the fog texture (discovering map parts), and you've got yourself a fog.

But we also need to add a second layer of fog, which is the fog that covers what we've already seen. This second layer of fog works by the exact same principles as the basic fog, but uses a different shader to turn into grayscale whatever's behind it. In unity, grabpass comes in handy:

Code:
Shader "Custom/FogOfWar2"
{
Properties
{
[PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {}
_Color("Tint", Color) = (1,1,1,1)
[MaterialToggle] PixelSnap("Pixel snap", Float) = 0
}

SubShader
{
Tags
{
"Queue" = "Transparent"
"IgnoreProjector" = "True"
"RenderType" = "Transparent"
"PreviewType" = "Plane"
"CanUseSpriteAtlas" = "True"
}

Cull Off
Lighting Off
ZWrite Off
Blend One OneMinusSrcAlpha

GrabPass { }
Pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile _ PIXELSNAP_ON
#include "UnityCG.cginc"

struct appdata_t
{
float4 vertex   : POSITION;
float4 color    : COLOR;
float2 texcoord  : TEXCOORD0;
};

struct v2f
{
float4 vertex   : SV_POSITION;
fixed4 color : COLOR;
float2 texcoord  : TEXCOORD0;
float4 screenPos : TEXCOORD1;
};

fixed4 _Color;

v2f vert(appdata_t IN)
{
v2f OUT;
OUT.vertex = mul(UNITY_MATRIX_MVP, IN.vertex);
OUT.texcoord = IN.texcoord;
OUT.screenPos = ComputeScreenPos(OUT.vertex);
OUT.color = IN.color * _Color;
#ifdef PIXELSNAP_ON
OUT.vertex = UnityPixelSnap(OUT.vertex);
#endif

return OUT;
}

sampler2D _MainTex;
sampler2D _AlphaTex;
float _AlphaSplitEnabled;
sampler2D _GrabTexture;

fixed4 SampleSpriteTexture(float2 uv)
{
fixed4 color = tex2D(_MainTex, uv);

#if UNITY_TEXTURE_ALPHASPLIT_ALLOWED
if (_AlphaSplitEnabled)
color.a = tex2D(_AlphaTex, uv).r;
#endif //UNITY_TEXTURE_ALPHASPLIT_ALLOWED

return color;
}

fixed4 frag(v2f IN) : SV_Target
{
fixed4 c = tex2D(_GrabTexture, IN.screenPos) * IN.color * fixed4(0.3, 0.3, 0.3, 1.0);
c.r = (c.r + c.g + c.b) / 3;
c.g = c.r;
c.b = c.r;
c.a = SampleSpriteTexture(IN.texcoord).a;
c.rgb *= c.a;
return c;
}
ENDCG
}
}
}

Sorry of the terrible formatting

And then there's one last problem -- we need to hide enemy units that are behind this second layer of fog. This we can solve with another shader, applied to all units (our units will always stay in uncovered parts, so we don't need to distinguish them from the others).

We can write a shader that uses the second layer of fog's texture, computes unit's position on that texture, looks up the visibility, and behaves accordingly.

To compute the UV on the fog texture, we can do the following:

Code:
o.visibilityUV = (mul(_Object2World, v.vertex).xy - _VisibilitySpriteBounds.xy) / _VisibilitySpriteBounds.zw;

Where _VisibilitySpriteBounds contain: (fog X world position, fog Y world position, fog X size, fog Y size).

Then we look up the visibility, and decide what to do:
Code:
fixed lookupAlpha = 1.0 - tex2D(_VisibilityTex, IN.visibilityUV).a;
if (lookupAlpha <= 0.002)
discard;
else {
fixed d = (c.r + c.g + c.b) / 3.0;
c.rgb = lerp(fixed3(d, d, d), c.rgb, lookupAlpha);
}

And that's it, basically.

Next up I'll probably be preparing to work on adding cutting trees down, which means reworking some parts of the code (currently that would require every tree to have the Selectable component, which is a performance killer, because Selectable contains Update function, and there are a lot of trees on one map).

@EDIT

Right, I forgot there's still no minimap. I'll be working on that next, then the trees.
« Last Edit: March 29, 2016, 02:50:23 AM by kamac » Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #12 on: March 31, 2016, 08:03:11 AM »

Got minimap working, finally. It even shows your units on it when you mouse over it.



To maximize performance, it's made up of two images. The one in the background is just the static stuff rendered (ground, bushes), that is rendered only once to the render texture. The second image is the dynamic part (trees, mobs, buildings, fog), which is rendered every 0.5 second (might make it less often).

Next up chopping down trees and fixing some bugs.
« Last Edit: March 31, 2016, 08:23:20 AM by kamac » Logged

Cranktrain
Level 4
****


making gams


View Profile WWW
« Reply #13 on: March 31, 2016, 08:10:43 AM »

The water is look very fancy! Neat mini-map interface too, looks like it's all coming along nicely.
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #14 on: March 31, 2016, 08:15:04 AM »

The water is look very fancy! Neat mini-map interface too, looks like it's all coming along nicely.

Thanks! Hopefuly there'll be more to comment on once I get to the art/fighting part Wink
Logged

kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #15 on: March 31, 2016, 12:33:38 PM »

I've been pondering whether I should switch to a higher resolution for characters. That would give me more room for animation and details.

Comparison (left high res, right current):



I think it does look a tad better (that's expected of higher resolution), but I'm not sure whether it fits the style of the game.

Currently I'm using little 11x16 sprites. That test one I just made is @ 32x32 pixels.

Do you think I should stick to current sprites, look for a middle ground between the high res and low res, or go for high res?
« Last Edit: March 31, 2016, 12:40:55 PM by kamac » Logged

Peace Soft
Level 0
***


All magic is made from corn


View Profile WWW
« Reply #16 on: March 31, 2016, 12:53:14 PM »

I like any fantasy game that acknowledges the brutal medieval social structure that would have to underlie it, haha. Nice graphics too!

It seems weird to have housing instead of food supply as the limit on your population though. I mean that's what a peasant caste is for IRL. I don't know maybe the wizards are magically making food and paying the peasants in that? You've probably given this more thought than i have

Did you ever play King Arthur's World? Reminds me of that a little.
Logged
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #17 on: March 31, 2016, 01:02:56 PM »

Quote
Nice graphics too!

Thanks, I'm doing my best.

Quote
It seems weird to have housing instead of food supply as the limit on your population though. I mean that's what a peasant caste is for IRL. I don't know maybe the wizards are magically making food and paying the peasants in that? You've probably given this more thought than i have

I thought about forcing a food supply, but I didn't want to force the player to pay too much attention to that. I'd rather have his attention on fighting. I might still add food supply though, and if done right it's a good idea.

Population limit is there to prevent making a huge mage army, and to force the player to balance peasants and mages (many peasants = many resources, but little fighting prowess).

So if anything, I'd keep population limit and add food supply on top of that.

Quote
Did you ever play King Arthur's World? Reminds me of that a little.

Yup, I did, but I didn't do any sort of reference to it when I started making this game Tongue
Logged

Davi Vasc
Level 1
*



View Profile WWW
« Reply #18 on: March 31, 2016, 02:23:45 PM »

I've been pondering whether I should switch to a higher resolution for characters. That would give me more room for animation and details.

Comparison (left high res, right current):



I think it does look a tad better (that's expected of higher resolution), but I'm not sure whether it fits the style of the game.

Currently I'm using little 11x16 sprites. That test one I just made is @ 32x32 pixels.

Do you think I should stick to current sprites, look for a middle ground between the high res and low res, or go for high res?

Hi-res looks much better and it does fit the style of the game perfectly in my opinion.
Logged

Davi Vasc - Video Game Composer
Website: www.vascmusic.com     
Twitter: https://twitter.com/VascMusic
kamac
Level 10
*****


Notoriously edits his posts


View Profile
« Reply #19 on: April 01, 2016, 02:50:27 AM »

Quote
Hi-res looks much better and it does fit the style of the game perfectly in my opinion.

I think I'm going for a less serious look here.

So I tried something goofier, but in the end I'm torn which style looks better.



I feel like I liked the old style better, but I'm not sure.

@EDIT

I think I'll just stick to the old style for now. I'm alone on this project, and making high resolution sprites would require a lot of work, and animation skills, which I don't have atm.

Plus I like how Kingdom managed to pull it off with their low res sprites.
« Last Edit: April 01, 2016, 03:10:30 AM by kamac » Logged

Pages: [1] 2 3 ... 5
Print
Jump to:  

Theme orange-lt created by panic