Monday, December 31, 2007
The Two hundredth commit..
sgeorge@cactus:~/bzr/crpg2$ bzr ci -m "Drawing everyone on the combat map (and in the correct place too)"
Committing to: sftp://mega-tokyo.com/~/bzr/crpg2/trunk/
modified gfx/tileset_combat.pcx
modified scripts/map_castle_lexington.lua
modified scripts/combat.lua
modified src/combat.c
You need a passphrase to unlock the secret key for
user: "Stuart George "
1024-bit DSA key, ID A397CEED, created 2002-12-07
Committed revision 200.
Not bad, signed and committed to my private repo, the 200th commit, I have everyone being drawn on the battle map.
Right now everyone is sharing the same icon, so it looks pretty awful and you cant tell who is who, but they appear, and the map resets focus to whatever player it is set for in that round (the downside is you get a lot of re-drawing with minor differences for subsequent characters and such).
Note to self. Drawing large combat icons and sizing them down to 32x32 or 32x64, 64x32, 64x64 looks horrendous.
Posted by
Stu on 12/31 at 09:02 PM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (1) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Chunking out combat code at a slow pace. I’m mkaing the combat icons/tiles 32x32 in size, since combat is important I figure I’d make things a little bigger on screen. I also had to dig very deep into my archives and I found an “Unlimited Adventures” icon I did for a very old issue of the UANL. I’m using this poor fellow as the basis of my combat icons.
Makes me wish I had saved some of my other FRUA work, not that I think I would have had much that is salvageable.
Hopefully things will start moving along now I have some rough code down to work with.
Not looking forward to trying to draw all the icons I need tho.
Posted by
Stu on 12/31 at 12:34 PM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (0) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Saturday, December 15, 2007
So I added working FOV in caves, 2 lines of code, so that was nice. We now have a FOV ticker, that ticks down, and when it hits zero, reverts to your original FOV size in dungeons.
The addendum to this is that any time you use a lantern or torch, it disappears instantly from your inventory and the ticker is increased by X seconds. Thats right, its based on seconds not moves. Reading between the lines also means, once you turn on your torch, you cant turn it off....
The ‘Birds Eye View’ also wont work in caves. Im debating about this, so this mechanic may change in the future.. I may also make it more roguelike-ish, in that if you use a gem to get a preview of the map, it may only show tiles you have ‘seen’, so not revealing unseen parts of the map. I think that is a good compromise. It will also not be ‘remembered’ when you leave the cave/dungeon.
Posted by
Stu on 12/15 at 01:14 PM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (0) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Friday, December 14, 2007
So started on basic combat last night. This requried an new event type (ok 1 line to the enumeration) for event_Combat so pass back to the lua script that controls that town/map/cavern/dungeon what have you.
This function callback will check what ‘event’ triggered or what NPC combat was issued against to know how to setup the monsters for combat which will then exec the combat script.
Since I am re-using as much code as I can, the combat engine will dump the existing tileset, load in the combat tileset (as loaded via the calling script) and position the PC’s and NPC’s on the map. Combat maps will be 96x96 to fit into my cached segment mapping system, this also allows me to have the entire combat map in memory at once incase some enemies are at opposing corners of the map. The issue here might be with wrapping maps so it may not work out, but thats what we will test
Each ‘group’ of enemies as noted in the calling script will indicate what kind of enemy, the number of them, and the distance from the players (well their initial row/col point).
My combat icons are going to range from 1x1 to 4x4 with 1x2, 2x1 in boxed size…
I also need to add a player icon selection at the start of the game, or just paperdoll all the PC’s as things go…
Already brain farting, Im not going to do a segmented map for combat my current map code is too tied for scrolling maps and such and it will be easier to hack some specific routines just for combat and I can keep it all in the combat module.
I think, outdoor maps can be auto generated but town/dungeon maps wont be, as putting the map walls into combat map walls gives away layout (ok, so its a minor nit pick),
Time for a random screenshot; I need to have the FOV working in dungeons (limited to torch radius etc)… right now its like being ‘outside’ when your underground
(You can see my debug cheat script in action in this screenshot too)
Posted by
Stu on 12/14 at 12:14 PM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (0) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Wednesday, December 12, 2007
(note rss readers like googlereader screw over the css. this post is best viewed directly and not via rss)
Adam asked me about game data and instancing, and my reply more or less became a full post, so here it is instead of buried in the comments.
When a town/dungeon is entered, the controlling script for that object is loaded and a Main() is called.
310:
311:function Main()
312: -- load the tileset and build the tiles for map type
313: SetVar(var_MapWidth, 96)
314: SetVar(var_MapHeight, 96)
315: LoadMap("PORTSMOUTH", "GFX/TILESET_INDOORS.BIN", TOWN_MAP);
316:
317: -- Set players row/col/map
318: SetPlayerPos(82, 48, map_PORTSMOUTH);
319:
320: CreateEvents();
321:
322: -- prefetch the initial map segments
323: LoadMasterMapSegment();
324:end
325:
326:Main()
You can see main does some basic things like setting the size of the map and which tileset to load (if its not the current tileset already).
The real driver in that function is the CreateEvents call. This is what instances all the NPC’s and so-forth.
A cutdown CreateEvents looks like this;
237:
238:function CreateEvents()
239: local i
240:
241: -- create a line of exit events that border the map.
242: for i=1, 96 do
243: CreateEvent( event_WalkOver, i, 10, "EventExit")
244: CreateEvent( event_WalkOver, 83, i, "EventExit")
245: CreateEvent( event_WalkOver, 16, i, "EventExit")
246: end
247:
248: -- segment load callback
249: local xE = {
250: { type = event_SegmentLoad, row = -1, col = -1, f = "SegmentLoad" }
251: }
252:
253: for k,v in pairs(xE) do
254: CreateEvent( v.type, v.row, v.col, v.f )
255: end
256:
257: -- npc callback data
258: local s = {
259: -- gatekeepers
260: {row=75, col=52, name="GUARD", event="talk_npc_GUARD" },
261: {row=75, col=45, name="GUARD", event="talk_npc_GUARD" },
262: {row=72, col=45, name="GUARD", event="talk_npc_GUARD" },
263: {row=72, col=52, name="GUARD", event="talk_npc_GUARD" },
264: }
265:
266: for k,v in pairs(s) do
267: AddNPC(TILE_GUARD, MODE_GUARD, v.name, v.row, v.col)
268: if v.event ~= "" then
269: CreateEvent(event_Transact, v.row, v.col, v.event)
270: end
271: end
272:
273: CreateMerchant(TILE_PRIEST, MODE_MERCHANT, "MYSTIC", 42, 24, event_Transact, 42, 25, "EventTransactMystic")
274: CreateMerchant(TILE_MERCHANT, MODE_MERCHANT, "MERCHANT", 65, 24, event_Transact, 64, 24, "EventMeals")
275: CreateMerchant(TILE_GUARD, MODE_MERCHANT, "PUBLICAN", 23, 45, event_Transact, 24, 45, "EventPub")
276:end
277:
278:
This just registers different event types from (exit events, map segment loads, transactions). Each one is a lua function.. The CreateMerchant function is just a shortcut for AddNPC and CreateEvent with some flags..
The SegmentLoad callback is good for when you walk onto a new piece of map and the engine loads the data, you can use this callback to override the map. Say You have exploded the alchemist lab which blew a hole in the wall. This even can check the flag flag_BlewUpAlchemistLab and do some SetTile(row,col, tile) commands to turn some wall into some grass tiles or something. (Mostly I use it for adding those retro ultima style ‘words’ to the towns/shops.), but it does give me a programatical control of the map data.
ExitEvents are pretty basic, they are not a true event, but just a function used in conjunction with say a WalkOver event or EnterEvent
178:
179:function EventExit()
180: if AskQuestion("DO YOU WANT TO LEAVE TOWN", " YES ", " NO ") == " YES " then
181: PopMapStack()
182: SpawnMap(GetVar(var_PlayerMap))
183: else
184: -- pushback
185: if GetVar(var_PlayerFacing) == FACING_NORTH then
186: SetVar(var_PlayerRow, GetVar(var_PlayerRow) + 1)
187: elseif GetVar(var_PlayerFacing) == FACING_SOUTH then
188: SetVar(var_PlayerRow, GetVar(var_PlayerRow) - 1)
189: elseif GetVar(var_PlayerFacing) == FACING_EAST then
190: SetVar(var_PlayerCol, GetVar(var_PlayerCol) -1)
191: else
192: SetVar(var_PlayerCol, GetVar(var_PlayerCol) + 1)
193: end
194: end
195:end
196:
197:
I figure its nice to ask the player if they wish to leave the map, but its not a requirement, and because we know its a WalkOver event, we trigger a push back off the current cell back the way the player came. (One of lua’s nice features is its global string table, it only ever instances a string once, so I can duplicate my strings all over in a script and know that only 1 copy exists, not that I have a lot of duplicate text in my scripts).
Transaction events I’ve covered in script in other entries.
Back to Adams comment on respawning, You could respawn everyone in town (easy, no work required), or track whom you have and have not killed. I dont think I want to track a bitflag for every guard, wandering NPC or jester in every town
When you leave a map, all data for that map is purged from memory, including all NPC data. There is only some small global variables + flags that persist for the length of the game (basically the save file data).
Posted by
Stu on 12/12 at 09:28 PM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (1) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Tuesday, December 11, 2007
Items have now three vs attributes.
vs Generic Type
vs Specific Type
vs Chance
vs Master Type is for such things as to refer to all “Humanoids” for all Orcs, Kobolds, Gnolls, People, etc.
vs Sub Type is for things like “Orc” but not “Kobold”
vs Chance is just chance, so a stoneblade has a 10% chance of stoning, or heart seeker has 10% critical hit, etc
I was originally going to have different skills for different weapons, eg: sword/blades skill, hammer skill, axe skill, bow skill. The problem is that swords are an easy to have since there are so many kinds, but how many kinds of axe are there? Not very many. This leaves me back where I originally stated with the skill tree in having only short range / melee weapons or long range / ballistic weapons.
I’m debating cursed items. They are a real pain in the neck and if your a fighter without some way of doing a remove curse you can get royally screwed. I find them to be more of a nuisance than a good gameplay mechanic.
Im going to test my combat system by instigating an attack against king in Castle Lexington
There is no super “Lord British” ego in this game, so yes, it will be possible to go in and wipe out various player characters. The question then becomes, can the game remain winnable if ALL characters in all towns were killed off? No. So what do we do.. a conundrum. Do we reset the town every time you enter? I can see resetting the guards, but what of important one off characters…
The flipside is we can make the game end if you kill them. Kind of… pointless? We could remove the attack option when in a town… but that is boring and an easy way out! The question then becomes, if the player makes the game unwinnable, how do we inform them of that and where do we draw the line.
Posted by
Stu on 12/11 at 08:36 AM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (1) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Tuesday, December 04, 2007
So I started on some magic code, data actually, writing a couple of spell descriptions in a lua table, which also lead to some minimal monster loading code that tied into the item code! Oh the tangled web.
Lets backup for a second to extrapolate the intertwining of the three.
We have a monster the FROST GIANT, his description looks something like this;
type = mn_Giant,
name = "FROST GIANT",
tile = 4,
magic_regen = missle_Ice,
tile_size=tile_Tall
His Type and his MagicRegen tie into both items and magic respectively.
For items, there is the feared “GIANT KILLA” two handed sword +2 vs giants (fake item) that looks like this;
type = itm_Sword
hands = 2
vs = {{ vs_mon_type=mn_Giant, vs_amount = 2}}
(Note the vs is a table inside of a table so you can have multiple vs’ entries. So a PC wielding a GIANT KILLA sword hits a monster of type mn_Giant, a bonus is applied of +2.
This is a nice way of making some basic customized items like a mace vs undead or the flaming ice pick (that affects only things afraid of Fire).
Then there is the magic portion, since its a Frost giant, cold spells can heal, so the Ice Bolt spell;
name = "ICE BOLT",
mpcost = 15,
func = "CAST_SP_LIGHTENING_BOLT",
range=12,
damage={15,25},
mtype = missle_Ice
Its functionally equivalent to a lightening bolt, only with ice, so any would be damage of missle_Ice used on monsters whose magic_regen = missle_Ice has the inverse effect, its heals as opposed to harms.
I just need to brainstorm my basic monsters and their high level attributes where attributes are like
* elemental (fire/ice/etc)
* Stoning (against reflect/sliver, can stone)
* Heals over time (trolls)
* Undead (can be turned)
* Size (Tall, short)
I also need to do the same to the spells
* Range (touch, party, reduced damage over range)
* Combat only spells / Party Only spells
* Caster Affected only
* Targets area or monster (target area size)
and so on.
I’ve already detailed some combat thoughts earlier on in the blog (HERE), on movement points and the like, so now onto some more details.
Every one (PC and NPC) in combat will have two levels of alliance, tho I may scale it back to one level.
Level one would be group
Level two would be faction.
Think about a three way brawl. You kick the door open and a small band of Malcontent fighters is duking it out with a small band of NonConformist fighters.
Right now it would be;
Party = Group 1
Malcontents = Group 2
NonConformists = Group 3
But earlier in the game, you saved the king of the Malcontents, which shifts the alliances to;
Party = Alliance 1
Malcontents = Alliance 1 (un aligned Alliance 2)
NonConformists = Alliance 3
(You have a current alliance and a base alliance).
The Malcontents would know not to attack the Party because they are allies. However, should a party member attack a Malcontent, the alliances would shift to
Party = Alliance 1
Malcontents = Alliance 2
NonConformist = Alliance 3
It now becomes down to Group 2 members attacking the nearest Group 1 or Group 3 members. (The current alliance was replaced by the base alliance. The base alliance never gets changed, only the current alliance level).
It may come down to every enemy having its own group/alliance and being a free for all in combat.
This also works for things like charm spells, where you can magically switch an opponents party alliance to you for a period of time, their group indicator would then then switch to being grouped with the party (again, you have a current group and a base group).
I think this is complex enough without being too complex, ie: you could add a weighting to the alliance level so with more than two alliances on the field of combat, to be used by the combatant to prioritize which enemy they attack instead of just the closest enemy to them.
It might turn out that its not really feasible to have a two level grouping like this and revert back to just using a Group mode, or remove it all together and have a Party vs Everyone Else mode.
Posted by
Stu on 12/04 at 12:24 PM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (0) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Monday, December 03, 2007
Wrote a lua script last night that does party re-ordering. Needs one or two cosmetic cleanups but it works. Did require a minor C support function but I can live with that.
Fixed a world map scrolling bug (that I thought went away right at the beginning of development). The solution is inelegant and somewhat brute force so I need to revisit it.
Next immediate things to work on;
* “Useing” (Equipping/Unequipping/Use) item function.
* Spell loading
* Cast spells
Posted by
Stu on 12/03 at 08:42 AM
Permalink to this post.
Filed Under :
Computers •
Development •
Fishguts •
Commented on by (0) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
We’ve started Alexander on a food regime. We bought a huge butternut squash which I baked and pureed up and froze in icecube trays, we also pureed and froze peas. He seems to like eating the squash more than the peas but he likes to try and wear as much of it as we can get into him. The increase in food and going to real food (he still gets all his formula) has seen an increase in dirty diapers and the smell has gone up a notch :(
We’ve also instituted a sleeping through the night routine, aka we ignore his cries and he eventually goes back to sleep and sleeps through the night. We’ve had some good nights and some bad nights but it seems to be working well, and we think we are over the hump of his 3am feedings. He just manages to pee out his diaper now because he goes for 9 or so hours sleep without a change.
He is also very very close to becoming mobile, I predict we’ll be crawling in under two weeks. That means we need to be more vigilant in vacuuming the house and watching gwyn more closely when he starts to make a beeline to his 100lb puppy dog.
Posted by
Stu on 12/03 at 08:32 AM
Permalink to this post.
Filed Under :
Life •
Baby •
Commented on by (0) people. Read or Post
Comments Here
Linked To by (0) blogs. Get a
Trackbacks link here
Page 1 of 1 pages