Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Everything posted by Cerasti

  1. Here's the log from the command line window: C:\Users\Martin\Desktop\Epoch Release 8\Tools>exegen /makeexe guessinggame.epoch guessinggame.exe EXEGEN - Epoch development toolkit [Plenty of stuff saying that the program has been built successfully] C:\Users\Martin\Desktop\Epoch Release 8\Tools>guessinggame C:\Users\Martin\Desktop\Epoch Release 8\Tools> This error is given when running the guessing game: Epoch Subsystem --------------------------- Failed to cast value; possible causes are overflow or malformed data
  2. I've been laying about with the latest Epoch release a little I've found some problems, so here's that feedback you were asking for. The sample programs don't function properly. The guessing game, which I'm quite positive I've managed to get working in release 7, throws an error at runtime about an illegal cast. The scribble project doesn't even build, giving me two inexplicable compile errors, and I had to move the project to the "Tools" folder because Exegen couldn't find the source files in a remote directory. When programs do run they appear to do nothing. A trivial example such as the one below, while building without errors, produces no output when run from the command line. entrypoint : () -> () { debugwritestring("Test") } Am I missing something here?
  3. I've been silently following this, and I'd like to pop in and throw a bucket of support at you. Interesting and inspiring project; I'll definitely have a look at this new release in a jiffy.
  4. I'm trying out the new C++0x features available in Visual Studio 2010 Beta 2, in particular the lambda expressions. I have however come across a curious error: in nested lambda functions, template parameters cease to exist. They do work in non-nested lambdas though. This code illustrates the problem which, to me, appears to be a bug in the compiler. I hope that I'm wrong. template <typename T> void f() { T x; // Works fine [](){ T y; // As does this one [](){ T z; // Not this one }; }; } int main() { f<int>(); } // error C2065: 'T' : undeclared identifier // error C2146: syntax error : missing ';' before identifier 'z' // error C3493: 'z' cannot be implicitly captured because no default capture mode has been specified Odd?
  5. Cerasti

    Crisis of Faith?

    Are you sure you're not talking about me? Perhaps we're identical twins. Either way, I understand you and I hope that whatever decision you make will be the right one.
  6. Cerasti

    Good C++ tuts/engine?

    An 'engine' is a pretty broad term. Engines can range from simple frameworks consisting only of the necessities, to big WYSIWYG-style editors. Engines can be tailored for a specific genre. Engines can be suited for certain types of graphics. Until you're being more specific, I'll throw a link to SFML which I think is a great little library for getting something up and running quickly.
  7. I would recommend looking into HSL/HSV, as I think it would make interpolating between colors (like SiCrane suggested) easier. You can then use a conversion routine to get them in the RGB format (First result on Google.)
  8. Thanks for the warning. It'll be a while before I start fiddling with a user interface, but I'll keep simplicity in mind.
  9. I've never liked that C++ code so often is filled with getters and setters. C# has solved this very elegantly using properties, so this morning I tried to see if it was possible in C++ too. I did a quick search on this and did not find anything like it before, which leads me to believe that my idea must be tremendously flawed [grin] I typed up this implementation here, but beware -- I'm no C++ guru. #include <iostream> #include <boost/bind.hpp> #include <boost/function.hpp> /// /// Imitation of C#'s properties. Holds one value of type T and provides /// standard getters/setters which can be overridden. /// template <typename T> class Property { public: Property(const T& value) : value(value) { setter = boost::bind(&Property::DefaultSetter, this, _1, _2); getter = boost::bind(&Property::DefaultGetter, this, _1); } operator T() { return getter(value); } void operator =(const T& newValue) { setter(value, newValue); } // Function pointers to the getters/setters boost::function<const T& (const T&)> getter; boost::function<void (T&, const T&)> setter; // Standard accessors private: const T& DefaultGetter(const T& value) const { return value; } void DefaultSetter(T& oldValue, const T& newValue) { oldValue = newValue; } // Data private: T value; }; class Point { public: // Create some custom accessors const int& x_getter(const int& value) const { std::cout << "Getter for x called." << std::endl; return value; } void y_setter(int& oldValue, const int& newValue) { throw std::exception("Setter for y unavailable"); } Point() : x(0), y(0) { this->x.getter = boost::bind(&Point::x_getter, this, _1); this->y.setter = boost::bind(&Point::y_setter, this, _1, _2); } public: Property<int> x, y; }; int main(int, char**) { try { Point myPoint; // Try getter for the x value int temp = myPoint.x; // Fail on setter of y value myPoint.y = 9; } catch(std::exception& e) { std::cout << e.what() << std::endl; } system("pause"); } It's not the most efficient of doing it, and it's not complete, but it works as expected. The benefit of this is demonstrated in the main function: variables can be accessed in a traditional manner and still get the getter/setter functionality. So, thoughts?
  10. Cerasti

    RPG Anvil: The Lua Tutorial Part 4

    Quick, to the point and easy to follow. Good job :)
  11. Cerasti

    C#-esque properties in C++?

    I was very aware of the overhead added by boost when I posted this, hence "It's not the most efficient of doing it," but I'm sure this could be implemented using raw function pointers as well. Not that the overhead would be completely gone then either, though. I do see the reasoning here, and I'm probably better off sticking to foo.x(42) instead.
  12. Cerasti

    C#-esque properties in C++?

    Writing x.y() = 42 seems pretty pointless to me, since it's practically the same thing as making y public. I'll admit though, that I've never even considered that you could write x.y(42), and that it is a bit shorter than what I'm used to. These semi-properties would mostly be a way of making things look nicer compared to the long accessor methods names I usually write (x.SetY(42)), which tend to become very ugly very quickly in longer expressions. Phantom, read only variables would be possible (as demonstrated by the code when trying to set y), but I'm not sure what you mean by validation of input; if you specify a custom accessor method you can add any kind of validation you like. I realize though that this is a bit of a hack, and perhaps not that useful after all. Thanks for the input [smile]
  13. Cerasti

    Editor GUI

    My first advice would be to write anything GUI-related using C# (or any .NET language), and enjoy the luxury of Windows Forms. If you don't want to take that route, then I highly recommend using a pre-made GUI library, such as Qt, wxWidgets or MFC. What you decide to choose depends on your requirements; all of these libraries comes with their pros and cons. Licensing, cross-platform support, needing of a "framework" to be installed on the end user's machine, etc. I for one didn't like Qt's GPL/LGPL license, and therefore chose not to use it. The Windows API is not really pleasant to work with, so I wouldn't advise you to use it. If it's a small editor then I guess it could work, though. It all depends on your requirements, as does threading. I doubt that you actually need to use threads for this (they tend to complicate things), but I can't tell because you've given so little information.
  14. Cerasti

    Need ideas for my first game

    You could always try one of the C# workshop's projects (1, 2, 3.) I don't know if they are too easy or hard for you, but they seem to be very detailed.
  15. Cerasti

    C++: Calling DLL

    You're probably looking for LoadLibrary and GetProcAddress. At the top of my head, the most simple usage would be: typedef int (*AwesomeFunction)(int); int WINAPI WinMain(...) { HMODULE awesomeLibrary = LoadLibrary("AwesomeLibrary.dll"); AwesomeFunction function = GetProcAddress(awesomeLibrary, "FunctionName"); int x = function(55); } That code is untested though, but I think it would work.
  16. Cerasti

    Newbie needs some help here. Please help

    XML is a language used to describe and structure data. It looks like this: <Animals> <Animal> <Type>Dog</Type> <Name>Peter</Name> </Animal> <Animal> <Type>Cat</Type> <Name>Helen</Name> </Animal> </Animals> Programs then read this data and extract information from it, and it is widely used. Web pages are described in HTML, which is an XML-based language. You don't need to know it to program games, but like most technologies it's a useful addition to your knowledge base. Mastering C++ is not easy. It will take you years to become good, and when you're good there's still plenty you won't know. It is not easy to give you a certain time figure on when you've learned C++ thoroughly, since it depends on the amount of energy you invest into learning it. I have no books to recommend about graphics or Windows programming, but I still want to stress that it's important that you know the basics before starting with the more advanced stuff. Write some simple console games, gain some experience, then pursue graphics. You're being too hasty.
  17. Cerasti

    Newbie needs some help here. Please help

    Quote:1. Should i study C ? (i skip it. Did i miss anything important in C that i can use for C++). All of C's features are in C++, so if you can program in C++ then you can (give or take a few minor differences) then you can program in C. That is however only theoretically, because the way of structuring code and thinking is completely different in the two languages. I've however found that C projects are generally harder to maintain, and by looking at open source C projects I've also found that they're generally harder to understand. Therefore I'd suggest not learning C, for now. At worst, it will give you habits which might harm your C++ code. Quote:2. Is it impossible for me to study 2D and 3D? If you've only been learning programming for two weeks I think you should wait a bit. Make sure you've really grasped the basics first. Quote:3. if it's possible, what books should i study ( please not hard books, my english is not very good, i read about 5 books about C++ and now i understand the basics, but i'm not satisfied. I want to study graphics to create 2D games). Please help me. I recommend Beginning C++ Through Game Programming, 2nd Ed. by Michael Dawson. The first book was very good so I would expect the second edition to be even better. Quote:Pointers is so hard. I know they are only variables taht hold an address but it can get confusing for a beginner. Pointers are a surprisingly difficult subject to grasp, even if they're so simple. Luckily though, pointers should be used as seldomly as possible, because you should use references instead wherever possible. Read about them from many sources to get a wide picture of them, and give them some time and the whole concept of pointers will finally sink in. Quote:4. Is it worth it to study visual basic and C ? ( i been told by many progs that i should study C++ and Java only. Is it true guys?) It is not true that you should only learn C++ and Java. I would say that it would be easier to grasp C++ if you had a programming background with another language. Python, for instance, is an excellent choice if you want to get the hang of programming: it's simple and doesn't delve into the details too much. A flavor of basic is also a good method of understanding how programming really works. It is always better to know more languages, because then you can always pick the one which fits your situation the best. C++ is not the ultimate super-language, since it has flaws as well as strengths. I suggest that you pick a simpler language and then move on to C++ again, noteworthily Python which I mentioned above.
  18. Whilst skimming through GameDev I found an old link to a certain wiki, which was established some time ago. I'm sure most of you are aware of it, considering that there's even been a sticky topic there for quite a while (but who reads those anyway?). At the time of writing I look at the Recent Changes page, and much to my dismay I find that the last changes were made about two weeks ago. And that was just a minor edit. I realize that I shouldn't be moaning one bit though, because I've contributed myself to letting it become an ever-growing void. Doing nothing at all, that is. Moderately recently, we had a great initiative to (well I'm not psychic but I can guess) stimulate some interest into the page; the book on Direct3D shaders. I'm undecided on whether the wiki format is a good way to represent this book in, but that is irrelevant. The important bit is that this, undoubtedly, created some traffic to the wiki, something which I think a lack of is the main reason why it remains stagnant. It is today practically invisible: there is only a link in the Resources drop-down menu. Bet you didn't even know that. I suspect that the wiki doesn't get the necessary attention because the general quality of the articles are sub-par, which means that neither the GameDev staff nor the members even want it to be seen, which in turn generates less interest. It's a never-ending loop. Personally, I see a lot of benefits in having a collaboratively authored source for game development. There's plenty of material about the subject on the Internet, but there are always flaws among the articles; some are outdated, some are too dense, some are in need of copywriting, etc. All of this could, theoretically, be solved with a wiki. I use Wikipedia on a daily basis, as my loyal all-encompassing database of information. Computer information is however not always the best or the most easily accessible, and I encounter problems in my programming all the time which I imagine could easily be solved using a quick peek at a wiki. The GDWiki does not in its current state qualify by my requirements, as you've probably figured out by now. What I propose is that we start to take this seriously. I'm willing to invest time into making this a valuable resource, but I don't have enough time, knowledge or strength to do it all by myself. As far as I can see, the wiki needs to do the following: Undergo a complete reevaluation of all articles, a gargantuan task. The quality of the articles varies a lot, where some are good and others shouldn't even be there at all. Recieve more advertising from the GameDev site itself. As stated, it's more or less incognito now. I suggest more visibility on the GameDev.net front page, perhaps in the form of featured articles as on Wikipedia. Members of the GameDev forums should also be encouraged to post links to the wiki. Get firm organizational guidelines to enforce a consistent style across the whole site. I see many "tutorial"-pages written for one specific language, some articles written in first person, and some articles which are way too specialized. This includes a reconsideration of the frontpage structure: perhaps a slightly less programming-centric layout and a list of things that need to be done, and a changing of the links to the gpwiki forums perhaps. Integrate visually with the rest of the site. It's alien now, using the standard Wikipedia theme. The regular blue/grey/white as shown to us GameDev members (non-GD+ at least) is pleasant to the eyes and is what gives different parts of the site a sense of unity. Post your thoughts: this needs to be discussed. Do you share my will to awake this sleeping beast? If so, do you have any suggestions as to how this should be done?
  19. Well then, I'm looking forward to GameDev V5. Starting the wiki from scratch does actually sound like a good idea to me, although I doubt that others would agree. On the other hand interst for this topic seems be fairly mild, so why not? Quote:I'd say focus on content, which we should be able to port to another platform if/when we choose one. True, content is obviously what really matters. Would it be a wise idea to start editing the wiki now, considering the upcoming revamp of GameDev? Quote:GameDev has a sense of unity, visually? Shh... Don't make me change my mind! No, in all honesty, I think that it's consistent and clean [smile]
  20. Cerasti

    C++ sort a txt file

    If you have an std::vector containing all of the rows in the file, you can do this: #include <vector> #include <algorithm> // This is where you find std::sort #include <iostream> #include <fstream> #include <stdio.h> int main() { // Open your text file std::ifstream file("file.txt"); std::vector<std::string> rows; // Read all the lines and add them to the rows vector while(!file.eof()) { std::string line; std::getline(file, line); rows.push_back(line); } // Sort the vector std::sort(rows.begin(), rows.end()); // Print out all of the vectors values std::vector<std::string>::iterator iterator = rows.begin(); for(; iterator != rows.end(); ++iterator) std::cout << *iterator << std::endl; getchar(); } Edit: Updated source for more completeness. [Edited by - Heptagonal on April 12, 2009 11:47:27 AM]
  21. "And God said, Let there be underscores: and there were underscores." Seriously though, I think that hyphenated variables would look cluttered. If you want to improve readability, you don't always want to have spaces between the left and right values of the minus sign. I personally don't see what's wrong with the common camel casing: myVariable - otherVariable - somethingElse.
  22. Cerasti

    A Game-A-Week Project

    I know a guy who's doing this, www.agameaweek.com, and I've got to say that he's been pretty productive. In any case, best of luck to you!
  23. Cerasti

    Gray code

    Quote:I'd say it is an impossible task. Of course it isn't. I have a solution, and I'd post it if it wasn't a homework question.
  24. Cerasti

    Gray code

    Don't know if I'm giving the answer away, but I'll try to just give you a hint (according to how I solved it). Return in this form: return a + b;. What a and b are, and what operator to use instead of + is up to you ;)
  25. Cerasti

    'when' keyword

    Edit: jpetrie posted while I was posting. Since you used MessageBox.Show() in your example, I presume you are using C#. So why don't you just put it into the "setter" of the Value property? public int Value { get { ... } set { if(Value > Maximum) MessageBox.Show("Scrollbar is at its limit!"); } } Or am I missing something? Oh, and I also don't like the use of is. It serves no purpose, and when you have a variable with a name in plural form, it becomes odd. [Edited by - Heptagonal on January 20, 2009 11:23:22 AM]
  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!