Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 13 Sep 2012
Online Last Active Today, 04:58 PM

#5309339 Faster Sin and Cos

Posted by on 03 September 2016 - 05:43 PM

  If that's true, you could probably remove the branch entirely
Or wrap around the "i32I & 1" one bit to the right then use that to flip _fX's sign bit accordingly.


In any case, no branch is faster than branch on my end (using doubles).

#5309303 Faster Sin and Cos

Posted by on 03 September 2016 - 09:09 AM

One question, why put all those muls/adds in that last branch if they (seem) to be the same for both paths? (except for the "- x *" and "x *" parts). Or I am missing something here?

#5308261 defend sacred animals quest

Posted by on 27 August 2016 - 02:07 PM

Suggestions? Well, let the player join the hunters and kill the animals, getting something in return. Or dont join the hunters and let the player kill the animals for themselves (sell the pelts or something). Or let the player kill everything and everyone for no reason. Those should all be properly handled and possible quest outcomes. 


Nothing screams RPG to me more than getting a "Bandits are attacking our village, help us!" quest, then going to the bandits and joining them in the raid.

#5308135 Enums don't have their own variables?

Posted by on 26 August 2016 - 06:45 PM

 It would never occur to me to do something like this in C#

Because you can't. In C#, enums are a thin typesafe shim over integer types. In Java they're full blown objects. Not only can you put fields and methods in enums, but you can also have different overrides in each value of a particular enum. They cant extend classes because they already implicitly extend Enum, but they can implement interfaces.

#5306899 Engine design v0.3, classes and systems. thoughts?

Posted by on 20 August 2016 - 11:19 AM

The input handler. Seems very, very thin for what would you expect (keyboard, mouse, button handling, analog input handling, etc). I have no idea what a "CTimer" is nor why its so important that you need it in the diagram.

What about event handling? If the player runs over a trigger, which system is in charge of calling that event handler? If a player runs over a metal plate how does the audio systems knows how to switch the step sounds?

Im not quite understanding the "Actor" thing. Is it supposed to be heavily WIP? Because I'm missing things like game logic, triggers, scripts, quests/missions, AI, etc.

Not sure in D3D land but at least in GL land I have a single GLSLShader class that can be vertex, geometry or fragment shader. The only difference is a type enum just to know what it is.

I *think* that if you want to do a high level design of an engine, you'll have to start smaller first. Try only with the renderer, since thats the most detailed part of the diagram, I guess thats the part you're most familiar with. Other parts (events, scripting, AI, more complex game logic) it looks like you'll have to discover on your own, and only after you learn more about them you'll be able to design for it.

#5306004 Is The "entity" Of Ecs Really Necessary?

Posted by on 15 August 2016 - 11:58 AM

That just moves the problem into a new place, and gives you 2 headaches (how do I carve my game up into orthogonal systems and components) instead of one (how do I carve my actors up into components).
Its a "headache" that separates the concerns better. It separates component ownership better. It separates component usages better. It separates the system dependencies better. If separating concerns is multiple headaches for you, then put everything in a god class. Only one big headache there.


I already listed the kind of issues you have to think  when stuffing the logic in the components. Moreover I already listed the issues people come here with when they do so. I'm just not seeing your POV here. Could you explain further the "two headaches" you mention?


I don't think we should accept that one particular definition gets to be called "Entity Component System" and other approaches, which also have entities and components, do not.
Then don't complain latter than there isn't a "clear definition" of what an ECS is. Its like handing you a MVC definition, then saying you dont like it because there are other architectures that use models and views, but not controllers. I know, thats why its called MVC, not MV.


I agree on the "Entity System" label though. It is vague, and stupid. Quite hard to come up with an architecture in a game that doesn't uses some form of entity, actor, or similar.

#5305775 render huge amount of objects

Posted by on 14 August 2016 - 12:08 PM

What cozzie said. Not all 66ms of work are born equal. 66ms of work on a GTX 980 isnt the same as 66ms of work on an Intel HD 2000.

#5305561 Interfaces and code duplication

Posted by on 12 August 2016 - 04:52 PM

If you want to buy into the ECS variant of all this (e.g. where your components are just inert data) there's also the classic Artemis library for Java that got popularized around the same time as previous article.


That site went offline a while ago, I dont think whoever picked it up is actually the original Artemis developer. Just look at the other posts in there.


This is what I'd use: https://github.com/junkdog/artemis-odb Its a fork of Artemis, much further developed. Original Artemis had a bunch of bugs and issues, was pretty much abandoned after a while. It spawned tons of forks though. I have my own (in my signature!), but artemis-odb is probably the most developed and widely used right now (and they support Android).

#5305555 Is The "entity" Of Ecs Really Necessary?

Posted by on 12 August 2016 - 04:25 PM

That particular strict form of ECS is basically just relational data modelling, rediscovered, without the rigor or flexibility.
Eh no. Because you have a one to many relationship model between entities and components it doesnt means its relational. Unless you focus on a very tiny aspect, in which case the comparison would be meaningless, an object with a list of things would be "relational modelling" with the same criteria. Specially since relational models are about data, not behavior. As I said, ECS tackles behavior.


For the most part, whether your logic is in a system or in the component is just syntactic sugar and makes no functional difference
Yeah, in the same way as the lack of functional difference you'd have by say, writing your entire game in a single function. Functionally, they're the same. You'll still see pretty pictures on the screen.


Having logic in the components themselves means that components will need to know about other kinds of components, or about all of the other components of the same type. And you end up with these kinds of questions in the forums "What do I put in my components?" "How can I make component X relate to component Y?" "Omg I cant make the component logic isolated from other components! ECS sucks!". What if the same component is used for two different things? You just shoehorn the two different functions in the component and call it a day? It opens a whole can of worms.


The "system" part deals with that issue, providing a platform where you can place these dependencies between components and between entities. Systems know about entities, know about other components, and know about other systems. It is the place where you solve your data passing and communication issues.


Most of the component handling issues I see being asked in this forum stem from forgetting what systems have to do, and making components and entities do more than they're supposed to. So you end up having components having to know about other components, systems managing components and having to share them among other systems, which ends up in fighting hard with which system owns what components, and other kind of issues that shouldn't be really there if you follow ECS strictly. Then you end up with people implementing event systems for all the apparent shortcomings of ECS, and just pumping the data through there.


BTW The T-Machine blog is one of the many that give a dishonest comparison between (bad/incorrect-)OO and their flavor of ECS
 Thats irrelevant. I did not argue with that point. I just said T-Machine blog is a nice source to learn what an ECS is, not what is good for. If it pairs it against bad OO or whatever is irrelevant for that purpose.

#5303360 Ecs Architecture Efficiency

Posted by on 31 July 2016 - 02:19 PM

My guess is that he is asking for the "throughput" of the framework.


ie, how many entities you can add/remove from the world per frame while not dipping below 60 fps. Same with attaching/removing components. The raw overhead of the framework you pay for having it track all of this stuff.


The answers you get are because its not an easy thing to measure in "proper" game engines and games. Its an easy thing to do in our tiny hobby projects that dont uses complex resource management sub systems, nor complex sub system initialization steps. Not so much on bigger games and engines.


I'm going to throw a reasonable guess out there that most of the time on fully featured games (with sound, graphics, ai, etc), entity handling overhead is quite tiny compared to all the other complex stuff the engine has to do (manage disc resources, upload to gpu, insert the new data on the various structures the AI/terrain/sound systems use, etc).


Ideally in an ECS the cost of doing all of these operations (entity insertion/removal, component insertion/removal, entity iteration, per sub system filtering of entities based on their components) should be low enough for you not having to worry about if you're mutating the structure of too many entities, or if you're creating/removing too many entities in a single frame. As the game's inherent complexity goes up, this (probably fixed) overhead becomes much more less relevant.


What is to say: The cost of adding an entity to the world is going to be relatively much bigger in a 2D space invaders game, compared against the same cost in the context of a more complex game, like Battlefield for example. Simply because in Battlefield you might be processing 10Mb worth of data for loading an NPC into the scene, so a couple of hash lookups for making that NPC appear in the world managed by the ECS is not a lot.


In short, its not an appropriate question without having it placed in the context of a specific game.

#5301647 Is It Really That Nonsensically Impossible To Have A Successful First Game Pr...

Posted by on 20 July 2016 - 05:59 PM

 Is It Really That Nonsensically Impossible To Have A Successful First Game Project?


Its not impossible. If thats what you wanted to hear. You can most certainly come up with a contrived scenario in which such thing would be possible, but that would only prove your imagination skills rather than the probability of actual "success".


I dont really know what you're asking here. You know what we mean when we say "your first project will fail". You know that discussing possible/impossible is just semantics. There is nothing to discuss really.

#5301095 Dx11 Renderstate

Posted by on 17 July 2016 - 11:38 AM

Moreover, think that you wont have *that* many crazy combinations of state. The APIs tend to be way, way more flexible than what you really need. Its not about providing everything the API allows you to do, but to restrict it to an useful subset of features.


With all render passes and materials known before hand (and you will know them), you can easily create all the state objects you'll need. After that you can proceed like Mathias suggested, switching them (whole) as necessary.

#5300902 Texture Disappears When I Load Any Type Of Shader (Lighting Shader In This Case)

Posted by on 15 July 2016 - 10:27 AM

Disable the shader program after rendering whatever you want to render with it. Afaik binding a shader program disables all the fixed function pipeline stuff, you're binding it once and never unbinding it. Further draw calls will all be made with that program.


Doing that kinda mix and match of fixed function and programmable pipelines will end up in such issues. You should strive to use either one or the other. Preferably the latter. If you dont want to deal with such hassles, you can always grab a rendering engine that does it for you.

#5300807 Slavery, Include Or Not?

Posted by on 14 July 2016 - 06:16 PM

Eh, a quite popular game, Mount & Blade, which spawned sequels (the more polished M&B Warband, upcoming M&B 2) and spinoffs (M&B Viking Conquest, M&B Napoleonic Wars, etc) has "slavery".


You can just capture people at the end of each battle. Sell them to "slave drivers" in the cities, which gladly tell you exactly what they do with the people (ask for ransom, if no relative pays up, sell them as slaves somewhere). Literally no actual consequence beyond maybe some companions (iirc) kinda disliking it. But thats it. Its a nice source of gold in the early game.


No one ever batted an eye at it.


How fucked up is everything that you have to think about including slavery or not in a game about ships, set in the Caribbean, in the 1600s of all times. Of course there is going to be slavery. Thats half the reason those ships are there in the first place! If you want to pretend it never existed I'd choose a different setup or time period, maybe fictitious happy archipelago where all you trade is fruit and rainbows or something. Throw in some gnomes/elves and stuff so no one doubts its fantasy.

#5299254 Questions about Autotiling []

Posted by on 05 July 2016 - 07:25 PM

First and foremost. That demo is really nice. Like the attack feels like it has impact, the movement is just right. Really like it!


Second, maybe its just me but could you share how you draw your scene? I'm not terribly sure how I'd implement tiling without seeing how you draw stuff.


For instance, if you got a sort of matrix structure of tiles, you could just set the floor last, so do a loop with an "if (empty) { //set as floor }".


The tile itself, the texture, should be seamless, which means if you put one next to the other, it should look continuous. How are the levels defined? For example, if they're on a separate structure, it shouldnt be too hard to make a tiny editor that lets you paint tiles with floor textures, and then just send the tiles to render, which already will look seamless.