Lorenzo

One week ago, Victor Barrios died in the Bullring of Teruel, Spain. He was killed by Lorenzo, a bull from Ganadería Los Maños.

Lorenzo was sacrificed shortly afterwards, and his mother Lorenza may have been slaughtered too as part of a tradition to end the lineage of the “Killer Bull”, but she had reportedly been killed already weeks before, because of her old age.

I did this small game, as a tribute to Lorenzo.

Play now!

All of his life Lorenzo was trained to become a fierce fighting bull, but instead of being hailed as a great champion when he manages to defeat his opponent against all odds, he sees the world turn against himself and his family. Will Lorenzo be able to escape and save his mother from being slaughtered?

SPID1 – Concordia Tournament

I will be posting SPIDs (Slashie’s Project Idea Drafts) in the blog, they will be short ideas for games or other projects I may or may not develop into full projects. May be someone will be inspired by them and save me the trouble of developing them.

SPID1 – Concordia Tournament

dumeril

A simple 4-players hot-seat death-match game themed on the universe of Ananias, players would pick a class and try to defeat the others in 2D combat (similar to Towerfall). Art will not be pixel art but rather illustrations in chibi style.

Each class would have different features:

  • Paladin: Uses a crossbow as weapon, shoots bolts in a short range. Jumps low, can withstand 3 hits (heavy armor). Can attack with the Holy Sword of Destruction at close range.
  • Hunter: Uses a Magic Longbow as weapon, shoots arrows long range in an arc. Jumps high. Can withstand 2 hits (light armor)
  • Alchemist: Uses the Alchemist Carbine as weapon, shoots acid to a mid range in an arc. Can throw explosive potions.
  • Arcane: Uses a lightning wand as weapon, shoots lighting to a long range in a straight row.

During combat, players can find potions and spells they can use on their advantage.

A better build and deploy process for hybrid apps?

The current build and deploy process for Ananias takes a lot of time and requires lots of focus and bandwidth. Everything is done manually (and is thus prone to errors). Most of times I just can’t afford to release for all platforms, and I forget to announce thru all channels.

The cocoon.io parts are a bit cumbersome since they don’t have a CLI and it requires some back and forth, while also adding a dependency to an online service (for how long is it going to work?) I’m going to experiment with some native crosswalk builds to see if that step can be saved.

But probably what takes more time is the manual process to be done for each different storefront via its own web interface. Each one requires different info, and all uploads have to be started and monitored manually. It’s pretty uncommon for a store to supply a command line tool.

May be I should automatize parts of this? Someday I may do that, in any case it’d simplify packaging but wouldn’t make distribution any easier.

This is the current process executed for each new release of Ananias:

  • Mark the new version in the source code (client and server)
  • Generate a new JS bundle using browserify
  • Upload new build to web (ananiasgame.com/play) (About 15MB) (Only Standard edition)
  • Deploy new server version and restart (About 1MB) (including executing migration database scripts)
  • Use nwbuild to generate the executable packages for Windows, Mac and Linux
  • Rename the directories and zip them
  • Upload to itch.io via web interface (About 200MB )
  • Zip web directory
  • Update config on cocoon.io for next version
  • Upload web directory to cocoon.io (About 15MB)
  • Hit the build button on cocoon.io, wait for build to finish
  • Download APK packages from cocoon.io (About 150 MB)
  • Unzip package, copy release APKs (one per architecture, x86+arm7) to APK directory
  • Run script to sign and align APKs
  • Sign in to google play developers console
  • Upload both APK (About 100 MB)
  • Build change log from git commit messages
  • Summarize change log for Google Play
  • Upload both APKs to Amazon via web interface (About 100MB)
  • Upload to indiegamestand via web interface (About 200MB)
  • Upload to gamejolt via web interface (About 200MB) (Only Standard Edition)
  • Upload to IndieDB via web interface (About 200MB) (Only Standard Edition)
  • Set cocoon.io for iOS builds
  • Hit the build button, wait for build to finish
  • Download xcarchive (About 50MB)
  • Open xcarchive in xcode organizer
  • Submit to App Store
  • Wait for processing
  • Go to iTunes Connect
  • Go to Testflight / External Testing
  • Select new build to test
  • Wait for beta review
  • Go back to Testflight / External Testing
  • Set the new build as active.

The process should be executed twice, once for the Standard Edition and then again for the Fellowship edition.

THIS IS A LOT OF WORK. WHY CAN’T IT BE SIMPLER? This process takes out HOURS (Not exaggerating) of valuable and scarce development time for an Indie dev.

Why can’t I just simply update a single web endpoint, and have all the clients deal with the updating? they have to deal with it anyways, they just have to do it with their own, different store.

Also, the game is already multiplatform, if your platform has an HTML5 browser, like all modern platforms, you can play the game (Yes, you can even play the game on a PS4), then why go through all this?

I understand the advantages of having a downloaded app… people wants to feel they own the app, and they want to play their games while offline or in poor network conditions.

It would be awesome if the app could automatically check and download the updated scripts and required assets. This is not a new idea… some people has already tried but there are some obstacles:

  • Both Play Store and the AppStore are not very clear about their support of this model. You may be risking your app being taken down for not complying with the terms of service. They are also not MEANT to work like this, so you are always fighting against their nature.
  • For in-dev games, the player wouldn’t be notified a new version exists unless he runs the game or you implement some kind of push notifications.
  • The system has to work perfectly, if it doesn’t then your players will be stuck with an old version, or will be unable to play offline, or will end up with a malfunctioning app.
  • Another thing to consider is that this would prevent players from updating the web runtime in which the game runs, although I guess that may be fixed via a normal update.
  • If the player uninstalls the app or erases its data cache, they will have to redownload all assets.

There is a cordova plugin (cordova-app-loader) which adds support for “hot updates”. It seems to work but has some issues (based on what people reports). I don’t know of any similar tool for node-webkit / NW.js, I guess it’d have to be done manually.

Any thoughts?

Exult Turn Based Combat: Small advancements

Been working on the actual Turn Based Combat flow, I’m now using some of the “time_stop” support for the actual battle turns (That is, the way the engine handles the “Stop Time” spell).

The game now stops when in combat mode and I’m also counting the player steps and ending his turn when it hits a limit. Also, using a timer I’m reenabling the player after 2 seconds.

It starts shaping up but there are still some things to do:

  • The avatar’s combat AI is still kicking in, even when he is not in his turn and he’s set to Manual combat mode. So, as long as we are not trying to move he’s going to go ahead and attack nearby enemies nonetheless.
  • The party members keep following me, haven’t been able to make them stick on their place until it’s their turn to move.

Static HTML generation for slashie.net website using MustacheJS

I did some back-end changes for the slashie.net website, with the idea of making it easier to include new projects and update their status. About one year ago I went for a single page layout, but was doing maintenance over the HTML file… which was a bit frustrating. With the new approach I can easily manipulate how the list of projects is shown. You can see the current results at slashie.net

I looked around a bit for a static site generator, but in the end decided to roll my own since what I was going for was extremely simple and didn’t want to meddle with the setup of any of these.

What I needed was generating a single HTML file based on a JSON file with the information of all my projects. I decided to go for nodejs using mustachejs for the template; the script is dead simple… I thought I’d share what I did, in case someone needs something similar. This approach gives you a lot of flexibility, as long as you don’t need to maintain a lot of different pages.

Mustache

First, the data, it’s basically a structured list of all my projects

{	
	"sections": [
		{
			"name": "Games",
			"id": "games",
			"items": [
				{
					"title": "Ananias",
					"image": "img/buttons/ananias.png",
					"text": "Dive to the bottom of the Tomb of Ananias using your smartphone or computer. Take adventure with you everywhere!.",
					"status": "published",
					"buttons": [
						{
							"title": "Play Online",
							"url": "http://ananiasgame.com/"
						},
						{
							"title": "Android Version",
							"url": "https://play.google.com/store/apps/details?id=co.slashland.ananias"
						},
						{
							"title": "Desktop Version",
							"url": "http://slash.itch.io/ananias"
						}
					],
					"tags": ["turn-based", "stable", "denzi", "roguelike", "pixel-art", "javascript", "android"]
				},
				{
					"title": "Rodney",
					"image": "img/buttons/rodney.png",
					"text": "Slash your way to the bottom of the Dungeons of Doom, learn new skills and use tactics to survive.",
					"status": "published",
					"buttons": [
						{
							"title": "Play Online",
							"url": "http://games.slashware.net/rodney"
						}
					],
					"tags": ["turn-based", "stable", "oryx", "roguelike", "pixel-art", "javascript"]
				}
			]
		}
	]
}

Now, the generator itself, it basically reads the data and the template, parses the JSON and then renders it using MustacheJS

function generateFile(){
	var file = fs.readFileSync('data.json').toString();
	var template = fs.readFileSync('template.html').toString();
	var data = JSON.parse(file);
	groupByStatus(data); // Groups by status and sorts items
	calculateNewRows(data); // Adds the newRow and endRow attributes
	var output = Mustache.render(template, data);
	fs.writeFile('index.html', output);
}

Now, I had to add the groupByStatus and calculateNewRows functions in order to do some processing over the raw project data (namely grouping the projects by status and grouping them by 3); Mustache declares itself as a logic-less template system, which means it lacks if/else statements or loops. All it does is replacing stuff. You may have to do something similar, depending on how complex you need your page to be.

Finally, this is my Mustache template, as you can see, it’s pretty simple

<!DOCTYPE html>
<html lang="en">
<head>
	<title>Slashie.net</title>
	<link rel="icon" type="image/png" href="img/icon.png">
	<meta charset="UTF-8">
	<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
	<link href="lib/bs3/css/bootstrap.css" rel="stylesheet">
	<link href="css/slashland.css" rel="stylesheet">
	<!--[if lt IE 9]>
		<script src="lib/bs3/js/html5shiv.js"></script>
		<script src="lib/bs3/js/respond.min.js"></script>
	<![endif]-->
	<script type="text/javascript" src="lib/jquery-1.10.2.min.js"></script>
	<script type="text/javascript" src="lib/bs3/js/bootstrap.js"></script>
</head>
<body>
<section class = "container">
	<section class = "page-header">
		<div class = "row">
			<div class="col-md-2">
				<div id="logoImage"></div>
			</div>
			<div class="col-md-5">
				<h3>Welcome...</h3>
				<p>I'm Slash. This is my collection of game projects, I hope you like them!.</p>
				<p>You might also want to check <a href = "http://slashwareint.com">Slashware Interactive</a>, which is my brand for finished products.</p>
				<ul class="nav nav-pills">
					<li><a href = "http://blog.slashie.net" target = "_blank">Blog</a></li>
					<li><a href = "https://twitter.com/slashie_" target = "_blank">Twitter</a></li>
				</ul>
			</div>
		</div>
	</section>
</section>
{{#sections}}
<section id = "{{id}}">
	<div class = "container">
		<h1>{{name}}</h1>
		{{#count}}<h2>{{count}} projects</h2>{{/count}}
		<p>{{text}}</p>
		<div class = "container">
			{{#items}}
			{{#newRow}}
			<div class = "row">
			{{/newRow}}
				<div class="col-md-4">
					<div class="thumbnail">
						{{#image}}
						<img src = "{{image}}"/>
						{{/image}}
						<div class="caption">
							<h3>{{title}}</h3>
							<p>
								{{#tags}}
								<span class = "label label-success">{{.}}</span>
								{{/tags}}
							</p>
							<p>{{{text}}}</p>
							{{#buttons}}
							<a href = "{{url}}" target = "_blank" class = "btn btn-primary" role = "button">{{title}}</a>
							{{/buttons}}
						</div>
					</div>
				</div>
			{{#endRow}}
			</div>
			{{/endRow}}
			{{/items}}
		</div>
	</div>
</section>
{{/sections}}

<div id = "footer" class = "text-right">
	<p>Copyright (c) 2004 - 2016 Santiago Zapata</p>
	<p>Generated using <a href = "https://github.com/janl/mustache.js/" target = "_blank">mustachejs</a></p>
</div>
</body>
</html>

You can find the mustache tags in the “sections” section, as you can see mustache interprets each attribute contextually from the source object.

The # mustache tags (for example {{#sections}}) represent a repeating block; the contents inside will be replicated for each one of the objects if the attribute is a list, or once if the attribute exists. (this is used for example on the {{#image}} block, to only show the image tag if the project has an image)

The double and triple mustache tags {{}} and {{{}}} are replaced with the value of the attribute of the given name on the context object. The triple mustache leaves HTML content unscaped, which may be useful if you want to include HTML content directly.

Finally, the {{.}} tag is used to include the value of an object directly, it’s useful for example to include the content of arrays of strings.

And that’s about it! now I can easily add new projects without having the worry about the page layout! My program sorts the projects in alphabetical order and groups them by type and status. What’s also important for me is it takes care of the grouping by 3 items which is required by the way I’m using bootstrap.

And of course, the main point of this is decoupling the data from the view, which in turns takes me to the following point: I may in the future work a bit in the frontend side, to maybe get rid of bootstrap and include some filters…

I hope this is useful for someone to create a simple portfolio or similar page.

Exult U7 Turn Based Combat – Designing stuff

Check previous post for context

I started digging through the code, got some guidance from Malignant_Manor over #exult at freenode IRC. Other than that it was good old code archeology 🙂

General Structure

The idea is to create a new module for turn based combat (turn_based_combat.cc), it will include all the methods that will be called from other modules.

All these changes apply only if combat mode is set to turn based.

turn_based_combat.cc methods

pauseGame()

  • gwin->get_tqueue()->pause(SDL_GetTicks());

resumeGame()

  • gwin->get_tqueue()->resume(SDL_GetTicks());

onCombatStarted()

  • Invoke freezeTurn()

onCombatEnded()

  • Hide the “pass turn” button in the UI
  • Resume the game if paused

runTurn()

  • Hide the “pass turn” button in the UI
  • Set playerActionsBlocked = true
  • Resume the game
  • Schedule “Freeze turn” in TURN_TIME_MS
  • TURN_TIME_MS = what it takes for a melee action. (Use 500ms initially)

freezeTurn()

  • If combat is over, onCombatEnded() and return
  • Show the “pass turn” button in the UI
  • Set playerActionsBlocked = false
  • pauseGame()
  • Set the player walk counter to 0

updateWalkCounter()

  • Increase player walk counter by 1
  • STEPS_LIMIT = how many steps can the player take over the TURN_TIME_MS
  • If walk counter > STEPS_LIMIT, runTurn()

Modifications in other game modules

Activate Turn Based Combat Mode

These places must invoke tbc.onCombatStarted.

  • Game_window::toggle_combat in gamewin.cc, when setting combat to true. This is triggered by either being attacked by a NPC, or attacking an NPC,  or manually changing combat mode

Deactivate Turn Based Combat Mode

These places must invoke tbc.onCombatEnded.

  • Game_window::toggle_combat in gamewin.cc, when setting combat to false. This is triggered when the player dies. Couldn’t find out if it’s called when battle ends.

Player character combat mode

If TBC is activated, the Avatar character should always behave as in combat mode Manual.

Check for player turn-ending actions

These player actions must invoke tbc.endTurn

  • Attack a monster

TBC mode will override the player combat mode so it’s always manual. That means attacking a monster will be done specifically by double clicking on it. This is handled in Game_window::double_clicked in gamewin.cc, specifically by main_actor->set_target(obj);

This should set the main actor’s schedule to Schedule::combat, which in due time will invoke Combat_schedule::attack_target (combat.cc).

Turn should end here regardless if attack hits.

This method seems to handle both melee and ranged attacks, as well as probably using items on enemies to attack them. It also seems to happen after the attack animation, which is great for our purposes.

  • Cast a spell

Over Spellbook_object::execute_spell (objs/spellbook.cc), this intercepts just before the spell is cast, however must also have in mind spells requiring a target, these use the click_on_item intrinsic too (see below)

  • Use an item

This one’s a bit complex: initially Game_object::activate (objs/objs.cc) may work, the problem is some items are not used immediately but require setting a target, and the target selection is handled by the UI_click_on_item usecode intrinsic, which is ultimately represented in usecode/intrinsics.cc (there’s a #define magic going on there, but basically the code over USECODE_INTRINSIC(click_on_item) becomes what the usecode calls)

Passing the Turn

This involves adding a new UI element to the game window. When it’s clicked it must invoke tbc.endTurn.

Blocking player actions

If tbc.isActive && tbc.playerBlocked (i.e. the player just acted, waiting for a new turn), player cannot do any of the following actions:

  • Attack a monster
  • Cast a spell
  • Use an Item

Limit walking while in combat

Every step the avatar takes should invoke tbc.updateWalkCounter

Pending research, may also need to find a way to interrupt the walk path.

Ultima 7 Turn Based Combat for Exult

Ultima VII is a great game, I still remember around 1998 when my aunt bought a Pentium PC with “multimedia”, CD-ROM and a Sound Blaster card. It even had dialup Internet!

In a time where all you could find around were CDs with Shareware demos, I found a treasure among the driver CDs: Ultima VII, Ultima Underworld, Savage Empire and some other awesome games were included as some sort of samples of the power of Creative Labs’ Sound Blaster card. They even came with a small thick book bundling the manuals for all of them.

creative
Thank you, Creative Labs

Funny enough, getting these games to run was actually quite complex… most of them required tweaking things around, but it was worth it… I played the heck out of all of them (Except Wing Commander Academy, which for some reason I never liked too much, and the Mahjong one because… well, it was Mahjong.). These games were a defining part of my life… I learned English reading these manuals and playing these games made my interest in game development grow even more…

Back on track, Ultima VII is a great game… I still remember once I finally managed to make it run how a world came alive in my aunt’s computer screen. It felt so massive… the graphics looked so vivid, the music was so great, the world was alive with everyone living their own life… I think I didn’t actually get to play thru the game back then, but it left a great impression on me.

Screen Shot 2016-02-07 at 1.00.57 AM
Hint: There’s something creepy in the stables

That being said, there are two things that have always bothered me about Ultima 7:

  • The weird overhead perspective: Although I have been pointed out that it’s actually pretty effective for gameplay over other projections, since less space is hidden by walls.
  • The combat.

Combat is an important part on cRPGs. In some cases it’s the only type of conflict, and you need conflict to control the pace of the game.

Now, imagine you are playing Chrono Trigger (another cool game, a bit more widely known). Imagine you meet a group of enemies but instead of going into battle mode all your party members just pop up and run toward the enemies, while the party of enemies rushes to your characters and starts breaking through them. You don’t have a chance to think thru and use spells or items, everything happens so quickly that after 2 seconds your party is dead.

Cyccave
Just sit through the battle and hope everything goes well (Image from Ultima Wikia)

That’s basically what combat in U7 felt like. You were never in control. What a wasted opportunity, specially since previous games had contributed a great share to how tactical battles were handled in computer RPGs!

I must note that the game provided you with the opportunity to set up a combat mode for each of your party members, you could set them to attack the strongest or weakest opponent, among many other options. However, this didn’t really help much to engage with the game once combat started.

Screen Shot 2016-02-07 at 12.59.12 AM
Granted, dark blue on black isn’t very readable 🙂

Exult is one of the oldest and more popular Ultima fan projects; it allows you to run all the games using the Ultima 7 engine in modern platforms. It’s not a remake… it takes the data files from the original games and uses them to run a custom made engine, adding a lot of options for improved user experience in addition to making it dead simple to run in about any modern computer.

But, there’s another thing that Exult allows doing, it gives us a chance to fix things we don’t like about the original game. And that’s what I intend to do!

xrotate1
Some years ago there even were some efforts to provide a different perspective change (it wasn’t included in the main version for technical reasons)

I want combat in Ultima 7 to be more interesting, more relevant, more tactical. I want to try and make it turn based.

The idea is pretty simple:

  • Exult already supports pausing in combat
  • We must detect when the party engages in combat and auto pause.
  • From here the player can either:
    • Move around a limited number of steps
      • This one may probably be the most complex thing to detect
    • Attack a monster (either melee or ranged)
    • Cast a spell
    • Use an item
    • Pass the turn
      • Requires adding a button to the UI
  • Once the player does any of these, the game resumes for about half a second, and pauses again if still on battle and the player is still alive.

So far I have checked-out Exult’s source code and set up my dev environment with help from dominus. I started looking around a bit and found out pausing and resuming the game can be accomplished using gwin->get_tqueue()->pause(SDL_GetTicks()); and gwin->get_tqueue()->resume(SDL_GetTicks());

I’m planning to meet with dominus next week to discuss my idea with him and maybe get some pointers 🙂

Ananias 2015 downloads

Here are some rough approximate numbers for the downloads and sales for Ananias on 2015.

Storefront Platforms Downloads Sales Earnings
itch.io Desktop 2,272 36 $169.85
indiegamestand Desktop 157 10 $34.04
gamejolt Desktop 6,074 0 $2.64
indiedb Desktop 12 0 $0.00
Play Store Android 17,213 489 $987.47
Total 25,728 535 $1,194.00

Some stuff coming for Ananias in 2016

In addition to the Steam and iOS releases of Ananias 2.0, which I hope we’ll be doing on January (or February at most), there’s a couple other nifty stuff coming for Ananias in 2016.

Ananias Wear

pohna-the-barbarian-tank-tops

Not to be confused with Ananias for Android Wear, we are going to be selling T-Shirts and other apparel with awesome brand new Chibi art for all player classes, illustrated by Laura Espinosa Art (A local artist from Medellin, Colombia).

Heroes of Ananias Miniature Collection

DumerilPreview

I’ve also been working with a friend on a physical set of miniatures we will be selling initially in my country (Colombia). If all goes well we might start doing international shipments but we’ll see.

More info about all this coming soon 🙂