Categories
Crypto

Announcing AdvGa goes Crypto

Years ago, I wrote an “choose your own path” adventure game for iOS called Plot Theft Awesome 5. It never set the world alight, but it was fun, and the engine behind it was highly customisable. Over the years, I have rewritten it a couple of times, and now it is getting into the 21st Century.

I am currently working on integrating it with Unity in an attempt to bring it to as many platforms as simply as possible. Using Unity means I can plug it into the Solana crypto ecosystem and implement some of the features I have always wanted to add.

These are

  • First is NFTs. Say you are playing a fighting game and not getting very far. Buy a sword and level your character up. Use the same sword in multiple games. When you have finished, sell it on a marketplace.
  • The second is buying games. As the games themselves are fairly simple, there is no reason why you can’t buy a game as an NFT. If it is in your wallet, then you can download the game files and play them. Once you have finished, you could even resell the game. People can write their own game, upload it and get royalties from sales.
  • Store your character online as an NFT. One of the features is that you can define a character and have it as the hero of the game. This character NFT would be where things like achievements are stored.

Ideally, my timeline is as follows

Finish Engine Mods (85% done)

Get a playable version on itch.Io

Design a web store

Release the game editor

Work on community building

Run a competition to get some initial games

???

Profit

Now I just need some help and some money to do this.

Categories
Other

Reddit Moderation is Broken

Up until a few months ago, I was a great fan of Reddit. It was my go-to place for hot takes on all my hobbies and local news. Not any more, though. I have fallen foul of the Reddit moderators, and apparently, will never be able to use the site again.

It all started when Elon Musk was going through his Nazi phase. Everyone was piling in on Reddit. I may have commented r/elonmusk, which I later discovered was purely for fanboys and where dissent was not allowed. That got me a ban from that sub. That was ok as I have a couple of accounts and it’s not like I spent a lot of time there anyway.

Fast forward five months, and someone posts videos of Musks humanoid robots. The robots are moving at a normal rate, but the humans in the background are flying around like a double speed Benny Hill video. With my good account, I just asked to see the original videos. What I posted was irrelevant. Reddit knew the two accounts were linked, and down came the ban hammer. “You are being banned for ban evasion, i.e. a previous account of yours was banned and you’re trying to dodge the ban”. Honestly, it was five months ago, and I had forgotten about the first ban.

So what went wrong? Firstly, a lot of the banning is done by bots. These faceless upholders of the law have no concept of context and purely ban you because you posted when you weren’t supposed to. The second post could have been me professing my love for Musk and his work, and it would still have banned me. Secondly, Reddit has a graph somewhere showing how all your accounts are related. I guess it is IP address related, as the accounts I have since created are banned as well. My question is, why on earth did it let me post the second comment in the first place? It knows I have a ban on one account. If it had said, “I am sorry, one of your accounts appears to have a ban on this sub, we can’t let you post here”, I would have shrugged and got on with my day. As it is, I am writing this blog.

I appreciate that some of the subs are quite contentious and there are inter-sub rivalries. I can’t help feeling I am an innocent bystander caught in the crossfire. I have tried appealing, but with no success, as I suspect that it is run by bots as well.

Categories
Apps Crypto

Xamarin & Metamask Mobile

NFT Gallery is going from strength to strength. One issue I have with it though is the user having to paste their Ethereum address into the wallet page. As anyone can paste any public wallet address, you can have anyones collection on your phone. So I have been thinking how to integrate Web3 tech into the app.

Web3 means cryptocurrencies, blockchain technology and the one problem is that it mostly lives in web browsers. Most people who use Ethereum access it via the Metamask browser plug in. In the mobile world you can’t really have plug ins and so Metamask exists as its own app, Metamask Mobile (or MMM for short). This lets you manage your accounts and interact with Dapps via the built in browser.

So how do you get two apps to talk to each other? The answer is deeplinks. MMM has a couple of deeplinks that allow you to trigger things in the app. One is to open a Dapp (or a website). The trick is to open a webpage in MMM, get the users Eth address and then trigger a deeplink back into your app. Luckily I know a smattering of Javascript and had played with deeplinks on a previous project.

Deep link communication loop

First of all you create a web page on an https web server. Mine is here. The gist of it is that Metamask injects a javascript object called “ethereum” into the web page and the code interacts with that. Debugging it on the desktop was quite easy but in the app, it worked slightly differently. To debug you need to build your own debug version of MMM and remotely connect from the desktop to view your javascript. I got it working though.

To call MMM and get it to run your code you do something like this in c#.

await Browser.OpenAsync($"https://metamask.app.link/dapp/www.redfivesoftware.com/Web3Metamask.htm?return=http://" + AppName);

This opens a url on the device, which opens the deeplink into the app, which in turn opens your web page in the browser tab. In this case Web3Metamask.htm. Currently I pass one parameter in which is the start of the url that calls back to my app.

Then it is simply a case of overriding the OnAppLinkRequestReceived in your App class and processing the URI that was passed back into you.

    protected override void OnAppLinkRequestReceived(Uri uri)
    {
        Logger.Info(uri.AbsolutePath);

        string url = uri.AbsolutePath;

        var bits= url.Split("/",StringSplitOptions.RemoveEmptyEntries);

        switch (bits[0])
        {
            //{nftgallery:///address/0xce41b49d28800de3ba9925f68d82129dfc4b870b}
            case "address":
                string address = bits[1];
                App.SettingsViewModel.UserAddress = address;

                break;

            default:
                break;
        }

        base.OnAppLinkRequestReceived(uri);
    }

And now you have your eth address. In the next post I will show how to get details of NFTs from OpenSea using their API.

Categories
Crypto

Types of NFT

There has been a lot of press about NFTs recently and some people think that an NFT is just an NFT and if you buy one you will make a profit. There are lots of different types of NFT though and some have more worth/value than others.

All NFTs have the same basic structure. They are a smart contract on the Ethereum blockchain and they can be assigned to a wallet. The only way to move it is to assign it to another wallet.

De-Fi

Decentralized finance is an area that is taking off at the moment. The idea is that it builds crypto banks and exchanges in a decentralized manner. That is ones that are simply smart contracts living on the internet as opposed to companies based in countries with legal implications. These produced the first popular NFTs in the form of tokens that in exchange for liquidity gave you some discount or advantage.

Then there is the whole SushiSwap thing which I have never really got my head round.

Art

This is my area of interest and the area that really hit the headlines recently. People are saying that NFT are a new form of art when what they are is a new form of buying and selling art. In the old days, you sold a picture and that was all you saw of the income from that picture. In the NFT art world, smart contracts have artist royalties built in, so each resale trickles a few % back to the original artist. Some of the NFTs have the actual artwork “built in” while some are essentially simple receipts saying you paid someone for something on this date.

Collectibles

When I was a kid I got through a lot of bubble gum collecting trading cards for my favourite films. then when I grew up I discovered the cult of the vinyl toy. Both these things are collectibles. NBA has something called Top Shots which is the modern hi-tech equivalent of trading cards. You buy packs of “moments” which are little video clips and some are rarer/worth more than others. It is worth noting that Top Shots is running on its own blockchain which is controlled by NBA. This means you can only buy and sell on their markerplace.

The you get things like CryptoPunks and CryptoKitties. They are just things that look cool and fun to have in your collection. You can’t really do anything with them apart from buy and sell them.

Some people also saw the invention of smart contracts as a way to write games the ran decentrally on the web. A lot of these were collectible card games like Magic: The Gathering and Yu-Gi-Oh. You buy packs of cards and fight against other players.

Virtual Real Estate

The final area is 3D virtual worlds like CryptoVoxels and Decentraland. I tend to label this area “Third Life” as it feels a lot like an extension of the old “second Life” game. You buy a plot of land, build a virtual house and populate it virtual nik-naks that people have made and sold. That’s it.

So there you have it, seceral distinct use cases for NFTs. The only problem with all these things is that (in the short term at least) their success is pushing the price of Ethereum up and that is in turn pushing up Gas fees. This means it is harder to actually do anything with these NFTs. It now costs nearlt $100 to mint an artwork and up to $1000 to do any De-Fi transactions.

There other blockchains out there such as Wax and Neo which do smart contracts. They don’t have the momentum though to overtake Ethereum.

Categories
Uncategorized

Renaming an App

Earlier this week I decided to rename one of my apps. OpenSeaGallery was a good name to start with but it seemed to be giving people the impression it was an official app for OpenSea. It got a few bad review on android for things that were nothing to do with the app. Thing is, once an app has been around for a while there are references and links to it everywhere. So in this post I will look at the places you need to change the apps name.

Code

This is the easy one. For android you just change one of the attributes in the MainActivity and for iOS you change a couple of strings in the info.plist. all you are doing ischanging the string that appears under the icon on the phones home screen.

You should also change any references to web pages and social media accounts that use the old name.

Stores

Of course you will first have checked that there are no opther apps with the name you want to use in either store. For iOS you simply create a new version of your app and change the name in the “App Information” tab. For android you gointo the Google Play Console and change the name in the “Main store listing” tab of the “Store Presence” section. This will take immediate effect. You don’t even have to add a release.

Website

My website is a bog standard wordpress website. Each of my apps has a separate page based on the name of the app. Obviously that had to be renamed and updated to reflect the new app name. Now this leaves the matter of any other p[ages on the internet that link to that page. In the end I installed a redirection plug in and set up a redirect from the old page name to the new one.

Socials

My apps also have Facebook pages that needed renaming. That was fairly simple.

Categories
Crypto

Buying NFTs

Everyone is doing it, everyone is hopping on the NFT bandwagon. What is an NFT? In short it is a virtual thing that you buy, you can say you own and that you can sell afterwards. It has something to do with blockchains and is perfectly safe if you know what you are doing.

Buying

To buy and NFT you need some magical internet money. This is called Ethereum. You also need a wallet to keep your money in. You can buy Eth at a lot of different websites but the easiest way is to use Metamask. This is a Chrome browser plug in that lets you buy, send and receive Eth and acts as your username/password for any sites you will be visiting.

You could also use any of the following wallets. Fortmatic, WalletConnect, Coinbase Wallet and MyEtherWallet, but I haven’t personally used them.

Metamask

Once it is installed click on the little fox icon, set up and account and buy some Eth. Then back up your accounts “seed phrase”. With crypto, rather than have a username and password, you get assigned an address and a private key. You need both to things but if you forget one, there is no “forgot password?” feature.

Shopping

You have your money, so lets hit the shops. There are lots of them out there but the big ones are SuperRare, Rarible, NiftyGateway, MyBae, Makers Place, Known Origin and Async Art.

The sites selling NFTs all work the same way so lets look at Rarible. To buy something you have to first connect your wallet to the site. Click “Connect Wallet” in the top right and choose your wallet. Some windows will pop up asking if you wish to connect the two things together. You may be asked to “sign” things, which is their way of getting you to click ok.

Once signed in you may have a profile you can set up with name and avatar, etc. Again this usually involves you signing something, just to prove it is actually you.

Once that is done you can look for things to buy. There is art, virtual real estate, trading cards, business things, Cryptokitties. You name it.

Buying

Once you have found something you like, you click the buy button. Some things go to auction and some have a “buy now” facility. We will assume the latter. Again some windows should pop up asking you to sign things but watch out.

Fees

Most of the signing has been free so far but when you come to make the purchase there will be fees. As of writing this, the cost of buying and NFT is the price of the NFT plus $70. So if you are buying a Pepe meme for $20 you will end up paying $90 in total. Whether you still want to buy NFTs after that is up to you.

Viewing

Now you have your NFT, what can you do with it? Well, the most obvious thing to do is look at it. You can view it on your computer screen but you can also access it on your phone. Nft Gallery is an app for iOS and Android that syncs with your Ethereum wallet and lets you view, collect and cast your NFTs.

Categories
Crypto

Creating NFTs

On the back of the cryptocurrency boom, NFTs are currently all the rage. It is a catch all name for something that can have a lot of different uses. I have been dabbling in the #CryptoArt space for a year now and have exhibited and sold a few bits. It is a confusing world so I thought I would knock up a quick guide to making your own NFTs.

Get some Ethereum

The first step is to get some Ethereum. There are lots of ways to do this but I guess the easiest way would be to buy some straight into Metamask. MetaMask is a wallet for keeping your magic internet money in so it makes sense to deposit it straight into there. It is a browser extension so install it in chrome, click the little fox icon and explore it. The next two steps are

  • Buy some Ethereum.
  • Back up yor wallet.
  • Back up yor wallet again.

Did I mention backing up your wallet? That wallet address thing is your identity from now on, so if you lose access to it you lose anything in it. There is no way of resetting you password or anything like that.

Pick a Website

There are many places to create (or”mint”) your art, but the big ones are SuperRare, Rarible, NiftyGateway, MyBae, Makers Place, Known Origin and Async Art.

It is worth noting that some are like proper art galleries where you are vetted and can only create if you are accepted by them. These normally require some sort of background check and video introduction. Some are more like copy shops where anyone can mint anything they like.

Mint your art

Once you have found a site you like, you shoudl join it. See the post Buying NFTs for more details on joining a website. The jist in you link your ethereum wallet to the site and use that as your username and password.

Next get your artwork. This must be 100% your own creation. It can be an image, video, song or some other sort of thing. If the image is big (or it is an mp3, etc) then it is good to have a thumbnail. This can be average size as this is what is usually displayed.

Next click the “create” button. Give it a name and a description. Your first choice is to mint a single or a multiple. There is only one Mona Lisa which makes it rare and valuable. If you just want to get your name out though, do a multiple of 50 and give them away. If you are doing several related pieces, then you can give them a Collection Name, otherwise they get assigned to the website you mint them on.

You can give it proerties but they are only really used for things like trading game cards. You can set a royalty. This is how much of future sales of that NFT go back to you. Finally some let you set a “buy now” price. If you don’t do this then it goes into an auction where peole can bid on it.

Finally you hit the “create Item” button and it mints your NFT. For a price. Your wallet will pop up a few message boxes asking you to sign things. One of these will include the fees for the minting. Warning, these can be high. It may cost you $70 to mint something that costs $50. In which case you are going to lose money. It is worth keeping the maths in mind when you come to this stage.

Viewing your NFT

Now you have your NFT, what can you do with it? Well, the most obvious thing to do is look at it. You can view it on your computer screen but you can also access it on your phone. Nft Gallery is an app for iOS and Android that syncs with your Ethereum wallet and lets you view, collect and cast your NFTs.

Categories
Apps

Dark Mode for Xamarin Apps

This week I have mostly been trying to get Dark Mode working with one of my Xamarin Forms Shell apps. This is the new feature available on most mobile OSs where the screen goes white on black (rather then black on white) to reduce glare at night. There is no “out the box” solution but after much googling and a bit of fiddling I found something that works.

There were three main changes I had to make to get it working.

  1. Modify the Shell part of the app.
  2. Modify the content of the various ContentPages.
  3. Modify the splash screen.

Starting with points 1 & 2, I referred to these two posts for their approach. Read them but bear in mind I had the following issues. The general idea is that you have two resource dictionaries, one for the light screen and one for the dark screen. The elements have the same names so you can swap them over at run time and it applies the new colours to the existing controls.

Shell & ContentPages

I am quite new to using StaticResources. Hot Reload is great as you can edit the XAML and see it update on the device. This light/dark approach means that the resources are compiled and switched at runtime. This means Hot Reload doesn’t work as the XAML doesn’t have a direct “live” link to the app. This just means you have to get it all looking nice with the XAML as part of the app or page and then copy it to the light/dark ResourceDictionary when you have finished. You might also want to separate out and DataTemplates into another ResourceDictionary that uses the other two.

I also found that this process didn’t work for the Shell objects themselves. by that I mean the UI that presents itself when the app starts up. Navigation bars and Tab bars, but not modal pages. In these cases I defined the Shell colours like this.

<Shell xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:views="clr-namespace:GalleryApp.Views"
        BackgroundColor="{AppThemeBinding Light=SteelBlue, Dark=Black}"
        ForegroundColor="{AppThemeBinding Light=White, Dark=White}"
        TitleColor="{AppThemeBinding Light=White, Dark=White}"
        DisabledColor="{AppThemeBinding Light=Green, Dark=Green}"
        UnselectedColor="{AppThemeBinding Light=LightGray, Dark=DarkGray}"
        FlyoutBackgroundColor="{AppThemeBinding Light=White, Dark={OnPlatform Gray, iOS=Gray, Android=LightGray, UWP=Gray}}"
        x:Class="GalleryApp.AppShell">

While in the content pages definitions it was used as

<Style TargetType="NavigationPage">
    <Setter Property="BarBackgroundColor" Value="{StaticResource NavigationPrimary}" />
    <Setter Property="BarTextColor" Value="White" />
    <Setter Property="BackgroundColor" Value="{StaticResource BackgroundColor}" />
</Style>

Also occasionally I needed a DynamicResource instead of a static one. Half a template would update and half wouldn’t. Also it pays to check ALL of your screens work.

Splash Screens

These aren’t essential but are nice to have. Especially if your existing splash screen is light and bright. For this I mainly used this blog post as a reference. It explains everything you need to know , but as I had done a splashscreen before this was fairly familiar. The only thing I had trouble with was editing the iOS storyboard. I ended up adding the ViewController in XCode rather than in Visual Studio.

Categories
Uncategorized

Build Discrepancies

I have just released version 1.0.2 of OpenSeaGallery. If you looked you will see the Android version was out about a week before the iOS one. I has them both set up in The AppCentre and when I tried pushing the new versions, iOS gave me some fairly serious errors.

Now you have to upload the first version into the Apple app store via the visual studio uploader. It only really handles updates and not initial releases. I had updated a few nugets and stuff like that but the app store sent me an automated email stating I was using some private APIs and UIWebView was depreciated. None of my changes were that drastic and the first version had gone through fine. I swapped out the Chromecast library for a better one and updated all the nugets again. I re-submitted it about ten times and it still came back with that error.

Then I thought, visual studio uploaded the first version fine, so what about the second? I fiddled about with my profiles and certificates and what do you know? Version two uploaded fine. It is now available on the store. This means there is something about my project that causes the AppCentre to build it differently to visual studio.

Where do you start? I guess it must be something in the project file or the references that is causing the issue. I tried googling it and making changes like this but to no avail. I think my only option is to rebuild the iOS project file again from scratch, comparing it with projects I know that do work.

Categories
Apps Uncategorized

Adventure Game Engine

Many years ago I wrote a “choose your own path” adventure game for the iPhone. Its engine was compact, simple and very flexible, even though I wrote it in an afternoon. The game was rubbish and I always thought it deserved better.

Apparently a few years later I rewrote it in .Net possibly with an eye to makeing another app for it. Anyway I think the public probably have more use for it than I do now, so I am making it freely available.

At its heart it is a bunch of “pages” with “options” that take you to other pages. You could write a simple game with just that. It also, however, has variables. These are things like flags, text and numbers. You can display these in the game (“your name is Shaun, you have 6 pickled eggs”) and you can also use them to control what text is displayed and what optiuons are available to the user. Add in the ability to randomise things and you have a game that never plays the same way twice.

Another idea is that the same game can have different front ends. You can play it in a DOS box with coloured text and keyboard input but play it on a phone (iOS and Android coming at some point) and it will be fancy coloured HTML with hyperlinks, pictures and buttons. You could probably even stick it on a web site.

Currently I am just finishing the basic functionality. This includes

  • Load
  • Save
  • Colouring text
  • “Hot reload” while editing
  • Maybe some sort of validation for game editing