Jump to content
  • Advertisement

Servant of the Lord

Member
  • Content Count

    7280
  • Joined

  • Last visited

Community Reputation

33727 Excellent

1 Follower

About Servant of the Lord

  • Rank
    C++ programmer

Personal Information

Social

  • Twitter
    JaminGrey

Recent Profile Visitors

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

  1. Servant of the Lord

    Returning arrays of ""pointers""?

    Thank you, that indeed was the problem. And thanks for writing Angelscript and making it opensource, it's actually enjoyable integrating into my code - especially what with the native function calling!
  2. Servant of the Lord

    Returning arrays of ""pointers""?

    I'm having some trouble returning the array of pointers. Everything seems fine, and the array ends up the correct size (in my test cases, I'm only putting one element in it), but the pointer in the array on the script-side is null, despite me putting a valid pointer into it, on the C++ side. CScriptArray *GetTestCharArray() { static Character character; character.name = "CharName"; asIScriptContext *context = asGetActiveContext(); Assert(context, "Error! Can only call this function from within scripts"); asIScriptEngine *engine = context->GetEngine(); asITypeInfo *typeInfo = engine->GetTypeInfoByDecl("array<Character@>"); CScriptArray *arr = CScriptArray::Create(typeInfo, 1); arr->SetValue(0, &character); return arr; } //Elsewhere, where registering the function: RegisterScriptArray(engine, true); asCheck(engine->RegisterObjectType("Character", sizeof(Character), asOBJ_REF | asOBJ_NOCOUNT)); asCheck(engine->RegisterObjectProperty("Character", "string name", asOFFSET(Character, name))); asCheck(engine->RegisterGlobalFunction("array<Character@> @GetTestCharArray()", asFUNCTION(GetTestCharArray), asCALL_CDECL)); Here's the Angelscript side of things: void Fireball(Enemy &enemy) { array<Character@> @chars = GetTestCharArray(); //Correctly prints a length of '1'. print("Num players: " + formatUInt(chars.length())); //Prints "null" (but it shouldn't be null...) if(chars[0] is null) print("null"); else print("not null"); //Script crashes and reports a "Null pointer access" print("Character " + formatUInt(0) + ": " + chars[0].name); } Is there some obvious mistake I'm making? [Edit:] I simplified the code even further from what I originally posted, but the array elements are still null.
  3. Servant of the Lord

    Goblinson Crusoe Level Editor

    Will your spline groups actually be able to depress the terrain for the rivers? That sounds really neat!
  4. Servant of the Lord

    Returning arrays of ""pointers""?

    Thank you, that link helped alot. I must've missed the 'handle' stuff, distracted by 'references'.
  5. Servant of the Lord

    Returning arrays of ""pointers""?

    I'm new to Angelscript. I have some classes that I don't want scripts to create, but that I want to give scripts access to. I have several different class types like that ("Player","Enemy","Event", - scripts should never create any of these). Would the appropriate registration flags be asOBJ_REF and asOBJ_NOCOUNT, and then simply not registering the constructors/destructors? All of these are guaranteed to out-live the scripts. engine->RegisterObjectType("Event", sizeof(EventStructure_Server), asOBJ_REF | asOBJ_NOCOUNT) I want (C++-side) functions that returns arrays of these references/pointers. Things like, "event.GetPlayersInRange(pos, range)" I see there is a CScriptArray, but I don't understand if this is a *replacement* for an existing built-in array type, or if there is no default array type? In C++, how would I create an array of non-reference-counted references to return? Is this correct: (going off of the addon Array example) // Registered with AngelScript as 'array<Enemy> @CreateArrayOfString()' CScriptArray *GetEnemiesInRange(cPointF pos, float radius) { asIScriptContext *ctx = asGetActiveContext(); Assert(ctx, "Error! Can only call this function from within scripts"); asIScriptEngine* engine = ctx->GetEngine(); // vvv Should this just be "Enemy"? asITypeInfo *typeInfo = engine->GetTypeInfoByDecl("array<Enemy>"); std::vector<Enemy*> enemies = /*...whatever...*/; CScriptArray *arr = CScriptArray::Create(typeInfo, enemies.size()); for( asUINT i = 0; i < arr->GetSize(); i++ ) { arr->SetValue(i, enemies[i]); //Just give the CScriptArray pointers to the Enemy instances? } return arr; }
  6. Servant of the Lord

    Multiple scripts with the same function names?

    I suppose I could just have an AreaA_OnLoad.as script, when I load the script, just wrap it in void AreaA_OnLoad() { <file code> } , like the ExecuteString() utility does.
  7. Servant of the Lord

    Multiple scripts with the same function names?

    I just started using Angelscript, and am misunderstanding how exactly to set up everything. One of my confusions is, suppose I want a script for each area, with maybe an interface like this: void onLoad() { //...unique initialization logic for this area... } void onTick() { //...unique update code for this area... } How do I prevent the AreaA.as script's onLoad() function signature from conflicting with AreaB.as script's onLoad()? How do I call a specific one's function? Would I make each *area* have a separate *module*? That doesn't sound right. Each area would provide *different* logic in each Area's function, so it doesn't seem like it'd make sense to make Area a class, I think.
  8. To add to this, it takes the same amount of time (in general) to render a pre-rendered image as it takes to render any other image that's the same resolution and color depth. An image is an image (mostly - things like compression can also play a big effect on performance), whether it's a pre-rendered scene, a sprite, or a real photograph. Games like Myst (and it's sequel Riven) took advantage of this to make breathtakingly beautiful worlds (for the time) run on such (relative to the present) dramatically weak hardware. The downside is that it's not dynamic. The reasons why earlier pre-rendered artwork was inferior is for a number of reasons. Part of it is, as others mentioned, lower resolution and lower number of colors available. Other reasons include that pre-rendering images isn't easy either! Toy Story 1 had each frame rendered on a server farm of 300 processors, and even then, every frame took between 45 minutes and 30 hours to render, and Pixar basically had to invent most of the technology and algorithms from scratch, and had brilliant computer scientists like Catmul heading it up. Average videogame studios didn't have the technical expertise in that (at the time) cutting-edge field, nor the massive amount of specialized computer hardware necessary to pull it off within their limited budgets. Further, there's also the issue of the massive amount of 3D modelling that must be done to create models (to prerender) with very high polygon counts. The 3D modellers' computers need to be able to render the individual 3D models (without lighting) at least almost in real-time, otherwise modelling gets very frustrating fast, so this also puts a soft cap on the quality of the individual objects that will be pre-rendered. The better option for PS1-era games would be having artists create the 2D backgrounds, perhaps with some basic polygonal scene modelling, rather than trying to 3D model complex scenes. Legend of Dragoon and Chrono Cross looked very good (about the same quality as your RE3: Nemesis screenshot) when exploring the world, though in both those games the actual characters and all in-combat scenes used 3D models that were low-polygon and suffered in comparison to the non-combat backgrounds. Diablo 2 pre-rendered all their character models, that way they could have their character models be higher polygons than they'd otherwise be able to do. To pre-render their models, they had to essentially take (automated) screenshots of their models from every rotation, for every keyframe of animation, and do the same for each piece of equipment, which they would layer on top (called "paper-dolling"), because different equipment in Diablo 2 affected your avatar's appearance.
  9. Servant of the Lord

    Grappling in Open-World PvP

    Nothing prevents a team of very skilled programmers from implementing such a feature, if that's what you're asking. No such pre-built system exists that can just be plugged into a game, and the animation requirements and programming effort would be such that it'd be a very difficult task (and certainly beyond my meager capabilities, so the rest of my post is just me thinking). The "open world" part is irrelevant (the layout of the world doesn't affect the combat), but expanding it to online PvP (rather than just online PvE or even easier, single-player PvE) makes it harder, definitely. I'd imagine such a system would ultimately behave similarly to the Uncharted series of games: basically, a bunch of context-sensitive pre-scripted animations that can play out based on your position relative to the enemy and the enemy's current state (orientation, and combat state - e.g. throwing a punch at you), as well as the immediately-surrounding shape of the environment. If you haven't played the game (I've only played Uncharted 1 and 2 myself), none of that video is a cutscene - it's all gameplay. BUT you lose control for short blips of time during certain moves - i.e. once a more complicated move begins, and the player' and enemy's animations need to be synced together (for example, pulling the enemy off a roof, or grabbing onto them in any way), you lose temporary control until the synced animation plays to completion. Basic attacks like punches and kicks, and so on, don't have you lose control. But for the duration of e.g. grabbing an enemy's head and smacking him with your head, you lose momentary control. With longer moves this is more apparent and noticeable to the player (the reason why I said you "don't lose control" during basic kicks and punches is really because they are so fast you don't notice you lost control - most action games are like this while a quick animation plays out (for example, a sword-swing in 3D zelda games)). In Uncharted specifically, you only have two or three buttons that help decide what type of move to do, and the final move chosen is based on context, not explicit player choice. So it's very interactive, but sacrifices more interactivity than most games do specifically to enable the cinematic movie feel that you seem to also be interested in that requires the animations of more than one entity to sync up together.
  10. Servant of the Lord

    What to do in a pirate game?

    Not pirates, per-se, but have you watched the Russell Crowe movie Master and Commander? Good inspiration there. Shooting albatrosses while standing on a bucking ship deck. Becoming a naturalist and discovering different kinds of new animal species. Trying to scavenge supplies off of islands - need to discover what herbs are edible Oregon Trial-style. Trading at ports - piracy always involves merchantile-ness as well. Gotta unload that cargo somehow, and gotta procure more supplies. Upgrading your ship, getting caught in storms and having to repair your ship while at sea or via resources scavenged from uninhabited islands. Hunting a specific enemy vessel - whether it be a more powerful military vessel or an elusive merchant vessel. e.g. you could be aware that the Spanish Silver Fleet is in a specific ocean, but you'd have to scour the ocean to find it. Maybe you have the barest idea of their sea course, and can try to find them along it somewhere. Can also be flipped - once you have become famous enough of a pirate, powerful government vessels can start hunting *you*, and you better know the sea very well, and all the islands, because the more powerful of their ships outgun you substantially.
  11. Servant of the Lord

    Playing Older Games in Windows 10 - Res Fixes Crashing

    I've encountered a few weird crashes like that. Deus Ex 1 crashes due to multithreading issues, so I had to force it to run on a single processor core. Deus Ex: IW ran too fast, so I had to artificially slow down the processor it ran on (following directions for specific games by googling problems with that particular game online). Many games I've had to try many different 'Compatibility modes', some working, others not. Sometimes the game had to run in Administrator mode to not crash, but gave no indicator of this - only with me accidentally finding out by trial-and-error.
  12. Servant of the Lord

    Unique identifier for functions? (c++)

    The reason why you should use a hash instead of a string comparison, is because in some situations in an IMGUI, you might want to use integer IDs also. For example, with dear-ImGui, (which uses stacks of run-time hashes to support 'scopes' for the IDs), here's some actual code for a list widget: for(size_t i = 0; i < gameStruct.packetLogger.Size(); ++i) { const PacketLogMsg &packet = gameStruct.packetLogger.Get(i); ImGui::PushID(i); //<<<<<< Adds a new ID to the stack. //===================================================== std::string sender = String::Format("%1:%2", {packet.address.address.toString(), IntToString(packet.address.port)}); if(ImGui::SmallButton(sender)) { if(filterAddress == NetworkAddress()) filterAddress = packet.address; else filterAddress = NetworkAddress(); } ImGui::NextColumn(); //===================================================== //...tons more stuff... //======================================================= ImGui::NextColumn(); ImGui::PopID(); //<<<<< Pop the ID stack } Basically, using PushID(i) to give each loop of the for() it's own unique ID scope, so there's no conflict with, say, a Button that appears in the loop multiple times accidentally having clashing IDs.
  13. Servant of the Lord

    How much empty UI space should be around the screen edges?

    Thank you, that helps alot. I'll assume 720p or greater (and certainly test well for 4k and 1080p, which I'd guess most people use) and can just scale down the entire screen for resolutions that likely nobody will use.
  14. Servant of the Lord

    How much empty UI space should be around the screen edges?

    Thanks guys. I'm not hardcoding it per-se. My game supports split-screen coop, which means I'm trying to figure out what my minimum supported resolution would be, and halfing that, and thinking about padding, trying to figure out how much horizontal space I'd have for menus. i.e. if the Minimum I support is 1280x720 (720p widescreen monitors/TVs), then half-that in split-screen is 640. So I was mentally subtracting 20 pixels on each side, and thinking about making the menu panels have 600 pixels of usable space. Doing 5% gives me about 560 pixels wide for split-screen menus worst-case, which is doable, but gets rather cramped. What is the minimum resolution console games must support on modern consoles? What about non-widescreen TVs? Can I *assume* a minimum of 1280 width? Or, I guess I should ask, what assumptions can I make about resolution? That'd help me design the basic design, with the understanding that I'll also need to support different ratios and so on by cropping, scaling, or letting the hardware scale it. I want to avoid only scaling for different resolutions, or text will get all blurry.
  15. When releasing games on consoles, I vaguely recall that console manufacturers have a requirement that important UI elements need to be away from the edges of the screen, because different TV's can accidentally cut off some of the image. A) Is this still true with modern TVs? Do console manufacturers still require it? B) How much space should I give my GUI elements, if I wanted the game to be released on consoles? C) What constitutes 'important' UI elements? If I have a UI window in my game, and a little of the purely decorative frame of the window gets clipped, is that a problem? Right now I have a 20px UI padding around the edges of the screen - is that sufficient? (the game's background fills the screen, just not the UI elements) Thanks in advance!
  • 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!