Jump to content

  • Log In with Google      Sign In   
  • Create Account


caldiar

Member Since 06 Feb 2005
Offline Last Active Dec 13 2013 07:47 PM
-----

#5013028 Shaders: Lighting has different brightness on different PCs

Posted by caldiar on 20 December 2012 - 08:41 PM

Check the value of your lighting variable on the other computer. From the code you've posted, only ambient lighting is applied when 'lighting' is equal to 1 (both ambient, and directional are applied when lighting is equal to 2).

I don't see where lighting is actually set anywhere in the code you posted but that's a good starting point to take a look at for you.

To reiterate, the reason it looks brighter on the other machine is probably because you're only applying ambient lighting when it runs on that machine.


#5001331 Merging adjacent boxes to produce smallest set?

Posted by caldiar on 15 November 2012 - 02:09 PM

Take a look at quadtrees. As your level format is already a 2D grid, this would be ideal for quickly determining the largest possible box you can make out of the smaller boxes. The idea is similar to Waterlimon's.

Starting from the root node, you would drill deeper into the tree until a node has no empty children or you've met a maximum depth. If all 4 children of a node contain data (boxes) then it's safe to represent that as a single block.

Here's a visual, interactive example - http://donar.umiacs.umd.edu/quadtree/regions/regionquad.html


#4988843 Code Logic Help - Pong

Posted by caldiar on 10 October 2012 - 02:32 PM

While you're at this point, consider the following: A player isn't necessarily a paddle. Rather, a paddle is controlled by the player (or the AI).

Keeping that in mind, having the player inherit from the paddle class is probably not the most correct route to go as it indicates that your player is a paddle and not simply that your player can control a paddle. If you decide to still design your program in such a way, it's not going to explode in your face or anything and will definitely still work, but in more complicated projects it'll start making you scratch your head wondering what exactly is going on.

When thinking of the design in terms of 'the paddle can be controlled by either a player or the computer' it makes things a little simpler to work with.

You would have a single paddle class whose movement is determined by input received. You could then have a Player and NPC class which each can send input to the paddle they're associated with. The input for Player being created through keyboard button presses and the input for NPC being generated through some set of rules you've determined to affect their movement behavior.


#4988801 Enemy is dead, now what?

Posted by caldiar on 10 October 2012 - 12:39 PM

Allocating/Deallocating memory is a pretty expensive thing to do. However, with C# the garbage collector is going to decide what to end up doing with your memory once there are no longer any references to it. It still isn't a good idea to give the garbage collector any excuse to start up and begin sifting through your 'trash'.

Ideally, instead of 'deleting' the enemy once it's dead, have your enemies have a bool variable saying whether they're active or not. If the enemy is dead, it isn't active. If the enemy isn't active then you can skip physics, rendering, etc... on that particular enemy during your update loop.

Then, when you want to spawn new enemies, you can flag the deactivated enemy as active again and re-initialize the enemy to default stats (back to full health, etc...).

It's a bit of a balancing act though since it's not really practical to have everything in your game pre-allocated and always sitting in memory. If you're going to be creating/deleting something quite often, however, you should focus on keeping that in memory as long as possible otherwise you're going to be making your garbage collector work overtime.


#4987262 trying to figure out what to do

Posted by caldiar on 05 October 2012 - 03:37 PM

After you've been working on becoming a good programmer for a while, you'll find that companies will state that experience within the game industry and/or a B.S. degree are required to be eligible for a programming position.

The best way to get experience is to collaborate with a mod team. You could possibly get an internship with a smaller game company for experience but volunteering for a mod team on a game you're interested in will not only give you experience, but also give you something to show off in a portfolio. It's extremely important that you have something to demonstrate to companies showing that you not only can deliver on what you say you can do, but that you have the passion and grit to follow through on projects not for the money, but for the love of it.

Of course, this is all after you are comfortable with the language(s) you choose to develop in and are comfortable with programming concepts in general.

Having a portfolio, even as a programmer, I feel is essential. Be sure to finish your projects and only show off what you consider to be your best work.

One of the greatest resources you have at your disposal (other than google) is your peers. Don't hesitate to ask questions of others especially here on gamedev when you encounter a difficult problem.

Lastly, be consistent. Try to at least program something, no matter how small it is, each day. You will be surprised how much more you learn in a shorter amount of time if you practice and experiment every day rather than every other day. On experimentation, don't ever be afraid to try out an idea because it might be a mistake and break your code. Breaking your code is a good thing. Look into how the code broke, why it broke, and how to fix it. You will run into bugs throughout your programming adventures; every programmer does. Being able to identify and fix your bugs quickly will be an indispensable skill for you to have.

Good luck, take your time, and have fun with the process :)


#4986244 How much math do I need to use directx?

Posted by caldiar on 02 October 2012 - 07:30 PM

Honestly, the most important math you could know for a solid foundation to build off of would be trigonometry and linear algebra. Ultimately you're working with planes (triangles) aligned within a 3D space (2D if you're making a 2D game). Knowing your trig will be of huge benefit when it comes to triangle manipulation.


#4985891 UDK - Performance question

Posted by caldiar on 01 October 2012 - 04:17 PM

You also need to keep in mind how the Unreal 3 engine handles culling with models. If even a single vertex of a model is visible to the viewport, then the entire model is drawn. This is more than likely why loading up a single model for an entire level was killing the performance for UDK; the entire level was drawn at all times regardless of what was actually truly visible.

I believe this goes for 'grouped models' as well (collections of smaller models). You would need to balance grouping models together and having individual models for situations such as having a bunch of crates throughout a room. Grouping these together means you only have to check once to see if any of the models are visible. However, group too many too far apart, and a single outlying box that might be visible from where you're currently at will cause all the rest of the boxes that are hidden to be drawn anyways even though nothing is shown for the work.

BSPs can be a handy tool for indoor scenes but they really begin to struggle with handling large outdoor areas. I can't remember off the top of my head what the deal was but I believe there's also some inconsistencies with lighting methods between BSP geometry and model geometry (vertex lighting vs. lightmapping and dynamic lighting). Something to keep in mind and look deeper into.

If you build your models properly snapped to a grid following UDK's units, you will be able to snap them together in the UDK editor with ease. As long as you have your models flush with each other and prevent gaps between meshes your models will prevent anything behind them from drawing (as long as all vertices of the hidden models are not visible).


#4985818 wolfenstein 3D (How To)

Posted by caldiar on 01 October 2012 - 12:23 PM

With old raycasting engines used in games like Wolfenstein, Doom, etc... the world is actually two-dimensional. This is the origin for the "Z = Up/Down" standard that iD Software uses as the world was originally plotted on X/Y coordinates before they expanded upon it for their 3D engines.

You would have a map consisting of lines drawn out that describe a top-down view of the level and from the player's position, you would cast rays forward. Each ray will describe a vertical strip of pixels which will be a section of what's drawn to the screen. The number of rays you cast will affect the resolution of the sections.

The distance each ray travels until it hits a wall also determines how tall the section that ray creates will be. Typically you would set a threshold for the maximum height of a wall (64 units or w/e feels right). Parts of a wall that are closer will create a shorter ray which will result in a taller strip of pixels.

In the older raycasting engines the view was generally locked on an axis so you couldn't look up or down. The ceiling and floor was created by flooding the pixels that weren't defining a wall section with a solid color. You could do this by filling half the screen with 'floor color' and the other half with 'ceiling color' then draw the walls over that.

Take a look at this series of articles on raycasting for some sample code and excellent descriptions on how ray-casting works. You'll get your own ray-caster up and running in no time ;)


#4984809 "Best" Language for RPG's--Online and Offline--Single and Multipl...

Posted by caldiar on 28 September 2012 - 12:27 PM

I partially agree with Daaark that language doesn't matter. Depending on what your targeting for development (in this case, you mention you'd like to develop a MUD that runs in the browser), you should use a language that's more suited for what you're targeting.

This is not to say that you can't do what you want to do with C++; you certainly can create a browser-based MUD. However, you'll find that you'll have a much easier time with a language such as JavaScript for what you want to do.

It's been mentioned that you could use Python or C#. Both are great. However, for this particular project I would definitely recommend checking out a combination of HTML5 and JavaScript for a number of reasons.
  • HTML5 will provide you with utilities to tack on 2D graphics, with relative ease, to your text-based RPG later on when you feel ready.
  • You can write the client-side code that runs on the browser in JavaScript and use the same exact language to develop the server-side code should you choose to use a technology such as Node.js to power the server-side part of the game.
  • Socket programming (for multiplayer) is almost enjoyable with Socket.IO (JavaScript) when I compare it to working with sockets in C/C++. Of course, that's my own opinion but I'm sure there are others out there who feel the same.
JavaScript has a few quirks, to be sure. One thing to make note of is if you want to work with classes and work in an object-oriented fashion, then you should take a look at CoffeeScript which will make the quality of your life much better. Classes become a breeze to write and CoffeeScript will do all the hard work for you in compiling it to the proper JavaScript for you to use.

You can definitely write a MUD in C++. But just because you can do something doesn't mean you should. I don't believe it's the appropriate language for such a project. If you were writing a single-player text-based RPG that ran in the terminal on your own machine, and not in a browser with multiplayer support, then I feel that would be a different matter and C++ would be a great choice. My main concern, though, is mainly ease-of-use for socket creation and of the client-side code you'll have to write which will be defining what the browser displays; this is a simple thing with JavaScript but can get pretty ugly with the likes of C++.

Python, as I previously mentioned, would be good to work with as you could use something like the Python Webkit to manipulate the DOM for your client-side code, and use regular old Python for the server-side. Having a single development language across both client and server code is something that I particularly enjoy having the luxury of. I think it keeps things really simple and keeps a project flowing smoothly.

Good luck on your project. Text-based RPGs are always fun to work on :)


#4984180 Sharing data between DLL and program

Posted by caldiar on 26 September 2012 - 07:17 PM

Instead of trying to directly read the value of DLLCode.testVal, try writing a function that returns the value that can be called from the EXE.

I wrote a quick little test program with a variable declared in a shared header file (shared between a DLL and the EXE) and it resulted in something like this:

//Shared Variable
int test;

//------------------------------------------------------

//IN DLL

__declspec(dllexport) void do_things()
{
	test = 0;
	std::cout << test << std::endl; //results in 0 as expected.

	test = 5;
	std::cout << test << std::endl; //results in 5 as expected.
}

__declspec(dllexport) int get_test()
{
return test;
}

__declspec(dllexport) void set_test(int number)
{
test = number;
}

//IN EXE
test = 9;
std::cout << test << std::endl; //results in 9

do_stuff(); //outputs 0 and 5

test = 9999;
set_test(777);
std::cout << test << std::endl; //results in 9999
std::cout << get_test() << std::endl; //results in 777

So, if the variable lives on the EXE side, you want to make a function in the DLL to send the address of the variable to the DLL to work on.

I can't help but feel that I'm forgetting to mention something important. I'm sure somebody will follow this post up with some additional info.


#4983797 [For a Beginner] C++ express 2010 or C++ express 2012?

Posted by caldiar on 25 September 2012 - 05:18 PM

I dont want to start a flamewar...
sure they made good games with C, but now it is way more easy and future oriented to start object oriented. procedual (C-like) programming is always included in C++/C#/Java etc.

There are more then enough threads about wich language to choose.


I don't think a flamewar is being started. I didn't bash C++ and say C is superior or anything of the sort. However, for a beginner, learning to program is much more important than learning how to work around crazy gotchas and odd rules of a language. C is simple, capable, powerful.

I can't tell you the number of times I see beginners (and some fairly well-versed programmers) lose sight of the program itself and get caught up on details like "how to best organize an inheritance tree for my classes" and deciding if they should define an object as a collection of objects or as a specialized derived type of some master parent class (which could be derived from an even more generic parent class, etc... This is closely related to how to organize an inheritance structure). This just distracts from the main goal of getting programming done.

C++ has some great features as part of the standard language and as part of various libraries. Don't get me wrong, I like the language. I wouldn't wish it upon any beginner though as I feel it's extremely important to learn how to form a program from blocks of logic rather than having to worry about how a language does things. C++ has too much stuff going on for the same abilities as C. Yes, C++ is great for OOP designs but keep in mind that OOP is not a silver bullet to solve all programming solutions but just one of many paradigms to help describe and organize sets of problems for programmers to make sense of.

I feel quite strongly that if the OP starts off with C++ without having a general idea of how to program to begin with, he's just going to wind up spending more time pulling his hair out over things (first to come to mind is class inheritance) specific to the language rather than pulling his hair out over the actual problem at hand.


#4983700 [For a Beginner] C++ express 2010 or C++ express 2012?

Posted by caldiar on 25 September 2012 - 01:57 PM


... I'd even say C would be better to start with since there's less baggage to deal with when all you want to do is program (plus it transitions nicely into C++ when you're ready to work with it)...


Really C?
It isn´t even object oriented. Thats definitly not what you want to do if you want to get a game dev. Objects are the base of a game. C seems to be the worst decision for a beginner


You don't need to be object-oriented to make a game. It definitely can help programmers make sense of how things are organized but it's not a necessity.

However, it's worth noting that it's easily possible to get object-oriented programming happening with C through the use of structs to define, well, objects. Did you know Quake 3 Arena was developed in C? id software seemed to get a game built with C pretty well several times I'd say.

The great thing about C, for the beginner, is that it doesn't come with all the baggage and cruft that C++ has. On the other hand, C++ has a fantastic selection of libraries and makes some things easier and less scary to deal with (std::string vs. c-style strings, new/delete vs. malloc/realloc/calloc/free).

C has similar, but simpler syntax and less gotchas than C++.


#4983699 quake 3 after compile .exe error

Posted by caldiar on 25 September 2012 - 01:49 PM

Try adding the following argument to the .exe on launch - "+set sv_pure 0"

You should also be compiling and using DLLs rather than the QVM files. Custom QVM code had always been buggy for me in the past and DLLs solved a lot of headaches.

To use the DLLs add the following arguments to the .exe on launch - "+set vm_game 0 +set vm_cgame 0 +set vm_ui 0"

Launching from the command line, it should all look like this: "./quake3.exe +set sv_pure 0 +set vm_game 0 +set vm_cgame 0 +set vm_ui 0". You can save that in a batch file and run it from the folder containing your quake3.exe file.

Hopefully that helps you out some. It's been a long while since I've worked on any Quake 3 stuff. Seriously brings back memories.


#4983690 [For a Beginner] C++ express 2010 or C++ express 2012?

Posted by caldiar on 25 September 2012 - 01:28 PM

Assuming you don't have any experience with programming in general yet, I'd say start with something other than C++... I'd even say C would be better to start with since there's less baggage to deal with when all you want to do is program (plus it transitions nicely into C++ when you're ready to work with it).

I'm personally a fan of JavaScript. Some may call me crazy but I find it to not only be simple to develop in, but fun as well. I enjoy being able to write a JavaScript-based game that runs in the web browser that any of my friends can connect to and interact with. If you're dead set on following an OOP design strategy you could also use CoffeeScriptwhich lets you just.... go forth and make things. CoffeeScript compiles to JavaScript and hides all the nasty prototype nonsense involved in creating a class in JavaScript.

Another alternative would be Python. It's expressive and powerful. There's also a nice game development library for Python game developers.

Others have suggested C# as a language to use for game development. It definitely is a valid choice and with supportive libraries provided by the likes of XNA and such, you can make some pretty kickass games. However, I feel that C#, like C++ just has baggage you need to sort through before getting to focus on the meat of programming and distracts from being able to just get things done. C# makes some things pretty damn easy (XML serialization, stream i/o, threading) but there's things like the garbage collector that'll become annoyances you have to be mindful of and tiptoe around (or *gasp* play nicely with).

I would say, that if you're just starting, make some 2D games and start out with a language that just lets you focus on programming, programming, and programming. These could be C, Python, JavaScript, or some other languages that I've failed to mention. C++ and C# are powerful, sure, but they'll also weigh you down with a bunch of crap that you, as a beginning game programmer, really don't need to deal with.

Get started with some excellent material over at http://programming-motherfucker.com/become.html.

Here's some good tutorials for Python and C.

Lastly, it never hurts to know more languages. There's nothing stopping you from learning all of the languages mentioned in the thread. Once you learn how to program, it just becomes a matter of learning language syntax for the most part.


#4983678 Skyrim version Overview map in a voxel/cube world?

Posted by caldiar on 25 September 2012 - 01:02 PM

1.) By 'nice system' what do you mean exactly? System for what? A system for displaying an overhead map of the gameworld?
2.) Absolutely. See 3.
3.) A very simple approach I would take at first is by storing the world in an octree and traversing it near/far rendering more voxels for closer detail that needs higher resolution, and less voxels for objects much further away. Being at a locked angle, you can also have the mountains cull some (not a ton, but it's something) of the voxels they're hiding relatively easily. This thread comes to mind - http://www.gamedev.net/topic/591926-marching-cubes-octree-and-lod-seams/




PARTNERS