Jump to content
  • Advertisement

Zakwayda

Member
  • Content Count

    12589
  • Joined

  • Last visited

Community Reputation

2184 Excellent

2 Followers

About Zakwayda

  • Rank
    GDNet+

Personal Information

  • Interests
    Programming

Recent Profile Visitors

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

  1. Zakwayda

    which should i select first

    I agree with 1024 that more info might be useful (for example what platforms you want to target). But, I'll go ahead and say that of the options you listed, I think option 2 (JS) may have the lowest barrier to entry. That's subjective of course, and others may disagree. But, I do think in-browser development using JS can be a reasonable starting point, and you can always branch out to other libraries/platforms/languages as you progress.
  2. I know very little about Ogre, but typically you'd use vertex colors for this, with vertex positions (and other attributes if necessary) duplicated as needed to facilitate differently colored edges. If Ogre is anything like other rendering engines, I'd assume you can create custom meshes with arbitrary data and vertex formats. You said you're feeding the renderer vertex and index buffers, so presumably there's a way to incorporate color attributes as well.
  3. This is what I was talking about earlier when I recommended considering algorithmic solutions. As I alluded to in my initial reply, when something can reasonably be represented using data rather than code, representing it as data can have some advantages (especially in languages like C++ that can have a relatively slow build process). However, if you find yourself needing to generate an impractical amount of data, that may be a sign that some of what you're wanting to express as explicit data could better be expressed algorithmically and/or via relationships or formulas.
  4. I'm not sure it's true that these things are drastically easier in Java. It might even be easier in JS in some ways. However, the approaches taken by the two languages are (arguably) drastically different, which could certainly be an obstacle when coming from Java. JS uses an object-and-prototype based system, which in turn can be used to effect something like the 'classes' you're used to in Java (newer versions of JS include some syntactic sugar for this). It can take some getting used to though. I'll add a couple comments in addition to what markypooch said. First I'll mention that recent versions of JS include a number of new features, such as let and const as additions to (and arguably in most cases replacements for) var. If you're interested in best practices with respect to JS, you might look into references on ES6. (There are different terms for the different versions of JS, but the term 'ES6' should yield plenty of search results.) Following on what markypooch said, you'll definitely want to embrace objects and (pseudo)classes if you're going to use JS. Once you get comfortable with what he described, you'll probably want to look into prototypes as an alternate (and sometimes preferred) way of sharing functionality between objects (this is where things start to look a little more like 'classes' from other languages). The newest versions of JS include some syntactic sugar that makes creating 'classes' at least as straightforward as it is in Java (in my view at least). Once some of these pieces are in place, I think it'll start to become more obvious how to solve problems like the one you're asking about. Lastly, one side note: you don't need the calls to parseInt() in your code, as the array elements are already numbers.
  5. Zakwayda

    Yet another graphic engine

    What platforms are supported? (I looked at the link, but didn't see it mentioned there.) Edit: Maybe your mention of COM answers that question, but it might still be of interest to know specifically what platforms you plan to support.
  6. I don't know enough about the sport to be of specific help here I think all I can offer is a couple general comments. If a lot of your data elements are in fixed relationships with each other (e.g. a linear relationships between 'yards to go' and 'probability of completion'), then you might consider handling those relationships algorithmically rather than as raw data. The algorithms/relationships themselves could also be data, or could be implemented in code if that seemed more practical. Separate records for each combination of teams, down, and 'yards to go' does seem a bit suspicious and like a lot of data to generate manually, so I'm wondering if some sort of algorithmic approach based on coarser data might be preferable. Also, repeated records with the same pairs of teams does seem to suggest that maybe some other data representation might be more appropriate. Keep in mind that you don't have to use CSV or any other particular format. You could, for example, create a bespoke format that organizes the data exactly how you want it (for example in some sort of hierarchical format).
  7. I know I already said this, but I just want to reiterate that you don't have to handle vertical lines as a special case. Looking over your function I can see that doing so adds a lot of code, which of course means additional opportunity for bugs or errant behavior. My own feeling is that especially with respect to functionality like intersection testing, the less code the better due to how easy it is to get details wrong. Of course you may have what you need at this point and not want to change anything, but I just thought I'd mention it again (even if only for future readers of the thread who might be looking for information on this topic). Looks good by the way
  8. There are many ways you could do it, but if you want to keep it simple, reading a CSV file might be a good starting point. C++ is fairly low-level and doesn't include direct support for such things. There are third-party libraries for dealing with formats like CSV, XML, JSON, etc., but it should be fairly manageable to implement something like this from scratch if you prefer. The steps might be: - Figure out how to read a text file into a std::string instance. - Figure out how to split a string given a character separator so you can break the file up into lines and tokens. (Depending on the contents of the file there may be other issues to deal with here, such as string trimming or quoted strings.) - Figure out how to convert strings to numbers. You would read the file, parse it, and build some suitable representation from the results (e.g. an array or map of class/struct instances, where each instance represents all or part of a row of the database). You can find plenty of info on these topics online, and can of course ask here if you get stuck on anything. Again, this is just one approach you could take.
  9. You don't need a special case for vertical lines, I don't believe. Unless I've got my math wrong, the equation Alberth provided can be manipulated further to eliminate the secondary divisions, leaving you with the equations for t and u given in the Wikipedia article here: https://en.wikipedia.org/wiki/Line-line_intersection Those equations are expressed in terms of four points rather than two point-vector pairs, but it's equivalent.
  10. In the last code excerpt you posted, 'mouse_x' and 'mouse_y' aren't used, and it's not clear what 'x' and 'y' are, so I'd look at that first. (If 'x' and 'y' exist in some enclosing scope, perhaps you could clarify that.)
  11. Unless 'map' is nil, the error is likely because 'mouse_x' is an invalid index. The loop I'm talking about is this: for y=1, #map do for x=1, #map[y] do ... end end You may already know this, but this is a 'nested' loop because it's one loop inside another loop. This particular loop loops over every coordinate (x, y) in 'map'. The reason I mention it is that the loop doesn't accomplish anything. 'x' and 'y' are never used outside the loop statements themselves. All you're doing is executing this bit of code: if (map[mouse_x][mouse_y] == 0.1) then audio_a6:play() end Repeatedly for no apparent reason. I suspect this is just due to a conceptual error. One thing that might help is to ask yourself why you think the loops are necessary.
  12. This particular question seems like a good place to start: I would say that functions aren't the optimal tool for this task, conceptually speaking. Typically something like a set of plays would be conceptualized as data rather than being hard-coded behaviors (e.g. in separate functions). I think this preference for data can also be applied in general (not just to handling plays). What that means exactly depends on the context, and I don't know enough about the context to be more specific. But maybe just the conceptual shift from functions to data will be enough to get you moving in the right direction.
  13. There may be multiple issues here, but I'll just mention a couple things for now. First, perhaps you could tell us specifically which statement is generating the error. Second, you seem to be iterating over the coordinates of the map (x and y), but not doing anything with those coordinates, which raises the question of what the nested loop is for.
  14. Zakwayda

    Adapting exiting desktop game to Android

    If you're using a lot of third-party C/C++ libraries (especially complex ones), there may be some challenges there. I can't really comment directly on that, as the C/C++ libraries I've used on Android haven't been difficult to configure and build. My experience is that resources and documentation on this are a little scarce, presumably because there's not much call for fully native Android apps. As I think I mentioned earlier, even the major cross-platform libraries I've looked at use a Java wrapper rather than taking the fully native approach. That said, there's a book called "Android NDK Beginner's Guide" that walks you through creating a fully native Android application using OpenGL ES. Personally I had some issues with the book, but it does include a complete working example. Maybe others can recommend other resources though. I pursued fully native for a while, but encountered enough things that seemed excessively difficult or like they'd require a lot of research that ultimately I decided a mixed-language approach was more practical. That's just my experience though.
  15. Zakwayda

    Adapting exiting desktop game to Android

    Although all this may be true (I'm not sure - I can't quite follow it all), for the sake of the OP I'll mention that basic asset loading on Android and iOS shouldn't necessarily require jumping through a lot of hoops (I don't think). For both Android and iOS, assets are generally included in the app package in various ways, and accessing them is fairly straightforward (although I've heard of assets sometimes being distributed separately on Android due to size). Perhaps _WeirdCat_ is talking about something else here (like writing saved game files), but I thought it might be worth clarifying that loading game assets shouldn't necessarily be difficult. I don't think the x axis is negated in SDL (correct me if I'm wrong). As for the y axis being negated, that depends on what you're comparing it to. Maybe I'm not interpreting you correctly though. Not saying you're wrong, but I haven't heard of or encountered what you describe. Pure C++ apps have bytecode running behind them (as I understand it), but as a developer you can write apps entirely in C++ with no Java. If you think this is wrong though, maybe you could clarify, as I'd certainly like to learn if I'm wrong about this. (Maybe we're using different definitions of 'entirely in C++'.) Not sure if you're saying to use Java or not use Java here, but as I mentioned earlier, I think there may be some things that are more difficult to do in native code than in Java. If that's the case, there may be advantages to a mixed-language approach. But, ultimately it may just be a matter of personal preference. Anyway, even though the OP isn't planning on pursuing this currently, I thought I'd offer some comments for the purpose of clarity. (And apologies _WeirdCat_ if I'm misinterpreting parts of your post.)
  • 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!