Thursday, July 29, 2010

Enemy Spells

Despite power blackouts at home and new workloads in my day job, I've managed to get some progress done so I'm uploading a new video today. Enemies can now cast spells and have enchantments. I've started by giving the fire element an immolation enchantment and the ability to cast firebolt. The nice thing is that it takes very little data to set up, so I should be able to go crazy with enemy enchantments.  The fire elements data is fairly simple:

  < enemy name="fire.element" desc="fire.element" sprite="fire.element" lvl="5" str="15" dex="2" con="15" int="10" fireresist="100" coldresist="-100"  >
    < drop chance="10" minCount="50" maxCount="100" name="gold" / >
    < enchant name="IMMOLATE" / >
    < spell name="FIREBOLT" cond="(randomPercent 50) and (inRange self target 2 4)" / >
  < / enemy >

A simple condition script determines when they should fire the firebolt. This one is a simple random chance when in range of the player.  I can make them more complex if needed.

The immolate spell is also just a simple script:


  < enchant name="IMMOLATE" desc="IMMOLATE" longdesc="Inflicts 2 points of fire damage to any nearby enemies per move and increases fire resistance by 10" >
    < req name="ruby" / >
    < req name="abrusseed" quantity="2" / >
    < req name="bloodroot" quantity="3" / >
    < event name="OnSecondaryStats" script="addStat fireresist (power * 10)" / >
    < event name="OnTick" script="foreachneighbour 2 (doDamage it fire (power * 2) immolate)" / >
  < /enchant >


The enchantment increases your fire resist whenever the secondary stats are calculated,  and does damage to all neighbouring actors, regardless of friend or foe. I think friendly fire is usually a good thing so I'm letting the fire elements kill other creatures if they go too close. I'm hoping this will create some interesting strategies and dynamics.  Creatures will be able to attack other creatures. There will be charisma based spells that can influence creatures into going passive or attacking other creatures.

Firebolts, on the other hand, are still quite hard coded.  I'm still conflicted with which way to go with them. Moving them to script would be good, though the visual effects tend to be very specific per spell so I'll need to think it over more to see if it a few generic systems could cover a lot of spells.

I've also added tabs to the universal inventory screen. The number of elements in the menu was always going to be quite large and scrolling through pages of entries is far too tedious. Splitting into 4 groups seems to cover it well for now. Hopefully I can get by with only four,  though I think it may be necessary to split them up further when there are a lot more spells, enchants, missions and beasts.





Sunday, July 25, 2010

More content...no videos...

Spent the last night playing Microsoft GameRoom on the PC... I don't have an X360 :( so I've been relegated to playing it on my laptop. Some great classics on there if your into retro gaming. Of course, I may be biased, since I work on GameRoom during the daytime :)  I'm in the leaderboards for Scramble and Gyruss... at least for a little while until I get knocked out of the leaderboard.

I had intended to post a video of the town tonight, but I've reneged and am going to work on adding new content instead. It takes most of a night for me to take video, convert and upload.it along with an accompanying block.  I'll definitely get a video next week, and it should have a lot more goodies to show off. The town art is in, but I've not designed any towns yet.  I've got nearly enough content to start the tutorial mission and design "magenta" which will be my primary town, for the early missions at least.  I still need to add some scripts for locking and unlocking gates, so your trapped until the tutorial mission is over, but that's fairly trivial stuff.

This week I've added some animated water, fixed up various minor iPad bugs, added some scripts so the immolation enchantment is now working and damaging nearby enemies and a new enemy - fire elemental. Not much point posting a static screenshot of animated water, but I can at least post a shot of the elemental..


On an unrelated point, I think I found a great subject for a minigame... The towns and cities in Magelore will have at least one minigame each - not necessarily all available at launch time. This is presented as a mage who will sell you a magical tonic to drink. If you drink it you are transported into the game and return when the game is finished. The games can be any gameplay idea I'd like to prototype. I think I'd definitely be able to come up with way to squeeze Trogdor into a minigame...










Tuesday, July 20, 2010

Work started on Town graphics

I've started work on gettng the town graphics into the game and I'm really happy with the progress. I had to add some new features to the lighting system to make it look just right and it all seems to be working out quite well. I've made the wooden floor lighting use an "interior floor" lighting mode where sunlight fades out quickly over distance, so even at midday, the interiors will get quite dark if you don't have any artificial lights.  I've added a couple of tables that give light and a wall lantern, so most rooms will be lit 24hrs a day,  but it allows me to do complex adjoining rooms that are very dark even during the day. I've also changed the way walls are lit so the entire wall brightens up. Previously the 4 corners of a tile would receive different lighting, and to cut a long story short, this meant that the top verts could go black from being in shadow while the bottom verts would be light... this is a side effect of a trick I use to save on overdraw - everything is actually a flat 2d tileset and just made to look like things are orthographic 3d. Allowing tiles to overlap neighbouring tiles completes the illusion.

I've added door objects that open and close as you pass through them, which works great with the dynamic lighitng. I've made the doors 50% shadow casting (like the forests) otherwise doors below you would just be black silhouettes due to the shadow system. You can see this in the screenshot below.

So, here is a teaser screenshot. I'll do a video of it on the weekend as it looks great watching the dynamic lighting kicking in as you walk around and open and close doors..

Saturday, July 17, 2010

New content - ice magic, respawn points

Hooray, hazzah and woot..  I've made some actual visual progress at last. A couple of weeks of restructuring and engine fixes are finally over and I've started working on miscellaneous new features.  This week, I've done a few additions and modifications.

Firstly, the death and respawning is in now. Respawn spoints will be spread throughout the maps and are activated by running over them. Only 1 respawn point can be active at once, so the player will respawn back at the most recently activated respawn point. This is meant as a strategic penalty to be managed by the player... Of course, pretty much anything that is a penalty to the player is open to revision since players don't usually appreciate being penalised for anything.  Whenever you die, you teleport back to the respawn point and are revived with minimal hitpoints and mana and with any spells/curses or ailments removed.







Secondly, there is now an Ice Bolt spell. This is like Fire Bolt except with a chance to freeze. All cold damage done also attaches a cold status modifier for a few turns which will reduce their movement and attack rate. Also, any frozen enemy has a slightly increased critical hit chance. I pinched that idea from WoW. I hope they forgive me.





Next, I've upgraded the inventory screen. You can now see exactly how much effect any enchantments have on each stat. This includes indirect effects such as Giant Strength increasing your damage since damage is affected by strength. The enchanted crystals graphics have had a rework and it also shows how effective each crystal is when slotted  (since slots are all affected by misc. elements like light/day/war/peace).





I've added 2 new enemies. Trolls and Ogres. Both of these turn to stone during daylight so there is an element of strategy here, especially if you get quests that involve killing these beasts, or running through an area inhabited by high level ogres or trolls. While they are stone they are completely immune to damage, so no sniping them. You'll need to camp and wait till sundown if you want to battle them.





Finally, I've done some more work adding hi-res versions of more textures and tilemap graphics. Looking forward to getting an iPhone4 to see how they look on the "retina" display.

I think I'll probably work on getting a shop working, and getting some puzzle elements in place yet, but I should dump some more ideas on paper and prioritize them. Looks like a few weeks still till I'm really ready to start laying out real content.



Saturday, July 10, 2010

Universal App - Technical Details

Back again... I've been hard at work upgrading the engine to handle multiple resolution issues properly, since universal apps must deal with 480x320, 960x640 and 1024x768. Most of the systems in the engine jwn systems  (just-whats-needed)  and it turned out the view system was a nest of hardcoded view sizes.  I've got it working fairly well now, and I've had some requests to talk over some technical issues, so tonights blog will be mostly boring technical facts to do with how I handle the universal app problem.

Firstly,  Magelore will be a universal app - which means one download will work on iPhone, iPhone4 and iPad. This means the download will include high definition (2x resolution) artwork that will be used on iPhone4 and iPad. All the apps I've purchased so far for my iPad have been specific "HD" apps that only run on the iPad. I can only guess why this is currently, though I can think of a few factors at play. Currently, you can get away with $5-$11 for an iPad app, but its hard to get more than $1 for an iPhone app.. So packaging iPhone and iPad together would mean you either get no iphone sales, or you get poor return on iPad sales.  My answer to this is that I may release a low-def version of the game that is iPhone only if I have to... There's also a possiblility the game will be free with in-app purchases, so initial sales are not important - I want it in as many hands as possible.

So, as a universal app, I need to support the 3 resolutions. I don't want to have to completely layout the UI 3 times,  especially since iPhone and iPhone4 are the same screen size and aspect ratio, it seems more appropriate to make the writing and buttons clearer than smaller.  For iPhone4, everything can be identical to the iPhone, just using double resolution art. So I've set the orthographic projection size for both of these to 480x320. No code has to change for the iPhone4 version.

However, for iPad, you have to deal with a different aspect ratio of 4:3 instead of 3:2.  Anyway you do it, some UI will need to have a different co-ordinates. Also, the distance between buttons is physically different with a much bigger screen, so its desirable to move some buttons around to reduce the amount the players will need to move their hands during play. So for iPad, I've gone with ortho co-ordinates of 512x384. This has lots of advantages. Without altering the map renderer,  we get slightly more map view area, which is nice,  but not so much that its a different game (due to being able to see enemies much further away).  It's also very important to stick with ortho co-ordinates that are a multiple of the hardware pixels. This way we still get pixel perfect rendering of fonts and sprites. I ended up spending 3 days getting the font rendering just perfect so all resolutions display their fonts cleanly. As a test, you can see in the image below that the 'i' and the 't' have perfect clean edges - no stretching or bilinear filtering artifacts.


The next problem was how to get the game rendering with higher definition sprites. My current sprite pipeline is to load a psd, and each layer becomes a sprite. Another layer can be used to define the "hotspot" of the sprite (also known as the pivot point or handle). Adding a double size sprite in my pipeline would just make them doublesized on screen.  There's a lot of solutions to the problems, but I'll just outlay what mine was without going into pages of reasons. The engine now appends a "_hd" to the filename and tries to load that first.  If we are NOT in highdef mode,  that file is downsized to half size for the low def version.  If the "_hd" file is not found,  the regular file is loaded instead.  For any "_hd" file (that is not downsized), the resulting Image and Sprites are marked as highdef and are rendered at half size.  The same system is in place for fonts. I use "BMFont" from AngelCode to generate my fonts. With high def, I can make the fonts a little fancier and they are still readable. In lowdef mode, I've gone for fairly boring fonts, preferring to make sure they are easily readable.

Here is a sample of how the extra resolution adds to the quality of the graphics.  Note that I haven't added highdef versions of the tileset yet.


Since most of my UI system will go through the universal info screen,  I've redesigned that to work of percentages rather than actual co-ordinates. That means it only shows slightly more information on the iPad than the iPhone.  Also, it means the art work is quite geometric (rendered boxes and gradient) rather than intricate artwork. I'm not sure if this detracts from the overall production values, so it may change in the final version of the game, but for now it is quite function.


Finally, here is a shot of the same scene on iPod, iPhone4 and iPad. To be honest they are screen shots from the PC version running in "compatibility" mode (I can put ipod, iphone4 or ipad on the command line and it emulates the correct backbuffer and viewport sizes).

iphone

iphone4

ipad

Thats all for now. I've also added icebolts and the ability to freeze enemies, or slow them. I've still got a little work to do - I need to convert the magic absorption stats to magic resistant stats so they can be used to resist freezing or cold effects. Once thats all in I'll do a new gameplay video. Hopefully I can get back to adding content now and less engine work.

p.s. if you have any questions or topics you'd like me to discuss, please add a comment below or email me.

Sunday, July 4, 2010

False Alarm - Old apps are fine...

Got confirmation that Apple won't be removing any old 2.0 apps from the appstore - just not allowing new apps to come in using that sdk. This means I don't have to upgrade Venger and my other apps after all. yeah! Back to work on Magelore.

I've put in support for high definition art now - just need to create it all now... The engine now appends an _hd extension to psd's and png's for the ipad and iphone4 versions so they can load a 32 bit double rez version, and the iphone 3g / ipod will load a 16 bit standard rez version. The plan is to keep the app universal, so if you buy on any platform you can play on every platform with the appropriate graphics set. I'm still stressing over if the app should be free with in app purchases, or a one time price. Plenty of time still to work that one out.

Anyway, a few more bugs to work out on ipad (alpha is coming out white instead of black,  and my touch processing is getting throttled from my render pipeline since switching to CADisplayLink style timer) then back to adding content. I think I'll add some ice magic next, and I want to get some of the more interesting monsters in place - some will turn to stone during the day time, so you will need to hunt them at night. I guess I'll need to make a new todo list and try and prioritise some features. Would be good to get started on the real scripts, but I really want to nail down the feature set as much as possible so I don't have to interrupt writing scripts to do more tech.

Friday, July 2, 2010

iPad iPad iPad

Been hard at work getting the game working on iPad as a universal app. Turned out all my view information was hacked in badly and needed some cleaning up,  but its all good now.  I just have to decide what I'm going to do with the extra resolution.  iPhone4 is easy because its the same screen size, just double the resolution in x and y. However iPad is a different aspect ratio and a much bigger screen.  I think I'll probably just uprez the art and go with 480x360 play area instead of 480x320 - so there's a little bit more vertical map and gui to fill, but otherwise its just generally just going to look much nicer.  Also, I'll use all 32 bit sprites for iPad whereas the iphone version s use dithered 16 bit textures.

Apple just announced that they will stop selling sdk 2.0 apps.   I actually have 4 sdk 2.0 apps on the appstore currently under the Wretched Games label, so looks like I'll be spending the next week or so upgrading them all to 3.1.3 so they can keep selling - they still dribble cash in each week so would be ashame to lose that even though its just a bit of pocket money these days. Might upgrade them all to iPad universal apps while I'm at it...

No video to show off this week, and its unlikely there will be one for next week. I've just taken a week off work but I'll be spending most of my time with the family and working around the house so probably won't help my MageLore progress at all.

p.s. It's damn cold here!