Jump to content
  • Advertisement

Chocoboko

Member
  • Content Count

    67
  • Joined

  • Last visited

Community Reputation

124 Neutral

About Chocoboko

  • Rank
    Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi, I am making a 2D console-style RPG in C++ with the SDL library. I am at a point where I want to implement something, yet I am not completely sure how to do it. Thus, I thought I would ask for here some possible suggestions. I want to make a database to store all the enemies. I want to be able to store certain values for each enemy, such as its name, its health points, etc. as well as a little section of scripting language code to determine its AI. I want to be able to call an enemy name and easily be able to retrieves its information from the database. How should I go about doing this? I'm not sure if I'd like hard-coding it. I am thinking of having some kind of external file for the program to read from. I also want it to be under some kind of encryption so the average user cannot easily change the values from a text editor (I do know it's impossible to make the database completely foolproof). One thing I am wondering if there is already some kind of database library (preferrably something lightweight) which can do what I have described and save me the trouble of writing. If you have any other ideas, please let me know too. Thank you.
  2. Hi. I am just wondering how I might parse mathematical expression in a scripting language. My method is to have a compiler to translate my language into "virtual opcodes" For example, consider this expression: variable=2*2+4; That expression would translate to the following virtual opcodes. PUSH 2 // Pushes 2 onto the stack PUSH 2 // Pushes 2 onto the stack MULTIPLY // Multiplies next two items in stack and pushes result PUSH 4 // Pushes 4 onto stack ADD // adds next two items on stack SETVAR variable // sets variable to value on top of stack However, I am having a bit of difficulty. I am wondering how I might implement order of operations in parsing an expression. For example, how might I parse the following expression into virtual opcodes (following the order of operations where multiplication and division are done first) variable=4+2*5+8/2; Thank you for your time.
  3. Chocoboko

    Plotting pixels of a filled ellipse

    I tried it. For the most part, it works. Though, as you said, some sides do not draw. I'll have to try that loop you described. But for the most part, it works. How can I optimize this now? Thank you.
  4. Chocoboko

    Plotting pixels of a filled ellipse

    Geoffrey, I understand what you are doing. Can you now show me the modification needed to make an ellipse? Thank you.
  5. Hi, I am trying to draw a filled ellipse on a 2D screen (using SDL). Would you happen to have any idea on how to develop an algorithm draw a filled ellipse? As in, what would I need to calculate in order to draw the ellipse.
  6. This may sound like a dumb question but please forgive me: I am a self-taught programmer, thus I probably missed a lot of things taught in classes. I am just wondering what the difference is between two methods of initializing class data. For example, consider these two initializers of a class called "CLASS" which will initalize two variables(membera and memberb) to 0: CLASS() { membera=0; memberb=0; } CLASS():membera(0),memberb(0) { } What is the difference between these two syntaxes of initializing a class? Thank you.
  7. Chocoboko

    Quick question about objects

    Thank you. This helps a lot. I think I am gonna rewrite some code in my game to use references. It sounds very useful. Again, thank you.
  8. Chocoboko

    Quick question about objects

    Thank you. That explains a lot. I have another quick question. How does this differ from pointers? Thanks.
  9. Hi, I have a quick question about objects. I know that when dealing with passing whole objects through a parameter of a function, some put a & by it. What is that supposed to do? Let me illustrate more. What's the difference between: int function(OBJECT &object); and int function(OBJECT object); Thank you.
  10. I am writing a singleton class. I was reading the article Enginuity. One thing of interest is a code like this (CLASSNAME represents a CLASSNAME object stored inside a class): class CLASSNAME { static CLASSNAME classname; public: inline static CLASSNAME GetInstance() { return classname; } } I know that returning an entire object is not a good idea because the processor has to copy the entire object when returning it, adding some overhead. However, if you return an entire object through an inlined function, does it generate overhead? Thank you.
  11. Chocoboko

    Dynamic change with any language

    You are probably thinking of Dynamic HTML. Yes, that can change the layout of a page without reloading it. However, you need to know a scripting language such as javascript or VBScript to instate those controls. I knew of a great DHTML tutorial a long time ago, but I don't think it still exists. You can try searching "Dynamic HTML" on Google. Also, you might find some links at www.animetheme.com. Anime Theme is a site powered by DHTML and is where I first discovered it.
  12. I am thinking of rewriting the kernel for my game similar to that in the Enginuity article (here on GameDev under General Programming articles). I am thinking of having a linked list with all the tasks such as getting input and displaying video all inheritted from a base task class. Thus, I will be using virtual functions. But I read that virtual functions have a performance penalty. One thing about my game is that I want it to be able to run on older machines. Thus, I am speculating whether I should use virtual functions in the game loop or not. Thus, I want to ask: How much of performance penalty do you pay by using virtual functions? Is it significant? Thanks.
  • 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!