Kartal TURGUT
4 Haziran 2015 Perşembe
29 Mayıs 2015 Cuma
Prevent Mobile Apps Hacking In-App Values
Most of users are not smart enough. Most of them using some hacking apps and searchs some values in memory and change.
Using some tricks will be effective for most users.
Using some tricks will be effective for most users.
- Use fake variables
- Use temp modified variables
Sample:
public int[] XValue = new int[200];
public int CValue = 0;
These variables keep coins. CValue is real variable.
When coins increase use ApplyCoins method.
public void ApplyCoins(int pCoins)
{
CValue += pCoins * 8;
for (int i = 0; i < 200; i++)
XValue[i] = CValue;
for (int i = 50; i < 100; i++)
XValue[i] = CValue / 8;
}
Get the real coins value.
public int GetCoins()
{
return CValue / 8;
}
When user search the coins value lots of fake variables will be listed.
This is not best way for prevent hacking but most of user will be eliminated.
Xamarin Android Admob Banners and InterstitialAds
Here is the sample for Admob elements in xamarin android apps.
First, you need Google Play Services
https://components.xamarin.com/view/googleplayservices/
AndroidManifest.xml
<application>....Also add INTERNET and ACCESS_NETWORK_STATE permissions.
<activity android:name="com.google.android.gms.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
.....
</application>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.INTERNET" />
Monogame Activity
[Activity(Label = "Sample Admob App"
, MainLauncher = true
, Icon = "@drawable/ic_launcher"
, Theme = "@style/Theme.Splash"
, AlwaysRetainTaskState = true
, LaunchMode = Android.Content.PM.LaunchMode.SingleTop
, ScreenOrientation = ScreenOrientation.Portrait
, ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.Keyboard | ConfigChanges.KeyboardHidden | ConfigChanges.ScreenSize)]
public class TestActivity : Microsoft.Xna.Framework.AndroidGameActivity
{
private AdView ad;
private static InterstitialAd interstitial;
private string addid = "YOUR ADMOB ID";
private LinearLayout ll;
private FrameLayout fl;
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
var g = new Engine.GameEngine();
//Game engine activity variable
g.activity = this;
//Create interstital ad view
interstitial = AdWrapper.ConstructFullPageAdd(this, addid);
//Create FrameLayout
fl = new FrameLayout(this);
fl.AddView((View)g.Services.GetService(typeof(View)));
SetContentView(fl);
g.Run();
}
public void ShowInterstitialAd()
{
RunOnUiThread(() =>
{
if (interstitial.AdListener != null)
interstitial.AdListener.Dispose();
interstitial.AdListener = null;
var intlistener = new AdMob.adlistener();
intlistener.AdLoaded += () => { if (interstitial.IsLoaded)interstitial.Show(); };
interstitial.AdListener = intlistener;
interstitial.CustomBuild();
});
}
public void HideBannerAd()
{
if (ll != null)
{
fl.RemoveView(ll);
ll.RemoveView(ad);
ad.Dispose();
ad = null;
ll.Dispose();
ll = null;
}
}
public void RefreshBannerAd()
{
if (ll == null)
{
HideBannerAd();
ll = new LinearLayout(this);
ll.Orientation = Orientation.Horizontal;
ll.SetGravity(GravityFlags.Bottom | GravityFlags.Center);
ad = new AdView(this);
ad.AdSize = AdSize.Banner;
ad.AdUnitId = addid;
ll.AddView(ad);
fl.AddView(ll);
}
using (var requestbuilder = new AdRequest.Builder())
{
ad.LoadAd(requestbuilder.Build());
}
}
}
AdWrapper
namespace AdMob
{
public static class AdWrapper
{
public static InterstitialAd ConstructFullPageAdd(Context con, string UnitID)
{
var ad = new InterstitialAd(con);
ad.AdUnitId = UnitID;
return ad;
}
public static AdView ConstructStandardBanner(Context con, AdSize adsize, string UnitID)
{
var ad = new AdView(con);
ad.AdSize = adsize;
ad.AdUnitId = UnitID;
return ad;
}
public static InterstitialAd CustomBuild(this InterstitialAd ad)
{
var requestbuilder = new AdRequest.Builder();
ad.LoadAd(requestbuilder.Build());
return ad;
}
public static AdView CustomBuild(this AdView ad)
{
var requestbuilder = new AdRequest.Builder();
ad.LoadAd(requestbuilder.Build());
return ad;
}
}
}
AdListener
namespace AdMob
{
class adlistener : AdListener
{
// Declare the delegate (if using non-generic pattern).
public delegate void AdLoadedEvent();
public delegate void AdClosedEvent();
public delegate void AdOpenedEvent();
// Declare the event.
public event AdLoadedEvent AdLoaded;
public event AdClosedEvent AdClosed;
public event AdOpenedEvent AdOpened;
public event AdClosedEvent AdFailed;
public override void OnAdFailedToLoad(int p0)
{
if (AdFailed != null) this.AdFailed();
base.OnAdFailedToLoad(p0);
}
public override void OnAdLoaded()
{
if (AdLoaded != null) this.AdLoaded();
base.OnAdLoaded();
}
public override void OnAdClosed()
{
if (AdClosed != null) this.AdClosed();
base.OnAdClosed();
}
public override void OnAdOpened()
{
if (AdOpened != null) this.AdOpened();
base.OnAdOpened();
}
}
}
14 Nisan 2015 Salı
Finding element(s) in List
Simple way to find an element in a List<T>
public class Foo
{
public string ID { get; set;}
public bool IsEnabled { get; set;}
public bool IsDoUpdate { get; set;}
}
private List<Foo> elements = new List<Foo>();
elements.Find(x => x.ID == "1");
Filter elements
List<Foo> _s = elements .FindAll(x => x.IsEnabled && x.IsDoUpdate);
public class Foo
{
public string ID { get; set;}
public bool IsEnabled { get; set;}
public bool IsDoUpdate { get; set;}
}
private List<Foo> elements = new List<Foo>();
elements.Find(x => x.ID == "1");
Filter elements
List<Foo> _s = elements .FindAll(x => x.IsEnabled && x.IsDoUpdate);
14 Mart 2015 Cumartesi
Level Boss Random Movements
I'm working on level boss movements for a while. I was stucked with a problem that swaping new position when arrive current position. So, i solve the problem with some help on gamedev web site.
First i need a class which holds the position information.
And generate positions.
So, i can manage movements.
First i need a class which holds the position information.
public class BossMovement
{
public Vector2 pos { get; set; }
public float speed { get; set; }
public float waitTime { get; set; }
public BossMovement(Vector2 pPos, float pSpeed, float pWaitTime)
{
pos = pPos;
speed = pSpeed;
waitTime = pWaitTime;
}
}
And generate positions.
List<BossMovement> movements = new List<BossMovement>();
movements.Add(new BossMovement(new Vector2(300f, 200f), 10f, 4f));
movements.Add(new BossMovement(new Vector2(50f, 200f), 7f, 6f));
movements.Add(new BossMovement(new Vector2(50f, 400f), 5f, 6f));
movements.Add(new BossMovement(new Vector2(300f, 350f), 10f, 6f));
movements.Add(new BossMovement(new Vector2(300f, -32f), 10f, 6f));
movements.Add(new BossMovement(new Vector2(50f, 32f), 8f, 6f));
So, i can manage movements.
public override void Update(GameTime gameTime)
{
if (!IsNasted)
{
//Wait for a while
if (waitTime > 0)
{
waitTime = Math.Max(0.0f, waitTime - Scene.Elapsed);
if (waitTime <= 0.0f)
{
waitTime = 0f;
}
}
else
{
//Is the sprite arrives the target position?
if (Vector2.Distance(ConvertUnits.ToDisplayUnits(movements[minx].pos), ConvertUnits.ToDisplayUnits(body.Position)) < 50)
{
//Change the current position index
waitTime = movements[minx].waitTime;
if (minx == movements.Count - 1)
minx = 0;
else
minx++;
//Stop the movement
body.LinearVelocity = Vector2.Zero;
}
else
{
//Move the boss to the specific position
Vector2 v = (ConvertUnits.ToDisplayUnits(movements[minx].pos) - ConvertUnits.ToDisplayUnits(body.Position));
v.Normalize();
body.LinearVelocity = ConvertUnits.ToSimUnits(v * (movements[minx].speed * (float)gameTime.ElapsedGameTime.TotalMilliseconds) );
}
}
}
base.Update(gameTime);
}
What are your tips and tricks to successfully finish a hobby game project in your freetime?
What are your tips and tricks to successfully finish a hobby game project in your freetime? How do you motivate yourself to keep it up and drive right through to the finish without losing interest or motivation along the way?
- Set tiny milestones. Having a goal like "item system works in my RPG game" is all well and good, but that implies a whole lot of under-specified functionality that you probably didn't even know you needed. What about "graphics environment set up"? Or, "A sprite is displayed on the screen."
- Do a little bit each day. Marathon sessions are great and all, but you're trying to squeeze a long-term commitment into an already crowded life. If you do a little bit each day you are making measurable progress and establishing a structure within which you can achieve your milestones.
- Scale yourself back. Whatever your grand vision is, try and figure out what the smallest achievable portion is and do that. Making an RPG? Start with one quest and no NPCs. Making a platformer? Start with one level and no enemies.
- Prototype early. Before you sink a bunch of your hard-earned hobby hours into a game, figure out if it'd be fun first. There's nothing so dispiriting as working your ass off on something for dozens of hours only to find that the basic concept sucks.
- Develop something iterable. My favorite hobby software projects are the ones where the basic concept allows for later tinkering. Is your game like that? Can you ship something and then revisit it later and add cool stuff?
- Don't build an engine or a framework. You don't want an engine, you want a game. Don't worry about the framework-y, reusable bits until after your game is shipping. Once you start on the second game, then you can go back to your first and see if there's anything you could bring over. That's not to say that you shouldn't use sound software development praxis, but don't start by writing a Sprite class until you know what you need your sprites to do -- you'd be surprised how little it'll turn out to be. Start with a Hero class, then a Monster class, and then -- oh look! -- there's some common stuff!
- Shipping is a feature. You're never going to finish your game, you're only going to abandon it. ( = What is the minimum amount you can do before you're not completely embarrassed to show your game to someone else? Chances are, you can do less than that and still have a game to be proud of.
8 Ocak 2015 Perşembe
Güdümlü Roket Algoritma Çalışmaları
Bir süredir güdümlü roket ve hedefi takip etmesi için çalışmalar yapıyordum. Şu an en azından hedefi takip etmesini sağlıyorum. Ancak daha gerçekçi olması için particle kullanarak duman oluşturmalıyım. Performans sorunu olabilir.
//Delta zamanı hesapla
float delta = (float)gameTime.ElapsedGameTime.TotalSeconds * 560;
//Yönü bul
Vector2 direction = ConvertUnits.ToDisplayUnits(Target.Body.Position) -
ConvertUnits.ToDisplayUnits(Rocket.body.Position);
direction.Normalize();
//Hareket et
currentPos = direction * delta;
Kaydol:
Kayıtlar (Atom)