Jump to content
Sign in to follow this  
  • entries
    3
  • comments
    0
  • views
    1469

Programming ...

Sign in to follow this  
LordKaT

356 views

I really have not done much programming today. What I did do, though, made me realize that the direction I had originally intended to take was an unecessarily difficult path.

You see, I've finished programing the item editor. It's really not much, just 85 lines of C code. Overall, it came out to about 200 lines of code that I needed to alter or fix. While I was programing the editor, I came upon the realization that integration with LUA was not going to be easy for the items, skills, NPCs and events. That's because everything I'm using is basically a number. Many of them were unsigned longs, which would become increasingly difficult to maintain.

So, I've narrowed down what is, and isn't a number; for example, things like "value" and "weight" are generic numbers; but, things like item type - which could easily be a regular integer in straight C code - needed to be changed to a string. While this may slow things down - on 486 processors - my real concern is being able to use LUA without having to code another library to translate those rediculous numbers into something a human would interstand.

Basically, they've gone from being described as 3265 to being described as a "weapon." A simple == operator in LUA, and not only does LUA understand what's going on, but the human behind the code knows, too. Which saves me a whole heck of a lot of time.

It also gives me another advantage: easy expansion. In the old system, the types of items/skills/etc ... were just #define's. That works all well and good in CircleMUD, because all of the code is contained in one executable. But, doing something like that with a scripting engine would be deadly, because if I wanted to add a new type, I would have to recompile. So, now, I just create a new type, and in the item script, I just do a simple check for that type.

It's actually kind of astonishing what very little code can expose to you.

So what I got accomplished today:

The item editor is fully functional.
I've expanded my engine to be much more robust.
And, a side note: I hacked together a quick array to unsigned long function (atoul). It works, and that's all I care about right now. ;)
Sign in to follow this  


0 Comments


Recommended Comments

There are no comments to display.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!