Visibility code and garbage collection
Last week I was doing the visibility code, such that the server will send only what it needs to and players won't know about anything else. It seems to work, so I'll find out when I begin to seriously use it. One problem with the code as I did it was that creatures can see each other, but the creatures being seen may very well be able to see the ones that are seeing.
That gives us circular references. Not fun. Reference counting won't work, but I didn't want to use ordinary pointers since that'd complicate everything. So, I switched all of the game's memory management over to garbage collection. I rolled my own since I thought it'd be fun, and what a pain it was. However, now the game's working fine with that, except the client crashes on exit. All that's left to do is to debug and integrate Squirrel's garbage collector with my own. That'll let scripts safely keep references to objects, and objects to script objects, etc. Pathfinding doesn't get along with the new visibility system yet, so that's another bit of work.
However, *after those* (the above issues are minor), here's what we've got, in (roughly) the order I think I'll implement them.
* Sight radii for creatures
It remains to be seen if the visibility system can be made efficient enough that monsters won't have to cheat. While it's clean, speed, well...
Anyway, if I give a creature a sight radius, and attach a client relay to it as a viewer, the client will be able to see everything the creature sees. This is so we can do pets *right* and perhaps play RTS style.
* Serialization within the map for more complex objects
There's no technical reason I can't serialize any object within the map, but I want to keep it limited to those it makes sense for.
Monster spawners come to mind.
* Monster AI
As I mentioned before, creatures already have 'goals', but those are only actions for an AI to use. We still need general behavior.
I'm going to try for 100% scripted.
* Chat channels
While chat is operational, I don't have any default channels decided on. Keep broadcast? Yell? What. I'd like your opinions.
* An understanding of 'maps' on the client
Presently the client has no clue what a map is. This is fine for now, but if we're going to be watching pets on multiple maps at once, the client'll have to know not to show map 2 tiles when we've got a map 1 creature highlighted, even if it knows about the tiles.
* Mouse-based map scrolling (like Starcraft)
Only for RTS mode, but once all of the above are done... For GMs I'll have it attach a viewer to the camera, so that we can watch over anywhere on any map at any time.
* Completely rewritten pathfinding
The pathfinding code is an impenetrable mess. Now that I have proper restrictions in place, it should be easier to write cleanly, and will probably take about an evening. The current code tries to do too much, and does it badly. Along with this I'll introduce stairs, since we need them.
Everyone's named Test right now. :)
Suggestions, comments, etc. are welcome. Pretty soon I'll need to be thinking about stat systems, game mechanics and what have you. That's the part I actually enjoy, so this'll be picking up speed.
Happy Thanksgiving to all of you. I figure it's been a long enough delay that I should write a status update. Progress is slow but I've been working on it when I get free time, mostly on weekends.
The pathfinding works (except for one bug - objects register as obstacles, grr). The scripting language has quite a lot more features now, and can be executed for spells, skills, and weapon attacks. Says work (other than says the chat framework is game-independent, though it's simple at present so that's not very exciting). Goals are new (well, about a month old, but I haven't done updates for a while...). You know how in Starcraft you can tell characters to Move, Patrol, etc., and if you hold Shift down you can queue those up? Well, I put that in. It's accessible to script also, and 'Say' is a goal, so you can for example write:
creature.AddGoal(Goals.Say("Hi! Follow me to some tile!"));
Lately I've been working on serialization (saving/loading from disk). It sounds easy but because I'm trying to make map objects inheritable from each other it actually has a lot of non-obvious issues I'm having to tackle. Of course, given a good 20 hours of free time I could finish it, but I rarely have that much time all at once these days. The nice thing about the setup I'm coding right now is that once it works it'll be able
to store everything, with little to no special casing.
Once serialization is done there'll be remoting code to do. Specifically, code to filter what each client actually knows. For simplicity I have every client knowing everything going on in the game right now, but what needs to happen is clients only knowing about what their characters are able to see (...and a little extra so it's not laggy), which means 'view' objects (which need to be unattached to characters - for example True Seeing in Warcraft 2). Then the default high level AI (in script) and an allegience system to go with it, spawner objects (easy), and finally code cleanup, after which point I'm pretty sure I'll start on a map editor. Somewhere in between these things I'll have to figure out a stat system. After all that is done, it'll be time to begin on content (and perhaps sound, hmm).
Soooo that's the road map from here.
School's finally out. My plan for the summer is as follows:
1) work student job that I got
2) learn to play guitar
3) exercise a lot
4) work on the Faldon rewrite
Hard life. :)
So, about the Faldon rewrite, yesterday I gutted some of the needless complexity and as a result boats, etc. anything that'll hold people and is over 1x1 tile will only support four directions, which makes the code a lot more manageable. I'll spend some of tomorrow finishing up the changes I've made, and then testing. With ten weeks I should be able to make good progress, considering basic scripting and all that jazz are already supported, so in truth the code's been near the barrier to usefulness for a long time now..
As far as the student job goes it involves characterizing the behavior of turbine blades when they're placed in odd situations. I've only been there one day and have a lot of catching up to do, but it'll be a good experience.
On another note I finally got around to looking at how PayPal IPN works. So I've automated the current Faldon order system. Stat resets come in about 15-30 seconds after order, likewise for players. It'll be good since John, having his own business now, doesn't really have time to put them in, and since orders used to go to his e-mail I never was really clear on which he'd done and whatnot. Now that I know how to work with IPN, it should be easy to do again if need be.
The pathfinding code is working
I finally got the first draft of my term paper done for Japanese, giving me free time. I don't have Internet at home at present (that may change -- it's quite inconvenient not to have it, though it does make it easier to concentrate on my studies) so as you've likely noticed I haven't posted much.
Anyway, last Saturday I got pathfinding working, so that's all good now. The pathfinding code properly detects obstacles that pop up along the path and repath if it finds any. The way it determines what is and what isn't a tile is a bit of a hack, so that's the next thing I'll be changing. After that I think there are a couple bugs, and then it'll probably be time to do at least basic game logic. Hopefully over this coming spring break I'll be able to make good progress. The pathfinding wasn't actually that hard per se -- it only took two days to get from broken to working fairly well (I didn't do it entirely properly so I may have to change it later -- because I used floating point and allowed arbitrary orientations for entities -- big mistake as far as sanity, time, and bugs go), but those two days were basically devoted to the pathfinding.
Another thing that the client and server do now (since I last posted anyway, it's not really new) is use Kerberos for authentication. The problem is that the Kerberos server doesn't normally run on Windows (the last version I downloaded anyway, which was admittedly about half a year ago), so I have to run it under Cygwin and even then with some changes. It's got a lot of old code and that wouldn't be a problem except that it doesn't mesh well with our current conception of citizen accounts. If any of you know how to have Kerberos mirror passwords between different subidentities do let me know... The idea of having to have a separate password for logging in as a citizen isn't too appealing in my opinion, so...
As far as game logic goes, it'll probably be basic monster AI, perhaps attacking code, though I'm questioning how much I want to hard code that. After all, what I _could_ do is make attacking for weapons (and receiving attacks for armor) scriptable functions, allowing customized responses on both ends of that. Actually before I do any of that I need to alter pathfinding so that it can stop right before a destination instead of trying to go to it, so that it'll be possible to pathfind to creatures instead of just to tiles...
A couple unrelated bits... Does anyone know how to get a PC-like Home/End behavior on a PowerMac? It's driving me batty how this thing goes to the start of the document instead of the start of the line. Next thing, having taken a year off from college I get the idea that a lot of the stuff people do here they could easily learn on their own. Then again I'm taking sophomore-level Mechanical Engineering classes so perhaps it's to be expected (sigh). All for a piece of paper. Hurrah. Hm, that's about it I guess.
If you're bored
I was thinking to myself, the Faldon rewrite is going to take a long time to do.
Why not do some tiny games for fun in the meantime? It'd relieve the tedium of it all.
I made a little game. Click here to go play it.
Copyright © 2007-2016 James F. Bellinger