🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Foundational Stuff

Published February 06, 2011
Advertisement
Another day, another whole bunch of progress. Mostly back-end stuff today, though: better picking, fixing the implementation of selection groups so that I can, say, run a query "Select all objects within radius of mouse click", etc... I'm not doing complex relational queries, here; I just built a class, ObjectTracker, that implements a set of buckets to store objects in, one bucket per cell, so if I know the cell within which the mouse is clicked I can run a query of all the objects in that bucket. Objects register themselves with a particular selection group by adding an ObjectTrackerTag component that listens for position-update messages and moves the selection group entry to the appropriate bucket. By implementing different object trackers (hostile mobs, items, resources, etc) I can simply run queries on each in order of importance (ie, it is more important to select a hostile mob on a mouse click than it is to pick up an item).

Today saw a massive amount of code re-arranging. That's one of the things I love about prototyping in Lua: the very fast turnaround time on experiments. I can think up an idea to solve a particular problem, code up a component or system that might work and try it out, and if I like it then I can formalize the design and clean up, and sometimes I can do all this with the game still running. Then, if it is a speed-critical system, I can re-write it as C++ code in the engine. Picking, of course, is a fantastic candidate for this, so once I get all the wrinkles ironed out I'll probably go ahead and put it in the engine.



I did cave in today on one thing I've been holding out on. Awhile back I jumped on the component/entity system bandwagon, and it's been working great for me. Some folks advocate including some information, such as object position data, in the base object rather than in components. Until today, I did not do this, since not all objects need positional data. Previously, if a component needed to know the object's position, it cached a local copy of it whenever a message was passed to update the object's position. But the picking and selection groups code started to get weird, so I bowed to the pressure and stuck positional info in the base object. Probably better this way; with every component stashing a local copy of the position, it was inevitable that something was going to monkey up the works.

I've also started to formalize the special effects and harvest-able resource systems. I've been going with a generic poof of smoke placeholder for everything, but the system is in place now to add other effects. And the wood stacks that trees drop when harvested are now fully selectable items in their own right, rather than just visual placeholders plunked down on the map. Now, I just need an inventory to put them in...


EDIT: Oh, yeah, I also brought back an old friend:
screen11.jpg

screen12.jpg


He's pretty ferocious-looking, so I'm thinking of making him a critter that you hunt for meat. Like the goblin, he's not complete; still needs a few animations done, but he runs around at least.
Previous Entry Another Demo Build
1 likes 0 comments

Comments

Nobody has left a comment. You can be the first!
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Profile
Author
Advertisement
Advertisement