Welcome, Guest. Please login or register.

Login with username, password and session length

 
Advanced search

1411562 Posts in 69384 Topics- by 58443 Members - Latest Member: junkmail

May 03, 2024, 10:43:12 PM

Need hosting? Check out Digital Ocean
(more details in this thread)
TIGSource ForumsDeveloperTechnical (Moderator: ThemsAllTook)General thread for quick questions
Pages: 1 ... 23 24 [25] 26 27 ... 69
Print
Author Topic: General thread for quick questions  (Read 135721 times)
Polly
Level 6
*



View Profile
« Reply #480 on: January 24, 2016, 06:10:47 PM »

Sure, but since it's not just higher resolution, but also better hardware, shouldn't the PC manage GCN prestanda at a higher resolution if the code is good enough?

Well .. if your PC is 10 times faster than a GameCube, but your game ends up processing 100 times* more pixels than the average GameCube game, things won't add up obviously Wink However, any GameCube-level game should run fine on semi-recent PC.

*Due to higher resolution, multi-pass, post-processing, transparency / blending etc.
Logged
gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #481 on: January 24, 2016, 06:25:05 PM »

A bit on gc, the wii is twice the power of a GC, I emulate that on my laptop (1.9ghz) at full resolution with ssaa at 4x (ie it is rendered at 4 times the resolution then downsized to have perfect anti aliasing) at full capped 30fps in some game that aren't cpu limited. It looks beautiful!

But GC use fixed shading pipeline limited to 8 operations (16 for wii), that's much less than any programmable shaders. And those operation are simple operation such as multiplies, offsets and adds. God old dot3 hacks for normals because it does not support them. Also lot of stuff at the vertex level instead of the fragment (thus cheaper).

Art direction and hack goes a long way to help you. For example bloom is made by using low rez version of the screen buffer stacked with quad on top of each others. Fake dof is the same but with a render of the depth on top use as a masks (or simply a blurred plane behind the character like in star fox adventures).

Logged

oahda
Level 10
*****



View Profile
« Reply #482 on: January 25, 2016, 12:20:41 AM »

Guessed as much, but I wasn't sure whether it would up in a more exponential fashion. And I guess the GCN is more "optimised in itself", since it doesn't have an OS running a bunch of shit in the background as well. Only the game.


Thanks for the links, Gimmy. I'll see if I can find anything. Most interested in lights, shadows and particles for 2D games, I guess. Yeah, I've been considering rendering a few things at lower resolution to see if it works out anyway (perhaps lights and shadows would get a neat blur by doing that).

Not sure how to sample textures in a shader if they're scaled down tho. If I draw them directly to the screen with a translation matrix that scales it, the blurring works itself out automatically, but if I just pass the raw sampler I dunno how to retrieve the pixels in an upscaled fashion in GLSL... Do I need to do an extra step where I render the upscaled texture to a fullscreen buffer and then pass that resulting texture instead?
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #483 on: January 25, 2016, 08:02:19 AM »

Base on what I know from your projects, projected shadow might be your main bottlenecks. GPU don't like when you sample pixel far away (non local) and especially if you have branch. It's great for local data (ie only the current pixel values). It does not like variable for loop too.

Remember that for each pixel it run the same program, without skipping branch, that check a lot of pixel around.

So your solution of moving away from fragment toward mesh was already great, if you render the mesh inside a B/W buffer as a mask and use that mask (thus local data) to render each pixel, it should accelerate the process.

You were already on the right path.

Shadows is always a hack even in modern game which use multiple solutions depending on objects, screen proximity and importance of objects.

2D shading is quite new and made by small indies generally, but fundamentally it's not so different from 3D, except some extra thinking per game how to handle the flatness and layers of sprite, but that's art direction. Most use brute force though like thomas was not alone (mesh based) with very small buffer (most retro pixel based game) so no optimization is needed. You game is using a finer resolution for the sprites so ...

This solution use mesh
https://www.assetstore.unity3d.com/en/#!/content/24083 it's free, maybe you can have a look at how it does stuff?
Logged

oahda
Level 10
*****



View Profile
« Reply #484 on: January 25, 2016, 01:37:49 PM »

I actually did try rendering the mesh to a buffer and using it as a mask again but it was actually slower than checking for line intersections, so I reverted back to line intersections for now. Sad Thanks for the link!
Logged

gimymblert
Level 10
*****


The archivest master, leader of all documents


View Profile
« Reply #485 on: January 25, 2016, 02:35:49 PM »

My knowledge is hi levels on that matter, I don't have implemented those technique yet (I did other things), I hope all those explanation helps you as pointer to the relevant solution. I can't help you any further, good luck!
Logged

Photon
Level 4
****


View Profile
« Reply #486 on: January 25, 2016, 06:09:31 PM »

Question:

Does anyone know how abstract functions in Haxe are implemented, or if there is even such a thing? I've tried looking at the doc multiple times and for whatever reason it just doesn't seem clear.
Logged
InfiniteStateMachine
Level 10
*****



View Profile
« Reply #487 on: January 25, 2016, 07:21:54 PM »

Haxe has interfaces. Would that do the trick for you?

http://haxe.org/manual/types-interfaces.html
Logged

Photon
Level 4
****


View Profile
« Reply #488 on: January 25, 2016, 08:32:51 PM »

Haxe has interfaces. Would that do the trick for you?

http://haxe.org/manual/types-interfaces.html
Not quite. I do use interfaces, but the abstract function would be for when there is a small slice of functionality that is specific to and has to be defined by the child. In some instances, you can just define a dummy function and override it, but its a little less elegant.

An example might be where I want to have a certain base class define a common storage management method, but the data is manipulated differently between each child. The parent class still needs the "update" function or equivalent in some form, however, so in an upcast situation its still permits the use of the update.
Logged
Cheezmeister
Level 3
***



View Profile
« Reply #489 on: January 25, 2016, 08:56:00 PM »

I know this has been asked a bajillion times before but...what's the least painful way to record a bit of gameplay as a happy little gif?
Logged

෴Me෴ @chzmstr | www.luchenlabs.com ቒMadeቓ RA | Nextris | Chromathud   ᙍMakingᙌCheezus II (Devlog)
ProgramGamer
Administrator
Level 10
******


aka Mireille


View Profile
« Reply #490 on: January 25, 2016, 09:07:35 PM »

Record you game at half the speed with any random capture software and then speed that up into a gif.
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #491 on: January 25, 2016, 09:38:05 PM »

Haxe has interfaces. Would that do the trick for you?

http://haxe.org/manual/types-interfaces.html
Not quite. I do use interfaces, but the abstract function would be for when there is a small slice of functionality that is specific to and has to be defined by the child. In some instances, you can just define a dummy function and override it, but its a little less elegant.

An example might be where I want to have a certain base class define a common storage management method, but the data is manipulated differently between each child. The parent class still needs the "update" function or equivalent in some form, however, so in an upcast situation its still permits the use of the update.

I think I follow you. You're saying the base class holds all the data and has mostly non-abstract functions but the child HAS to override one or two? It's not wonderful but you could have your base class throw an exception on a function meant to be overridden if the base call occurs.
Logged

oahda
Level 10
*****



View Profile
« Reply #492 on: January 26, 2016, 04:57:26 AM »

My knowledge is hi levels on that matter, I don't have implemented those technique yet (I did other things), I hope all those explanation helps you as pointer to the relevant solution. I can't help you any further, good luck!
Welp, I think I misinterpreted what you meant by mask. I didn't have to look into the code of that Unity plugin, but figured it out anyway. I redid it with a new mask solution — a proper one — and now I'm rendering shadows at 60 FPS after all! :D

What I meant by mask at first was really the original solution I presented in by thread; i.e. rendering the outline of the sides of the mesh facing the light and then using those during raycasting.

Instead I'm now using what I realise that you probably meant by mask: simply extruding the vertices of the sides facing away from the light far into the direction between the light and that vertex in order to create a mesh which is then rendered to a separate shadow buffer and then the result of that buffer (where 1 = shadow and 0 = no shadow) is multiplied by the amount of light in the light buffer, so that the shadow ends wherever the light ends and doesn't need to be raycasted separately. This was probably the obvious solution, but I didn't work it out until now. Tongue

Gonna write it up a bit more in detail in my thread, with pictures of the buffers and so on...

EDIT:
Done: https://forums.tigsource.com/index.php?topic=44264.msg1215915#msg1215915
« Last Edit: January 26, 2016, 05:33:48 AM by Prinsessa » Logged

oahda
Level 10
*****



View Profile
« Reply #493 on: January 27, 2016, 09:49:52 AM »

How well supported are geometry shaders (GLSL) in general these days? I've started depending quite heavily on them.
Logged

InfiniteStateMachine
Level 10
*****



View Profile
« Reply #494 on: January 27, 2016, 12:06:20 PM »

Isn't that part of the 3.0+ spec? If so I wouldn't worry too much about it.
Logged

oahda
Level 10
*****



View Profile
« Reply #495 on: January 27, 2016, 12:55:04 PM »

Good, good. They're really nifty.
Logged

indie11
Level 2
**


View Profile
« Reply #496 on: January 27, 2016, 10:33:09 PM »

I want to make a game engine in C++ just for learning purpose.. where should I start? there's so much confusion on the internet...
Logged

Oats
Level 1
*


High starch content.


View Profile
« Reply #497 on: January 28, 2016, 12:27:41 AM »

@indie11 I don't think there's a single way, I think an easy way is to just start building a small game from scratch, while thinking about what elements you would like handled in the engine.

Generally an engine will at least cover creating and managing a display, probably the gameloop, some audio stuff, generally a link to openGL or directX for graphics. Then think about if you want 2d or 3d physics and decide to build your own inhouse or link to something like box2D or Bullet. Put in features that apply to more then one game, and exclude things you think are game specific.

On the other hand, if you want to make an engine solely to learn how games work, it might well be easier and still as rewarding to just make a simple game, really it's the same concepts just in one your trying to make code that can be easily reused.
Goodluck  Hand Thumbs Up Right
Logged

eh
oahda
Level 10
*****



View Profile
« Reply #498 on: January 28, 2016, 02:55:41 AM »

I'll share my thoughts on the subject, since I've been working on a C++ engine for more than two years now and have made lots of attempts before that... Shrug

For starters, you're probably going to have to make a few engines/revisions before you really nail it, unless perhaps if you're working off of some strict template or your needs aren't too complex. As you make more engines, and more importantly, more games, you're going to get a better feeling for what sort of stuff usually needs to go into an engine, and you'll probably want to revise your old stuff a few times. I've also found it useful to learn existing engines, like Unity, whence I've gotten some ideas on how to solve certain problems.

One big problem I remember having with most of my first attempts at making engines is that I focused too much on the engines themselves, implementing lots of stuff that I might or mightn't need, overthinking architecture way too early on and so forth.

With my current engine, the one I've now managed to work on for more than two years, and that's really starting to become useful, I have some pretty solid philosophies going for me to keep productivity up, because the biggest problem with writing an engine is losing motivation when you don't see results soon enough or you learn more and want to rewrite everything from scratch again...


Design philosophies Hand Pencil

One is to make a game alongside the engine, using the engine, at the same time, implementing new features as needed for the game, instead of guessing what I might need (tho some stuff is certain based on experience from previous games or future plans for the current game)

Another is to implement things quick and dirty at first, and only clean the code up when it is known for sure that it'll work out. Saves a lot of time and results are visible sooner, which is a great motivator.

Also the classic: avoid premature optimisations. Much for the same reasons as the last point. You get results faster and if you realise later that you need to optimise, then do it then. You might not need it. I've rewritten my rendering system a lot lately, but having a barebones one to work with before that, I've been able to work on other parts of the engine and the game in the meantime with good enough visual feedback at the time. You can always perfect things later, but get them to work first and then build up. It's also very easy to make mistakes or introduce bugs if you write these humongous systems in one go.

And perhaps obvious, or not: plan important things out on paper first before you clean things up and code up the more final systems. More often than not, I've found that I've realised issues along the way, which I might've been a lot more painful if I'd spent hours coding up the first part before realising this. Also writing pseudocode to sketch something up can be similarly helpful.

Start small, start dirty, start unoptimised, and fix and expand and optimise things later, over time!


Things to bear in mind before you start  Gomez

Please make the engine portable, at least to Windows, Mac and Linux (or Android and iOS if you're making an engine for mobile games)! It is 2016 and this is super easy to do right away from the start, but it'll be a pain if you have to port stuff later. Use SDL2 (which I think is amazing) or something to get a nice foundation to build upon and then choose portable libraries for things like audio and so on. There is so much portable stuff out there.

Is the engine going to be very general (like Game Maker or Unity where you can do almost everything) or very specific (genre bound like RPG Maker, or graphics bound like a 2.5D engine or a voxel engine)? In the latter case you might want to really think hard about how to solve things in ways that work out the best only for such specific purposes and try and throw away any overhead that would come with a generic engine.

Figure out how to deal with game entities, as these are the fundamental building block of almost any game engine. Most engines today seem to be component based and try to avoid inheritance to a great extent. How will you solve this stuff? Unity separates game objects (things that can hold components) from components and uses inheritance to derive a few related components (different types of colliders, for example), which is good since you mostly don't have to bother with complex inheritance structures giving you problems, but you can still use polymorphism when it makes sense and is useful (if you don't know if an object has a box collider or a circle collider for example and you just want to get its position). My engine is similar, but a bit different: it doesn't separate game objects from components, but everything is just nodes deriving from a parent class, and can usually be nested unless the rules for a specific type of node says that it cannot have any children. I use inheritance/polymorphism on a small scale much like Unity does (having a base class for lights and deriving point lights, spotlights and so on from that, for example.)

2D or 3D? Both? Might want to keep that in mind. Don't know yet? 2D now and maybe 3D later? That's kind of my situation, so I've half-prepared for it by making the engine always use 3D vectors instead of 2D vectors for transformations and vertex data (but I actually use the z for things like layering even in 2D), and by using OpenGL to which I could easily pass 3D data if I wanted to, but that's basically it for now; the engine still only supports 2D ATM.

Will you want to add support for a scripting language? Better figure this out somewhat early on, because you might have to bind a whole lot of your C++ interface to the scripting language, and that's a lot nicer to do right away as you code up the C++ interfaces, instead of adding the support for scripting at a much later point and having to sit down and bind hundreds of things in one day. Or two. Or three.

C++ specific protip: you probably want to start fresh by using C++14 now that you can! Step out of the middle ages and into a modernised C++ with lots of features that it should've had years ago. Compiler support is up to it at this point.

Another thing you can much more easily do by using modern C++ is to add Unicode support right from the start. It might be trickier to fix as an afterthought. I personally care a lot about being able to translate my games and for that matter properly rendering the names of people in the credits, so it's important to me to support diacritics and multiple writing systems.

And finally, organise your project somewhat well from the start. Once you start getting more than a few files, either sort them into folders or use virtual folders in an IDE of choice. I couldn't imagine making a project of this size without an IDE that keeps stuff very neatly sorted out for me. It has grown over the last two years, and there are hundreds of files.

I personally find it useful to write Doxygen comments for everything from the start so that I can generate documentation if I want to, and also to put todo comments as needed in the code so that I can safely forget about currently irrelevant things that might need fixing up later until I look through the todos occasionally. I also mark all files with the creation date as well as dates when the files were updated so that I don't get confused if I manage to lose or revert files by mistake or something.

Speaking of which, remember to BACK UP files!! Mock Anger

And gee, I could go on and on and on. I have complex input scheme systems. Cutscene sequencers. Customisable rendering pipelines. Materials. Gamepad support. File loading and management. Camera utilities. Waaagh!

Engines, unless perhaps if they are very specific, can get big and it's no surprise to me that I've already spent such a long time on mine and still have yet to add audio support to it! Patience. Don't try to do everything at once. Do develop that game alongside the engine so that you can see it accumulating into a more and more useful engine.

I repeat: start small, start dirty, start unoptimised, and fix and expand and optimise things later, over time!
Logged

indie11
Level 2
**


View Profile
« Reply #499 on: January 28, 2016, 03:12:35 AM »

@Prinsessa hey thanks a lot for writing such useful post. Why I want to make a game engine is to learn the core engine stuff(its working.. collisions,rendering and everything)... I already work on Unity3D and have a good hang of it and I plan to use it as long as I don't find anything extraordinary than it.

Lazy Foo' Productions have created a new series "Beginning Game Programming v2.0" and are using SDL 2.0
http://lazyfoo.net/tutorials/SDL/

Whats your say on this?
Logged

Pages: 1 ... 23 24 [25] 26 27 ... 69
Print
Jump to:  

Theme orange-lt created by panic