Jump to content

  • Log In with Google      Sign In   
  • Create Account

TheChubu

Member Since 13 Sep 2012
Offline Last Active Yesterday, 04:33 PM

#5280447 How to programmatically create Tile Maps

Posted by on 09 March 2016 - 06:12 PM

So you dont have a computer, but you're coding in Java... how exactly? In paper?




#5280074 Game Engine design for many-typed many-copied entities

Posted by on 07 March 2016 - 04:40 PM


What I am looking for is some advice on possible implementations of a game engine that is able to handle many (100+) different entity types (e.g. Wrenches, Clothes, Wall segments, Grilles, Chairs, etc. etc.) and also efficiently allocate resources for many instances of that entity (50+).
5000 entities then? Thats nothing. Anything will work fine with that, unless you do something terribly wrong of course.

 

Also if say, a chair is something static, and a wall is static, its not a different entity. They're the same static kind of entity, with different textures. I very much doubt you'll have that many different kind of entities.

 

A game like Skyrim was made with probably less than 100 different kinds of entities (npcs, quests, statics, animated, weapon, armor, spell, and a couple more, thats it). Yours wont have as many as you think.




#5277330 Managing game object IDs

Posted by on 21 February 2016 - 02:54 PM

Hi! I wanted to hear your opinions on how to manage game objects IDs, at runtime and in save files or game data. Have in mind I'm talking about a persistent world, RPG, think of any Elder Scrolls game (Oblivion, Skyrim, etc), also single player, so no additional restrictions for network stuff.

 

Currently my tiny project has only runtime entity ids only for the things currently loaded, which means I create an entity, which has an ID, and use that to fetch its components when I need them. After the program is closed, everything is lost.

 

Eventually I'll have to move this into some form of persistence, I'd need a way to store entity instances and their IDs, for normal base game data, and do the same for storing player's save files.

 

Afaik Elder Scrolls games have a couple of "levels" for this data:

  • First is the main game data. This stores the base game data for all things (NPCs, places, quests, etc). All objects have their own ID.
  • Second the "plugin" data. This stores official addons, mods, and that kind of thing. These also have their own IDs.
  • Third is the player data. These are the game files, I'm assuming it kinda works like the other two, storing the IDs of things the player modified from the base game (say, player killed an NPC, solved a quest, looted a dungeon, etc, that stuff will be stored there,), and also the things the player "spawned". Say that you spawn a demon companion, that NPC is new, or say that you crafted a sword, etc.

 

I'm not quite imagining how to handle such things. For example, if we're going to make a new unique ID for a crafted sword, we need to know all used IDs in the game, even for stuff that isn't loaded so not to step over an existing item. I'm guessing the ID list is either present in memory all the time, managed through an embedded database or memory mapped file maybe.

 

Thats fine because we know the IDs occupied by the base game and the ones the player modified. But what if the user makes a mod that adds a new item? Or if I release an official addon that adds a new town or something?

 

Now I'd need to patch up all the IDs of the addon, and/or patch up the IDs of the player's save game and all their references. Moreover, now the load order of the game data matters. If I load up an addon or another before/after they were before in a previous game run, their IDs will be different (ie, run 1: addon a gets loaded before addon b, so addon a IDs are smaller, run2: addon b gets loaded after addon a, addon b IDs are smaller now), and thats a whole different kind of ID patching D:

 

Any opinions/experiences about this?




#5277318 Game Engine Architecture: what's after that?

Posted by on 21 February 2016 - 01:01 PM


What does it help you build?
By itself nothing really. Its an overview on how game engines are architectured, what kind of subsystems they have, how they communicate, with advice on how to go about designing them and coding them. That is why its "Game Engine Architecture". 

 

And its big, its big because game engines are fucking big. So I'd advice you to read it anyway, so you know what you're getting into.




#5275585 Do game developers still have any reason to support Direct3D 10 cards?

Posted by on 13 February 2016 - 05:29 PM

I'd say D3D9 lasted for a good while because of D3D9/GL2 level hardware on consoles. So will D3D11.x for the same reasons.

 

D3D10 is unfortunate enough that didn't matched any hardware present in the console generation at the time.




#5275006 Simple Open-Source Projects To Contribute To?

Posted by on 09 February 2016 - 10:53 AM

 I'm wondering if you guys are aware of any simple C# projects that I can contribute to. 
Small open source projects tend to be very personal, like one or two dudes team. You'll have a hard time convincing them they need your contributions.

 

You could fork something and expand it instead, but without a use case its useless (developing libraries in the void tends to do that).

 

So I don't think this is a feasible approach.

 

What you could do is develop your own projects, but read about the libraries you use, see their sources, see how they're developed. Maybe then, after you've used them, understood their development and gained experience, you can start to contribute back.

 

And as always, bug reports, those are contributions too.




#5272775 Vulkan is Next-Gen OpenGL

Posted by on 26 January 2016 - 06:57 PM

If they did the same thing this time, my bet would be on Valve taking to initiative to finish Mantle/Vulakn/Valven on their own, and form a new comittee making Khronos redundant. So, failure is not an option for them this time.


Or they could just wait another 10 or 15 years then try again! /s


#5272507 How can I implement a GREAT blur?

Posted by on 24 January 2016 - 02:46 PM

Your offsets are too big. Thats why you get those artifacts.

 

I suggest you read this:

 

https://software.intel.com/en-us/blogs/2014/07/15/an-investigation-of-fast-real-time-gpu-based-image-blur-algorithms




#5271765 View/Projection Matrices for Cascaded Shadow Mapping

Posted by on 18 January 2016 - 06:15 PM


You can see the result in the video. The problem is, that depending on the horizontal angle of the camera a lot of shadow map resolution is wasted, because the shadow map does not "rotate with the camera". How do I achieve that?
I haven't implemented anything close to CSM but I've read (from Crytek's presentations IIRC) that rotating shadowmaps arent actually a good thing. By rotating the shadowmaps you create instability when sampling from frame to frame, which introduces shimmering. They got around that by simply not rotating the shadowmaps, wasted resolution yes but they get stable results.


#5270401 When are Shaders needed ? (wich context vers.)

Posted by on 10 January 2016 - 09:40 AM

Exactly.

 

There are only a few things that you can't do with shaders on "core" contexts. Like clearing the screen as you discovered, or blitting one framebuffer to the other with glBlitFramebuffer. But thats it, if you want to actually draw anything, you have to use shaders.




#5270379 Question about data and resources protection

Posted by on 10 January 2016 - 06:03 AM


Multiplayer games will end up checking these files as well, as it is trivial to modify these resources to gain a competitive advantage.
Very true. I was thinking more on the lines of an MMORPG. Wouldn't want anyone replacing the smoke grenade sprite with an empty one in a game like CS:GO or CoD.

 

I believe once heard of a game where the players would lower the graphics setting to a minimum since cloaks/smoke grenades at low quality settings affected visibility less than at higher quality. That sounds like a hard nut to crack : /




#5270322 Question about data and resources protection

Posted by on 09 January 2016 - 06:15 PM

If its a single player game, that stuff will be local and what Josh/Swift/Sean said applies.

 

If its a multi player game, the important data will be in the server (player progression, stats, characters, etc), so it shouldn't be modifiable by the player, and the unimportant data (models, textures, sounds) will be local resources, for which again, what Josh/Swift/Sean said applies.

 

Being overly paranoid with the game data is annoying from the POV of the users. More often than not some parameter isn't exposed in the options menu, and people have to dig through the games files to fix it and play their game, typical scenario in older games: Game resolution/refresh rate was set higher than what the monitor supported, so people would edit the config files so they could at least launch the game.

 

Easy modification is what allowed modders to fix hundreds, if not thousands of big and small bugs in Elder Scrolls series. And being pragmatic, if your users go out of their way to fix something in your game and make said modification available to your users, thats good for you, someone just gave their time to you in a silver plate for no charge.

 

Let them mod.




#5269710 D3D11 Shadow Mapping with Deferred Rendering

Posted by on 06 January 2016 - 05:52 PM

When exactly is not relevant, it just needs to happen before the light pass.

 

In the light pass, for the lights that can cast shadows, you sample the shadowmap and compute lighting from there (instead of doing the normal pass without shadows). That result gets added to the light accumulation buffer. You add there all lighting results (shadowed or non-shadowed).




#5269538 How to support multiple rendering paths in my engine?

Posted by on 05 January 2016 - 08:34 PM

The way I see it shaders aren't the hard part but the data flow:

 

  • With deferred you just collect all opaque objects, draw them, then collect all lights, then draw them (more or less).
  • With forward shading you have to do everything simultaneously, ie, grab an opaque object, collect data from lights that affect it, then draw.

 

I'm not even sure if its worth it, I'd focus on having one good render path first, since that will take a lot of time anyway...




#5269520 [SOLVED] Uniform buffer actually viable?

Posted by on 05 January 2016 - 06:48 PM

It also does really feel like a "hack", and it really only works with instancing.

.

You think that is a hack? Well, Unity stores instance ID numbers as part of the texture coords so I'd say its an improvement biggrin.png And I remind you you're using textures to store things that aren't textures what is that if not a hack? tongue.png Providing an instance ID its always been a hack because the API doesn't provides a direct way to do it. Only very recently with gl_DrawID and even that isn't widely supported nor has good performance. Its an issue you need to work around given what you have.

 

Anyway, here is Mathias explanation about how you can have IDs for whatever you want to draw, thats implemented in Ogre3D:

 

http://www.gamedev.net/topic/666419-what-are-your-opinions-on-dx12vulkanmantle/?view=findpost&p=5217154

 

TL;DR; Setup a fixed attribute from indices to 0 to MAX_INSTANCES once, and just manipulate it with instanced call instance id. Oh and before you mention "I'd have to draw everything with instanced draw calls!", Mantle doesn't even has non-instanced drawing IIRC, probably Vulkan won't have either, so I'd suggest to get used to it.

.

 so this is technically doable for some shaders where it's clear how much data will be written from the start

.

Not really necessary. You don't need to know that, you just need to know the size of the data your struct instance contains and how much memory glBindRange can handle in your GPU. Like this:

.

// Allocate temp buffer up to max bindable ubo range.
Buffer buffer = alloc(MAX_UBO_RANGE);
// Uploaded task counter.
int tasksUploaded = 0;
while(!buffer.full() && !tasks.empty())
{
  ++tasksUploaded;
  Task t = tasks.next();
  buffer.put(t.mvp);
  buffer.put(t.modelView);
  // Pad to vec4 if necessary here.
}
// Here ring buffer works its magic.
ubo.bindNextRange(TRANSFORM_SLOT, buffer.size());
ubo.update(buffer);
// Draw what you have uploaded so far.
drawTasks(tasks, tasksUploaded);

.

There, something like that, its just an iteration, write all the data to a buffer, then glBufferSubData or glMapBuffer it to your UBO. Then repeat until you have drawn everything.

 

(Here you can find a nice explanation on the internal differences between UBOs and TBOs http://www.yosoygames.com.ar/wp/2015/01/uniform-buffers-vs-texture-buffers-the-2015-edition/ )

 

Again, this reduces state changes and interaction with the driver dramatically. A similar technique is suggested in a GTC NVIDIA presentation, although they do things slightly differently. Look it up, it was called something like "Advanced OpenGL scene rendering", GTC presentation, various PDFs around that had data on how does the indexing into the shader impacts performance vs the amount of time it saves on the CPU side (overall win even on older hardware from what I read).

 

Graham Sellers, of AMD/Mantle/Vulkan/Modern OpenGL fame, also mentioned in an Ogre3D thread to store all meshes in as few buffers as possible, separated only by vertex input format. Here, read all the thread, good stuff in it:

 

http://www.ogre3d.org/forums/viewtopic.php?f=25&t=81060

 

In that way you can also reduce all the buffer/vao binding to a minimum.

.

I don't think I'm able to do that from Java besides hoping that the memcopy function I'm using for unsafe memory access outside the Java heap (= C performance) does that under the hood, which seems unlikely.

.

Now that you mention it maaaybe HotSpot does something like that. Although probably works just for copies between Java arrays. Maybe Spasi an do something about this in LWJGL... 






PARTNERS