Monday, December 26, 2011

12.26.2011 Day after Christmas

summation: graphics problems fixed. New graphics problem found.  Sound and astar pathfinding probably need optimization. Some optomization acheived.

I separated the movement code from the drawing code.  Now any object that has "needs los to be seen" is on a list and gets drawn if it's on the screen.  Now, at least, an unmoving monster will not be invisible - it gets it's LOS checked and if it's true, it gets drawn, wheras before, only moving monsters got their graphics updated.  I could probably check for a "just moved" variable to optimize things, and only update the graphics of those who move, but then I'm back to having the same problem.

The game is getting slow.  I've worked on all different code over the last few weeks as it's slowed down - mostly with the addition of the sound code.  I'll have to expirament and see what's eating up the processor eventually. I usually work on all different code projects and then do a whole bunch of optimization all at once.  If it turns out to be the sound code that's slowing things down I think an "auditory memory" for denizens so sounds dont have to be generated so often.  That will probaly take making sounds more complex also, they'll probably each need an identifier like "ob.id.."_"..type_sound_name) so that walking sounds overwrite walking sounds... that's one idea instead of an auditory memory.  Then sound data would be self-updating.  I would just need a "cleaner" function to delete aged, un-updated sounds from the soundscape.

But at least ghouls who are unmoving are now seen.

Still working on the undrawn squares in the forests where the deer were "just" standing on player screen-transition, but it draws correctly when he steps out of the ditch....  All I can think is that the tree gets drawn, and it's upper level over the deer's location is not drawn...

---Later that day:

--Fixed-- Unmoving ghouls now seen.
--Fixed-- No more vision trails! (they had reappeared due to yet a different bug in new programming. ugh.)
--Fixed--Undrawn squares in forest where deer were standing on refreshscreen is fixed!  Not sure what I did but I was fixing graphics in general and must have corrected the problem.

my Wife is knitting.  Not sure why.

Todo: Either sound generation or a-star pathfinding is eating up my processor.  Will have to optimize one or the other or both.

Later on:

So I found another graphics problem that I cant seem to solve.  Whenever my creatures move off of the screen to the north, they leave a graphics trail.  If they move off of the same square to another square on the screen, I'm pretty sure they redraw their old square.  I occasionally check for things "off the edge of the screen" but I couldnt seem to find any errors in that.  When they move off the screen to the south, they dont leave a graphics trail.  ugh.

Sunday, December 25, 2011

12.25.2011 Christmas Day

Christmas was awesome, got plenty of charcoal now for drawing.

I chatted over STEAM to my brother Luke for a long time today about AI coding, emergent behavior, lua debugging, and got some great ideas.  I also came acros two articles that will affect my future AI coding.  I am going to implement "heading awareness" to the movement of my deer somehow, to better simulate herding, and rewrite the movement code.. AGAIN.. LOL!  Probably theres a clever way to do it.  And there's probably a simple way to get those wolves to encircle prey, according to the second article:

Here are the two articles:  One is on flocking artificial birds
http://www.red3d.com/cwr/boids/

The other is on the logical rules of wolf hunting that create emergent circling of the prey:
http://www.sciencedirect.com/science/article/pii/S0376635711001884
and
http://intrinsicalgorithm.com/IAonAI/2011/10/what-real-wolves-can-teach-us-about-our-ai/
and
http://www.newscientist.com/article/mg21228354.700-wolf-packs-dont-need-to-cooperate-to-make-a-kill.html

Saturday, December 24, 2011

12-24-2011 Dev Log: Christmas Eve

\
11:45 AM - 12:00 AM coded and wrote Dev log:
Merry Christmas! Not sure how much programming I'll get done today. Time away from the code is just as good as sitting there fuddling with the code searching for errors.

On that note, I thought about the graphics problem and slept and fixed it in under one minute this morning.  Run it for afew minutes... Looks like the deer are NOT leaving graphics trails when trees block line of sight!  (epic winning). it was a problem with what variables I was passing to my line of sight.. It didn't likechecking line of sight deer-->player, it was returning false and not updating the graphic square, but when I checked line of sight player-->deer it refreshed the graphics just fine.

--New Bug: When the character moves to the edge of the screen and the new screen contains forests and deer, the spot the deer were the turn before you see them on the fresh screen is not drawn for some reason...  But it does get drawn and everything works fine if you emerge from a ditch into a forest, which refreshes the screen, no such "empty squares" appear.  Probably I need to take a break from coding and just mull it over.  At least I fixed the problems with the graphics trails while you and the deer were moving around in the forest.
 Funny thing is both stepping out of a ditch and walking to a new screen both use funcs.initmap to refresh the map, so I can only think that something funny must be happening with my single-spot-graphics-refresher when either the deer are far away or its a new screen... neither of which should be a variable.  Ugh.\

I got the Ascii Wilderness homepage up and running instead of using a blog entry for that.

I also wrote an article on getting your dungeon denizens to herd properly on Roguebasin.  The article is here:
http://roguebasin.roguelikedevelopment.org/index.php/Denizen_Herding_Behavior

Friday, December 23, 2011

12.23.2011 Dev Log

--Fixed: Known Graphics Problems


I've been working on the graphics all day, I finally fixed the appearance of the forests when the player or deer were moving through them (they are sort of funky isometric trees and werent refreshing properly)

I uncovered a graphics bug that basically updates squares that are outside the players LOS and causes some other problems. It's sort of the result of trying to optimize things by not checking LOS all the time. A solution is not apparent. I suppose I could somehow have a "last-turn-los-check" that would tell me if a monster was LOSed last turn, and if it was, I could update it's trail "this" turn. That way, if it was off the screen last turn and had no "los check" for that turn, the trail would not be updated and so no "ghost mapped" squares outside your LOS will appear. (brain pains). Now that I see a solution, I think I'll sleep on it to best effect.

There's also a problem with the ghoul disappearing when I walk over him before he's been activated... will have to track down that bug.

but at least the damn forests look right.

--evening update:

After correcting some graphic problems, I created a problem. So I corrected that, which created another problem. I've narrowed it down to something having to do with the Line of sight code I think.. The deer graphics dont get updated when they leave certain squares in a forest where some trees block LOS. Maybe I will expirament with some LOS blocking walls to see if I can narrow down the problem.

--Later Night update: 8:58 PM

I SQUASHED THE BUGS. It turned out that my logic for graphically updating the square they had been standing on was pretty faulty. Took a break to write the dev log and for bodily functions and the solution came to me.

Tomorrow I'll create somemore bugs and squash those.

Current Stability: Good.




Update 9:39 PM: Wondering how much time I won't get to spend programming this game on christmas eve tomorrow. Ummm obsessed a little?


Update Late night: The one graphics bug is back. all well. work on it tomorrow.

12.22.2011 First Dev Log Entry

Hi all.  I started this project eight years ago in LUA 5.0 and it has grown since then.

I'm not sure what I'll work on from day to day on the project, but it generally consists of overhauls at this point but a lot of the code is very good.  I might have another release by new years with afew things fixed..

I got the homepage up and running where you can find the current release and readme file:
http://asciiwilderness.blogspot.com/p/ascii-wilderness.html

And I added entries for Ascii Wilderness in the Roguebasin website so a lot of people have found it (like 100+ since last night when I put it up) so that's real cool.

--Worked hard yesterday getting deer and ghouls to herd depending on some internal variables.  Fixed graphics considerably, afew minor glitches to fix still.  Was glad to see ghouls waking up when they heard deer, chasing the deer, but waiting up for other ghouls before getting close to the destination.
--Glitch to work on:(isometric trees need to redraw their tops when a deer moves from on top of their upper section to a different square.)
--Glitch to work on: Enable bullseye blockage in line of sight, and then test out light sources - I want to make sure a bullseye lantern doesnt block light from nearby sources... its possible it doesnt and all I need to do to get them working is enable the strange code I wrote into the line of sight stuff for the bullseye lantern.

Thanks for taking an interest!

About me:
I'm 28, married, and I go to college part time and work part time. I am an amateur LUA programmer with a love of... Well, it all started when I played the game Rogue at age 12, then later angband, nethack, ADOM, Hengband, and the many variants. Something clicked, and I was in love. Eight years later I took up LUA programming and realized my dream was within my reach. True love never fades, so here I am eight years after that, plugging away at Ascii Wilderness. I've learned a ton about programming from trial and error, and feel much more confident to tackle future problems with the code, especially if I had some help from the Lua roguelike community. Thanks for taking an interest!