TOPIC_TITLE
stringlengths
4
128
CATEGORIES
stringlengths
13
48
POST
stringlengths
0
85.6k
ANSWERS
stringlengths
0
146k
Loading resources in a separate thread problems on some card
Graphics and GPU Programming;Programming
Hi,I'm trying to achieve asynchronous resource loading, i.e. textures, etc. are loaded in a separate thread (Loader) and all the rendering is done in the main thread (Renderer). The target platform is Windows XP or higher.I've seen many threads about this on this forum and I've successfully implemented it on my development station (GF 8500GT), however some problems arose when I tried to run it on other configurations.To start with, here is the basic flow of the application:1. Create context for Renderer.2. Create context for Loader.3. Call wglShareLists for these contexts.4. Start the Loader thread.4.a. In Loader thread: call wglMakeCurrent for the Loader context4.b. In Renderer thread: wait for 4.a to finish [1] then call wglMakeCurrent for the Renderer context.5.a. Loader waits for requests - if one shows up e.g. to load a texture - it loads it from the file, sends to GPU and flushes [2].5.b. Renderer renders - frame by frame :).Although it looks like working on my GF 8500GT, after running it on an oldie Riva TNT2, it appears not to flush (?) the last texture. I mean, if I request to load two textures - only the first one gets loaded, however when I load a third texture - the third one then appears to be not loaded, but the second one looks ok.Do you have any thoughts, how to solve this problem on Riva?Is the flow OK?What is your opinion on the [1] and [2] issues, is this normal?[1] - It turned out to be necessary to start the thread AND set its context BEFORE the main thread sets its own context. Never really read about this anywhere, but it's the only way I found to make it work on Radeon X1250. Otherwise (only if Loader sets its context after main thread) the back buffer gets messed up totally.[2] - It turned out to be necessary to call glFlush after glTexImage2D, setting filtering, etc., otherwise the texture would appear not fully loaded on my dev station (i.e. 60-90% filled with the proper data and the rest random garbage).If you're still not fed up reading, here is one semi-related, but solved story.When I started developing this system I've ran into big (as it seemed to me) problem on my GF 8500 - looked like nothing never got loaded. I spent two days looking for the reason and then my friend told me - try to drag this window to the other screen (as I'm running two monitor configuration, and the other screen would be the primary one). "D'oh", I thought, it started to work. Later I updated the GPU drivers and now it works on both screen ;).
> Is the flow OK?Depending on what your loader worker thread does (e.g. whether it also decompressed the texture from some storage format like JPG) it may be a loading time improvement if you had 3rd thread - "file loader" with its queue of files to load.So, the process would go like this (all asynchronous):(1) the main thread requests texture from loading thread(2) loading thread requests disc file to be loaded from "file loader"(3) "file loader" loads the file(4) loader decompresses texture from memory and creates textureThe reason why this can be better is that loading from disc is the real bottleneck when loading resources from HDD. So, instead of:Thread 1: load A, decompress A, load B, decompress Byou can:Thread 1: load A, load BThread 2: decompress A, decomppress B ;Quote:Original post by MickeyMouseit may be a loading time improvement if you had 3rd threadTBH, I don't care that much about performance yet. My biggest concern now is the fact it is not working on some configurations :(. ; Are you using the same pixelformat on both contexts? ; > Are you using the same pixelformat on both contexts?AFAIK pixel format is set for device context. I create two rendering contexts out of the same (one and only one) device context. So probably the answer is: yes. :) ;I'm not sure how OpenGL handles this, but accessing graphics resources from another thread is quite tricky to get right in DirectX, which I assume is similar to OpenGL in this regard. You could set DirectX up to allow cross thread access, but in general it's safer, more straightforward and sometimes even faster to stick with a single thread accessing any graphics resources.You may still benefit from a seperate loader thread to do disk access and uncompression of image data though. Just have it prepare a byte chunk of ready-to-go texture data which the render/graphics thread can upload on the go. I realize this reply is probably not quite what you're looking for, but I thought I'd share my less fortunate experience [smile]; I wouldn't recommend using wglMakeCurrent at all. It seems agreed all across that its best to load resources in another thread, then, once they are ready, upload them to GL in the render thread. ; The way I implement this is I have a Render thread, that has a list of objects to render. If an object (model/texture/etc) isn't loaded, but is in the list then a worker process goes about doing what it needs to do and an appropriate proxy is used for rendering in the mean time.All the worker process does is load the resource from the HDD, decompress it (if required), and allocate the required resources etc. It then sets a flag against the resource to say it's loaded, but not uploaded to GL.The render thread then gets to this object, knows it's loaded in memory and ready, and goes about uploading to GL.This way only 1 thread actually ever 'talks' to GL. Avoiding a large array of problems.Hope this helps.
Efficient 2D Drawing sorted system
Graphics and GPU Programming;Programming
Hello, the problem I have here is a bit difficult for me to describe so I'll try to be as detailed as I can be. I bolded the important part for those that understand the problem without a back-story.Back-story:Right now I've created an entity management system, every entity can be drawn through its own render() function. Problem is: since it's a 2D game engine the drawing order actually matters quite a lot, so I decided to write a layer system where you could divide the drawing of the world into generic parts, eg: first the far background is rendered, then a closer background then the action layer and finally the foreground. it all worked quite well, but I noticed that sometimes entities on the same layer need to be drawn in a specific order, otherwise things don't look quite right. So I decided to add a few functions to my layers in order to allow them to change the order of the entities drawn inside each layer.The problem with my earlier system: This system works perfectly in levels where the entire world is in view, however for bigger levels it'll render a lot object that are outside the view, thus wasting a lot of time.What I need: So, what I need is: a system that allows me to draw objects separated by layers, draw those objects in a specific order on that layer that I can pre-determine in the editor, and finally skipping the objects that are outside the view.What I've come up with so far: Normally for similar problems I would use a binary tree to decide which objects are inside the view, however in this case a tree would only scramble the object drawing order in the end. A way to combat that scrambling would be to use the tree to decide which objects are drawn, and then having them in specific order. Unfortunately that would mean I have to sort them in the end according to their drawing order and knowing the order in a tree environment would be a pain in the ass. one last thing I came up with was simple checking every single object if it's inside the view or not but it also occupies a lot of processing power.Final Questions to you Have any of you battled a similar problem before? If so then what did you come up with? Do you have any other solutions apart from the ones I presented or do you know of ways to optimize the ones I have right now?I'm sorry for the monolithic wall of text, I hope some of you can help me with this.Thank to everyone who spends his/her time on this in advance.~SpliterPS: depth testing would not work since I heavily use blending for smoother edges and better looking artwork.
Using some spatial-partitioning scheme to quickly get a set of visible objects and then sorting the resulting set seems perfectly reasonable to me. I don't see the "pain in the ass" anywhere. Did you try it? ; I recently just did something like this for my engine. Using the spatial system, I quickly grab every drawable object in view. Then I just sort them each draw by looping over them once to separate the layers, then sorting each layer as it is returned. Its a lot of extra work that "can" be avoided, but the cost is still very little, and there just isn't any reason to make it faster.If you need this to be better performing, then I suggest you implement a spatial for each layer, allowing you to quickly grab every object in view without having to do the initial pass over the whole collection to separate them by layers.If you really must have even better performance, then it really depends on how you determine what the depth is for each object, how much each object moves, etc. But no need to worry about that until it actually causes performance issues. For layers that don't move (which are probably the most busy layers, like the abundance of background tiles), you can just cache the sort result for the layer, and only update it if the camera moves a certain number of pixels in any direction.Edit: Oh, and if you don't have many possible depths, you could also just push each item into a sub-collection as you put it into the collection for the layer. So for instance, if you have 5 layers, and you can have up to 10 depths per layer, you just need 50 collections. An item in layer 3 with a depth of 7 would go into collection #37, for instance. ; How are you storing the entities in the layers? The typical fashion is an array. For instance, layer 0, array element 0 would be the first entity to be drawn, followed by element 1 and so on. To change the order, simply swap two array elements.Maybe I'm misunderstanding your question? ; It seems like you're trying to perform two different query/sorting processes "which entities are visible" and "draw entities in order" in a single step.. this is what's making it so complicated.One trivial solution -- if you're using graphics hardware -- is to just assign each object a unique z value (there are 2^24 unique values in a 24bit z-buffer, which should be more than enough) and use z-buffering. Then you can render objects in whatever order you'd like, and the z-buffer will ensure that the objects in front obscure those in the back.BUT: as others have pointed out, is it really that big a problem to perform each operation in a separate pass? Two simple options for this are:1a) Determine visible objects, set a "visible" flag in each; then iterate over all objects in depth order, drawing those whose flag is set.1b) Iterate over all objects in depth order, testing each if they're onscreen; if so, draw them.2a) Determine visible objects, adding each to a sorted list (priority queue) using depth as priority; iterate over queue drawing in priority order.2b) Determine visible objects, adding each to an unsorted list; sort list (using e.g radix sort) based on depth, then iterated over sorted results drawing in order.Hopefully this gives you some ideas.. good luck!raigan
Boost spirit & line/column numbers
General and Gameplay Programming;Programming
I know that boost.spirit has a wrapper-iterator that stores information about the current line and column, but is there a way to store that information during parsing? I need this information to verify some of the arguments (for example if a given font-type exists) in an additional step which I can't do with my spirit rules (or I don't know how that would be possible) and report errors with references to the line and column, where the error originated.Given a simple rule like this, which produces a std::string,quoted_string %= lexeme['"' >> +(char_ - '"') >> '"'];can it be modified to synthesize a structure, consisting of a std::string and a file_position that is taken from the iterator of the rule?
It's fairly easy:struct FileLocationInfo{std::string FileName;unsigned Line;unsigned Column;};typedef boost::spirit::classic::position_iterator<const char*> ParsePosIter;class ParserState{public:void SetParsePosition(const ParsePosIter& pos){FileLocationInfo fileinfo;fileinfo.FileName = ParsePosition.get_position().file;fileinfo.Line = ParsePosition.get_position().line;fileinfo.Column = ParsePosition.get_position().column;}};struct SomeFunctor{SomeFunctor(ParserState& state): StateRef(state){ }template <typename IteratorType>void operator () (IteratorType begin, IteratorType end) const{StateRef.SetParsePosition(begin);// Do additional processing of the rule here}private:ParserState& StateRef;};// In your grammarFooRule = (Frobnicate)[SomeFunctor(self.State)];// In the grammar wrapper structprotected:ParserState& State;This is all stripped down from an actual implementation, used in the Epoch language project. You can check out the sources here if you'd like to see more detail on using Spirit. (The relevant files can be found under FugueDLL/Parser.)
Vairous php and mySQL game questions
Networking and Multiplayer;Programming
My other post about php/mySQL seemed to morph into a Q & A session about everything I could think of, so I figured I should start a proper post more suited to that purpose.First of all, I am following this tutorial series pretty closely. This is my first 'online' game attempt and I am not very familiar with php or mySQL, but I am making steady progress.Ok so the first question off the top of my head. What is the best way to manage player and monster stats?According to the tutorial I am reading, I create a 'stats' table, which just houses the display_name and the short_name of the stat. Also each stat is assigned the int id.Then as I create a new 'monster', I add the monster to the 'monsters' table. This table just stores the monster name and the int id.Finally there is a third table, the 'monster_stats'. For each monster in the monsters table, I add a stat from the stats table and then a value.So as a quick example:stats:id | display_name | short_name1 | Physical Defense | pdef2 | Magic Defense | mdefmonsters:id | name1 | Zombiemonster_stats:id | monster_id | value1 | 1 | 52 | 1 | 5So from this setup, you can see that the Zombie has 5 pdef and 5 mdef.So is this sort of system ok? Is it more complex than I need for my first time around? Is it pretty standard?
Why not store your monster data in one table? Normalizing your data like this means you have to perform two JOINs across three tables. It's fine if you want to use PHP and MySQL for this, but I don't think MySQL lends itself particularly well to this problem. ; I think your question falls into the category of design rather than implementation. You can do it any way you want even store everything in 1 table or every table in a separate database( not practical), but really it is just a matter of how you see it.; Hey thanks for the response guys! Ok so there is no real 'best practice' that everyone knows about (but of course I don't because I'm a noob)?Thanks for the feedback guys. I'll stick with whatever the tutorial says for now, until I get my own feel for the grand scheme of the system.For the user information, I split it across a few tables:account:idusernamepasswordis_adminemaildate_createdactiveget_newssession_tokenlast_loginuser_data:idlast_login(for this character)namelvlacnt_id(belongs to account->id)ntr_zone(zone id to enter when character logs in)avatar(mesh to load for this character)cPosX(x position)cPosY(y position)cPosZ(z position)cRotY(y rotation)user_items// not fleshed out yetuser_stats// not fleshed out yetDoes this look about right? I appreciate all your help and feedback! Is this the wrong forum for this topic?BUnzaga ;Quote:Original post by BUnzagaOk so there is no real 'best practice' that everyone knows about (but of course I don't because I'm a noob)?Best practice would be to go with your original idea, of breaking everything out into separate tables (normalizing your data) and JOINing them when necessary; this will allow for faster updates of your data, and help prevent problems with faulty updates (you only have to update in one place rather than in many places because you have duplicated data everywhere). Don't denormalize (put things back together in one wider table) unless it is for performance reasons, after you have everything working.However, I don't use MySQL so drr may have a point. I will refrain from getting religious about your choice of RDBMS. ; Either one works, as both have their advantages. Normalized like you have it, it is very easy to add and remove stats completely since your query to read it won't ever really have to change (it'd just end up with more rows). Denormalized, it requires a slight alteration to the query to read the new rows. Though I almost always go with the denormalized version myself (in this scenario) because:1. Stats don't change very often in comparison to most everything else. If you design the game before programming it, you may only need to change it once or twice, if at all.2. The denormalized version has a very poor key-to-property size ratio with a very high rows-per-foreign-key count. That is, each character has a lot of stats, and each stat is only 2 or 4 bytes but still requires 2 keys that together are probably 6 bytes.3. If you are updating a character, you want to update everything at once. That is, everything in the row. You may even update values that haven't changed just to avoid the overhead and time required to make a decent value change detection system. Then again, this does vary a bit depending on how you update persistent data.4. No need to JOIN.5. You get to assign a different value type for each stat if you want. This is a huge bonus for me. I don't want my level, which will never pass, say, 60, to have to take up 2 bytes. Or have every stat take up 4 bytes just because I thought it'd be nice to make sure people could have over 65535 HP.But you are correct, there is no real "best practice". The Guild Wars guys decided to just put the whole character into a single column as a giant BLOB if I remember correctly. There are also plenty of people out there who kick and scream when they even smell data being denormalized like this.Keep in mind that if you are making a game editor or something of that sort where you want people to be able to easily modify the stats, it is a LOT easier for your self to use normalized stats. Otherwise, adding/removing stats requires an editor that is a bit more intelligent and can handle performing queries with dynamic schemas. But it is very possible, and you really can query MySQL for just about any data on a table. You can even prefix your columns with something like "stat_" so to grab a query of all the stat columns, you do something like:mysql> SELECT `column_name` FROM information_schema.COLUMNS WHERE `table_name` = 'npc_character' AND `column_name` LIKE 'stat\_%' ORDER BY `column_name`;+--------------+| column_name |+--------------+| stat_agi|| stat_defence || stat_int|| stat_maxhit || stat_maxhp || stat_maxmp || stat_minhit || stat_str|+--------------+8 rows in setStraight out of my engine. :) ; Are you going to change the available stats all that often? If not, just put them all in columns.create table monster( id int not null autoincrement primary key, name varchar not null unique, str int not null, dex int not null, mind int not null, pow int not null, hp int not null, loot_id int, constraint foreign key(loot_id)references loot(id));Note that, this way, there's no way of forgetting to assign a stat to a monster. With the super-normalized triple table, you'd have to write special queries to find the ids of monster classes that don't have all the necessary stats assigned...If you really need a super-normalized table for some reason, you can still keep the id/name mapping in a map/array in your software, and hard-code the id used in the tables. That way, you can add stats without creating any "alter table" statements (although altering your tables isn't a big deal in tables with less than 10,000 rows or so).If you really need to put the stats themselves in a table and use foreign keys, you could just as well use the short name as a foreign key: it's unique, and it's short. As a bonus, it's human-readable! Which table dump would be easier to debug?Table 1:1 1 101 2 131 3 52 1 172 3 10Table 2:orc dex 10orc hp 13orc int 5rat dex 17rat int 10Note that you probably won't be able to measure any performance difference between those two schemas (int keys vs short string keys), even with tens of thousands of rows, because databases are generally bounded by disk seek, not the difference between integer compare and string compare.In my opinion, the extra indirection of "entity, property, value" that allows you to define new kinds of properties comes from the "super flexible" content management systems of the world, and only make sense when you don't know up front what the schema will be, because different users will have different schemas. However, you lose a lot of the power of a relational database if you do that, because you can't easily do things like enforcing presence for specific properties. Plus it runs slower, although for any normal RPG it wouldn't really mater.For your game, however, there is one user: your game. You know the schema. There's no reason to over-normalize, and many good reasons not to! ; Thanks guys, this is the exact information I was trying to get. I think the creator of the tutorials I was following was trying to make an 'all inclusive' type tutorial which someone could follow and use, no matter what game they were making.Some of you ask 'why are you doing it like this', etc and the answer is, it is because I don't know better or any other way, so I am so glad you are taking the time to explain it to me and give me working examples like you are.I really like the idea of using the short_name for the foreign key. Would I still use the int auto inc for the indexing, or could I just drop that and use the short_name if I make sure it is unique?Also, I have been using $_SESSION for storing user data, is there an easier way to write something like: '".$_SESSION['whatever']."'??? Is that why people use %s and mysql_real_escape_string ?Here is an example of when the user chooses a character and logs into the game:// above here I require_once config.php and loginCheck.php// for the database connection and session token / account id check// and I have a switch for... $_POST['cmd']case "ntr": // short for enter (game)if(isset($_POST['chrname'])){ $query = "SELECT name, lvl, ntr_zid, avatar, cPosX, cPosY, cPosZ, cRotY FROM user_data WHERE acnt_id = '".$_SESSION['acnt_id']."' AND name = '".$_POST['chrname']."' LIMIT 1;"; $result = mysql_query($query); if($result){ $_SESSION['user'] = mysql_fetch_assoc($result); echo "<user_data name='".$_SESSION['user']['name']."' lvl='".$_SESSION['user']['lvl']."' zone='".$_SESSION['user']['ntr_zid']."' avatar='".$_SESSION['user']['avatar']."' cPosX='".$_SESSION['user']['cPosX']."' cPosY='".$_SESSION['user']['cPosY']."' cPosZ='".$_SESSION['user']['cPosZ']."' cRotY='".$_SESSION['user']['cRotY']."' />"; }}break;Does it look ok? Does anything look alarmingly wrong? In the engine I am using, I am parsing the response string into an XML file and loading the correct mesh/pos/rot from here.One more question. I noticed that if a user create a character with the same name on the same account, and then try to delete one, there is no guarantee which one will remain and which will delete. I realize that a lot of games will force users to create unique character names. Is this something I should do to resolve this problem, or should I assign a unique token to each character and pass this back and forth when the user creates / deletes a character?Again, I appreciate the responses, opinions and feedback. As this is my first online game, I am just learning as I go and can use any advice you are willing to offer.BUnzaga[Edited by - hplus0603 on January 14, 2010 11:23:59 AM];Quote:I think the creator of the tutorials I was following was trying to make an 'all inclusive' type tutorialOr the reason might be that the author of the tutorial hasn't learned better ways? I find that most tutorials are written as a way for the author to learn things for him/herself, which generally does not tend to expose best practices. I have no idea about the specific tutorial you're following, though.Quote:mysql_real_escape_stringThe reason to use mysql_real_escape_string or similar is to avoid SQL injection attacks. If you have a registration form:<form method='post'><input type='hidden' name='action' value='register'/>Name: <input type='text' name='name' /><br/>Password: <input type='password' name='password1' /><br/>Confirm: <input type='password' name='password2' /><br/></form>If you now handled that like:<?php require_once("common.php"); if ($_POST['action'] == 'register') { if ($_POST['password1'] != $_POST['password2']) { error("The two passwords entered were not the same."); } // WARNING! BADNESS ON THE FOLLOWING LINE! $r = mysql_query("INSERT INTO users(name,password) VALUES('$_POST[name]', '$_POST[password1]')"); }I would probably try to register a name like ','x');DROP TABLE users;--I'll leave it to you to figure out what would happen if I did :-)You have to quote the input data that a user may provide. Always. Doing browser-side input format checking is not good enough, because users can (and will) construct form posts on their own (or just turn off &#106avascript).<br><br>And if your tutorial didn't tell you about this as soon as it introduced the concept of mysql_query(), then I'd suggest finding another tutorial :-)<br> ;Quote:Original post by hplus0603','x');DROP TABLE users;--I'll leave it to you to figure out what would happen if I did :-)You have to quote the input data that a user may provide. Always. Doing browser-side input format checking is not good enough, because users can (and will) construct form posts on their own (or just turn off &#106avascript).And if your tutorial didn't tell you about this as soon as it introduced the concept of mysql_query(), then I'd suggest finding another tutorial :-)Actually this particular attack won't work because PHP doesn't accept multiple queries in one mysql_query call. But hplus's point is still valid, an attacker may use other attacks with unsanitized input. In your code snippet where you select the user info based on the POST of the character name, the user could supply a crafted name that returns a different user.
Should I Register The Trademark For My Software?
Games Business and Law;Business
Hi,I have only registered the .com domain name for it right now, should I register the trademark too? What might happen if I don't register the trademark? Will I have to change my software's name and/or domain if someone else register the same name as trademark after the launch of my product?Thanks
The most important thing to do is ensure someone isn't already using that name for a software project (game?) and that there isn't already a trademark registered in the territories you want to sell in. You don't need to register a trademark in order to gain protection - you just need to use it (as in, sell the product). However it is easier to defend a registered trademark than an unregistered one. If you have invested a lot into the project and/or it is generating a lot of income then it is probably worth registering. If you are a small indie just starting out then it may be too soon to worry about trademark registration.
[web] Forum post submit button.
General and Gameplay Programming;Programming
I'm having a problem figuring out how to get my submit button to work right, basically the submit button calls a java script function which is suppose to write the post into a database but the only way I know to do this is with php. I tried this though I knew it would not work:<script type="text/javascript">function submit(){<?phpmysql_query("INSERT INTO posts ( id, parent_id, category_id, user_id, subject, message, sticky, allow_post )VALUES('3','3','1','1','Hi','Hi again','1','1')" );?>window.location="view_category.php?cat=<?php echo($cat_id); ?>";}</script>How can I do this since php is server side and java is client side?
Use an XMLRequest in &#106avascript to call a 'post.php' file.Personally I would use jquery;Quote:Original post by SteveDeFacto...I'm having a problem figuring out how to get my submit button to work right, basically the submit button calls a java script function which is suppose to write the post into a database but the only way I know to do this is with php...Your submit button has to call a php script on the server to do something in PHP. You have two options, first is using plain HTML formular elements, second is using an AJAX POST (with &#106avascript). You're a beginner, so stick with the basics first:Learn some HTML formular syntax, which does POST requests. For example you could output the following:<form action="post.php" method="POST"> <input type="text" name="mytopic" /> <input type="text" name="mymessage" /> <input type="submit" value="submit" /></form>Than learn how to access POST environment variables a php script can access when called with this method. For example the php file could do something like this:<?php// if the script file gets called by hitting the submit button than// the $_POST array got set by the php interpreterif (isset($_POST['mymessage'])) { echo($_POST['mymessage']);}?>; I used the form method it works perfect. thanks man.
Getting My Feet Wet
For Beginners
Well I was wondering if this site was a good place to get started in game design? Basically I just want to help with making a game in my free time. All I can do is some decent 3d modeling. I know nothing about coding. I am just a high school cad student that wants to take things further. I was just kind of hoping to start picking up on things as I help work on projects. Am I in the right place?
Quote:Original post by UnmentionedWell I was wondering if this site was a good place to get started in game design? Yes. It is very good place. If you stick around, I think you'll find that this place is an excellent resource for game development.Quote:Original post by UnmentionedBasically I just want to help with making a game in my free time. All I can do is some decent 3d modeling. It is good that you can do 3D modeling. You may want to cobble together a small portfolio and show that off in the Help Wanted sub forum. You may be able to find a small team where you can contribute to the effort by providing models. Quote:Original post by UnmentionedI know nothing about coding. I am just a high school cad student that wants to take things further. Do you want to learn coding? Is this an interest of yours? If it is, you owe it to yourself to try to learn more. Even if you want to concentrate on graphical art, some coding knowledge may be useful to enrich yr overall game development knowledge.And even if you do not want to learn programming you can still know that game artists are still very much in demand. Furthermore, there are some who program and also create art assets for games. All I am saying is that you should learn, explore and possibly define yr exact goals. People will be in a better position to give advice if you're more specific.There is also a Breaking In forum here that provides help and advice in regards to breaking into the game development industry. If this is an eventual goal of yrs you may find help there.So basically keep learning and creating. Things will fall into place. Ask more specific questions as they arise. Good luck. ; Ah thank you. I am looking at game development as a hobby to try. I am intersted in coding. I figure I would learn code as I helped. I know a little bit of html, but that ain't going to help lol. For me, the best way to learn is to jump right in. I forgot to add this to my first post but finding a small team to join was a main reason for finding this site.
Gamer's Guilt -- Forgetting your Code?
For Beginners
I am suffering from Gamer's guilt.I spent a month writing a bunch of cool classes and now that they are working and I am moving on to a new phase of my project I find that there are 50 things I wish I had done differently with my code. :(This is new to me since I am working on my 1st "Big" project where I actually have to have abstraction for my classes to keep my code readable. But I find myself desperately wanting to go rewrite the code that I have. The code I have is functional, but there comes a point where you have to stop screwing with your code and move on and use your code. Sort of like when an author of a novel has to stop revising and has to publish the work or move on to other chapters.How do you guys know when to quit screwing with your code? Ie. You have finished your map class and now you are moving on to putting things on the map. What do you use to determine if its time to stop messing with the map?
My strategy is to only rewrite something when it is necessary to support new functionality that I want or to fix a bug. ;Quote:Original post by StoryyellerMy strategy is to only rewrite something when it is necessary to support new functionality that I want or to fix a bug.I am being forced to take a similar approach. Must fight the OCD to rewrite my code... must fight it! One rewrite I did was for performance but I had to quit after that.; In all honesty this is where I find that a Test Driven Development pattern really excels and is why I use one. It helps to keep you from constantly modifying that code you want to use and keeps you from breaking it when you get it to work.Here is the pattern I follow your issue is around point 4.Ok so lets say I want to implement a date class that handles dates. This is what I would do.1. Requirements:What does my date class need to do. (Relay back a properly formatted and valid date.2. The Unit Tests: Write my unit tests to that requirement.3. Implementation:My unit tests fail so now implement the date class till these pass. Once they all pass I am done it needs no more functionality at this point. My tests pass so it does what it has to do no more no less.4. Refactor:Ok how can I make this code more usable and user friendly. Or even how can I implement this more efficiently. Remove all redundant pieces etc...5. Run Tests:Make sure our tests pass after making our changes. If our tests fail don't modify the tests you messed something up during refactoring now fix it.By going through these steps for as much code as possible; I find I end up with more user friendly code that is much more efficient and bug free.This is not for everybody but I think in this situation it could help you out quite a bit with your current issue. ; That doesn't really work for me, because I have no real design decided on ahead of time.Instead I had functionality as needed and periodically refactor when I notice that I'm duplicating a certain piece of code a lot and can think of a way to avoid this. ;Quote:Original post by rattyboyHow do you guys know when to quit screwing with your code? Ie. You have finished your map class and now you are moving on to putting things on the map. What do you use to determine if its time to stop messing with the map?When you can actually put stuff on the map (and generally use it) without grief.; I never (or atleast try very hard not to) write code until I need it. I really do like TDD's way of forcing you to write the API first, then write the code. That, IMHO, is the best way to write code. ; Behavior Driven Development helps fight code creep.I use a tool called 'cucumber' in Ruby that allows me to write my test cases as User Stories. So basically, I write how I want the code to be used, then I implement it until the test stops failing.This way, I only implement the things that I know will be used. ; I've had this feeling before. I made a whole class structure that it turned out didn't make sense and I couldn't implement the spec without copy & paste because it didn't agree with the way multiple inheritence is done in Java.It was ugly and I felt pretty dumb, but I just used copy & paste and finished it so I could move on and do it better next time. ; Before actually rewriting that code, try using it first (that is, build some code that uses it). If that quickly becomes hard and messy, then restructuring (not just blindly rewriting) it to a more usable design is beneficial. But if it's only the internal code that's messy, then don't bother tweaking the implementation until you have to (for performance or bug-fix purposes). After all, there are more important things that you can spend your time on, right?Then again, for quick 'n dirty scripts, clean code isn't all that important - get the job done, quickly, and be done with it - and write better code next time. Cleaning up such code often isn't worth the time investment because you're not going to have to maintain that code in the long run.
AS3 Developers needed for small game
Old Archive;Archive
Hi,We are currently looking for some feelance developers who are fluent in AS3 and potentially know how to use Box 2D to develop some of our games.We are an experienced flash game development company based in Staffordshire but our studio is getting very full so we are looking for people who can demonstarte great AS3 skills who have pretty quick turnarounds.If you are able to work from our studio then that is great but this is not necessarily essential.If you are interested then please get in touch [email protected] the bestStu @ Koko
[pygame] Getting a sprite drawn
Engines and Middleware;Programming
My code is as followsimport os, sysimport tracebackimport pygame as pgdef main(): succes = pg.init() if not succes == (6,0): print success screen = pg.display.set_mode((640, 480)) player = Player() group = pg.sprite.Group(player) running = True while running: group.draw(screen) pg.display.flip() for ev in pg.event.get(): if ev.type == pg.QUIT: running = Falseclass Player(pg.sprite.Sprite): def __init__(self): pg.sprite.Sprite.__init__(self) self.image = pg.Surface((200, 200)) self.image.fill((128, 128, 128)) self.rect = self.image.get_rect()if __name__ == '__main__': try: main() except Exception, e: tb = sys.exc_info()[2] traceback.print_exception(e.__class__, e, tb) pg.quit();It is supposed to create a player, put the player in a group and draw the group including the player. The player.image consist of a gray surface.However, when I run this nothing is shown.[Edited by - Somelauw on January 20, 2010 6:05:08 PM]
You need to define where you want the sprite to be drawn:class Player(pg.sprite.Sprite): def __init__(self): pg.sprite.Sprite.__init__(self) self.image = pg.Surface((200, 200)) self.image.fill((128, 128, 128)) self.rect = self.image.get_rect() self.x = 100 # set the x attribute self.y = 100 # set the y attribute self.rect.center = (self.x, self.y) # sets the rect (and thus the sprite) at position self.x, self.y; I tried it and it worked.Then I commented out the lines and it still worked.The problem might be that I put the class Player in a seperate file and used an import. For some reasons imported modules don't get compiled automatically when you draw one and you haven't restarted the idle.I'm using pyscripter. ; Right, once an imported module is compiled, the script will use the compiled version. ;Quote:Original post by EsysRight, once an imported module is compiled, the script will use the compiled version.Is there a simple way to force reloading or a code editor which forces it?I think that for anything big, being able to split your code over multiple files without having to restart your editor is a must. ; you could try py_compile.compile;py_compile.compile(file[, cfile[, dfile[, doraise]]]) Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file name file. The byte-code is written to cfile, which defaults to file + 'c' ('o' if optimization is enabled in the current interpreter). If dfile is specified, it is used as the name of the source file in error messages instead of file. If doraise is true, a PyCompileError is raised when an error is encountered while compiling file. If doraise is false (the default), an error string is written to sys.stderr, but no exception is raised.;Quote:Original post by Esysyou could try py_compile.compile;py_compile.compile(file[, cfile[, dfile[, doraise]]]) Compile a source file to byte-code and write out the byte-code cache file. The source code is loaded from the file name file. The byte-code is written to cfile, which defaults to file + 'c' ('o' if optimization is enabled in the current interpreter). If dfile is specified, it is used as the name of the source file in error messages instead of file. If doraise is true, a PyCompileError is raised when an error is encountered while compiling file. If doraise is false (the default), an error string is written to sys.stderr, but no exception is raised.Is this the most convienent way to do it? Is this also the way professionals handle this problem?Do you put py_compile.compile inside your source code or do you call this function manually from the console each time before running? ; No - professionals probably aren't running Python from within the IDE, or they're using a more advanced IDE that doesn't cache the interpreter state between execution runs. ;Quote:Original post by KylotanNo - professionals probably aren't running Python from within the IDE, or they're using a more advanced IDE that doesn't cache the interpreter state between execution runs.So what do they use instead?Does netbeans work? ; I just use a plain text editor. Other names I've heard people use are Wing, Komodo, and Eclipse.
Books on Circle/Sphere Geometry?
Math and Physics;Programming
Just out of interest, anyone know of good reference books, focusing on circle and sphere geometry calculations? Bit like a formula cookbook! Suggestions appreciated. :)
If a book on spheres does exist, it would likely just be a pamphlet. The only query I've ever had to worry about is to see if a point was on or in an ellipsoid.I'm sure books on analytic geometry as a subject are all over the place. (Google it, I got many results.) I have my doubts on books just covering spheres, though. ; I disagree with zyrolasting. A book on spheres could be almost arbitrarily thick. It could talk about conic sections and quadrics, about the implications of curvature (the angles of a triangle add up to more than 180 degrees), about the complex projective line (a.k.a. Riemann sphere), about map projections (cartography), about spheres in higher dimension and their topological invariants (e.g., Poincare's conjecture)...A quick search in Amazon shows this book about planes and spheres and a couple of books involving higher Math.; What you need is "Spherical trigonometry", a common subject taught in Europe but not in America.It is also a specialty for maritime navigating officers . You will learn that it is possible, and common to have a triangle with 3 angles of 90 degrees.A Google search will dump you tons of infos, and formulasEnjoyEpilot10merchant marine officer. ;Quote:Original post by epilot10What you need is "Spherical trigonometry", a common subject taught in Europe but not in America.I think it's more an old-fashioned branch of Math. I have a degree in Geometry from a European university and I didn't take spherical trigonometry at all. I probably did learn enough general geometry to be able to figure things out if I need to, though. ; European education isn't uniform. In Italy I never had courses on that subject, but in Berlin it's taught. Look for example at the basic BMS course in Geometry (Geometry I). I also suggest this book on Möbius differential geometry if you are interested in a more differential geometric point of view.@alvaro: where are you from? ;Quote:Original post by apatriarca@alvaro: where are you from?Spain. ;3D Math Primer for Graphics and Game DevelopmentNow, I find that their writing style is a little unclear at times, but it's a decent "recipes" book all around.Fortunately they have the source code online for free:http://gamemath.com/downloads.htmThis book might also help as a secondary reference, though I've never read it:Mathematics for 3D Game Programming & Computer GraphicsI find that the more books I have at hand on one subject, the better I'll be at being able to clear up any ambiguities as to what's actually going on. More points of view, the better.Finally, I always recommend this book;Mathematics: From the Birth of NumbersThis last book is also a "recipes" type book, giving concrete examples. The sections on geometry and linear algebra are very enlightening. It's also a great history book as well. If there was ever a book that I truly love reading, it's this one. ; You should just invest in a CRC ... I'm sure that it'll contain all of the formulas you need regarding spherical geometry and spherical trig ... and it's pretty easy to pick up an older one used for not much money -- just ask around at used bookstores in a college town. ; Excellent, thanks for your suggestions. Should be a good starting point.Quote:zyrolasting:If a book on spheres does exist, it would likely just be a pamphlet. The only query I've ever had to worry about is to see if a point was on or in an ellipsoid.I'm sure books on analytic geometry as a subject are all over the place. (Google it, I got many results.) I have my doubts on books just covering spheres, though.Considering Menelaus of Alexandria wrote an entire book spherical trigonometry about 2000 years ago, I'd say it is a fairly rich topic. And yes, of course I use Google; and the reason why I want a book, so I don't have to. Internet searches can be a real hit-and-miss affair at times. I was after something fairly comprehensive.
Deferred rendering and antialiasing
Graphics and GPU Programming;Programming
I'm thinking of switching to deferred rendering for my game, and this gave me an idea...Say we lay out the G-buffer and we use deferred rendering to calculate only the lighting, and saving it into an HDR buffer. We can perform bloom in that buffer if we want. After that, we do only one additional pass, rendering the geometry with the materials, and in the end we additive blend those 2(lighting+materials). Am I correct to think that we will have proper anti-aliasing in that case(seeing as the final material pass *will* have antialiasing)? If so, I think it would be a good idea at least for my case, since it's only 1 additional pass. What do you think?
That's almost how light-pre-pass works, which is becoming popular on consoles now-a-days for deferred+MSAA =DYou create a GBuffer with depth, normals (and spec-power if you can fit it in), then use that to generate a Lighting Buffer (RGB = Diffuse light, A = specular). To keep the buffers small, you don't get properly coloured specular, but guessing from the diffuse color is close enough.Instead of blending the LBuffer and the material-pass, you sample the LBuffer in the material pass.vec4 lighting = tex2d( LBuffer, screenPos )vec3 diffuse = lighting.rgb * diffuseMap.rgb;vec3 specular = lighting.aaa * light.rgb * specularMap.rgb;return vec4( diffuseLight + specularLight, diffuseMap.a ); Thanks for the link! I had no idea people were already doing this, that's reassuring. I'll go ahead and implement it then :)About sampling the light buffer, at first I thought of doing exactly that, but if I want to implement a bloom filter of the light buffer, this would obviously not work, since bloom is visible beyond the boundaries of the polygon. Apparently I can't apply the bloom after the material pass, since I would run into the same situation again as I have in the beginning- poor MSAA support for render-to-texture. Now, if I were to store the specular value in the alpha channel of the LBuffer, simple blending wouldn't work, but I think a short 2-pass filter where I first multiply with diffuse and then add specular should do it I think. ; You can still do bloom as a post effect, after the second geometry pass. At this point, all of your geometry has been rendered with MSAA, and your post-effects (bloom) work on the resolved AA buffer. AFAIK, MSAA supporte for render-to-texture is pretty good -- the reason it's not used in deferred rendering is because AA is designed for colors, not positions/normals/etc that you put in the GBuffer.However, you could perform your blur filter just on the LBuffer (before the second geometry pass), but this will produce slightly different results.e.g. imagine a red sphere, lit by a green spotlight, with a grey background.With post-bloom: In the final buffer, the sphere's color is red*green==black, which won't be bloomed.With pre-bloom: In the LBuffer the sphere's color is green, which will be bloomed onto the grey background.I guess it's a matter of taste which effect is "correct"? ;Quote:Original post by HodgmanYou can still do bloom as a post effect, after the second geometry pass. At this point, all of your geometry has been rendered with MSAA, and your post-effects (bloom) work on the resolved AA buffer. Yeah, you're right. Thanks :)Quote:AFAIK, MSAA supporte for render-to-texture is pretty good -- the reason it's not used in deferred rendering is because AA is designed for colors, not positions/normals/etc that you put in the GBuffer.Well, I guess it's in the GL3.2 core, but I don't know what range of hardware supports it...I'll look into it.;Thank you for the idea and the prepass details. It finally makes sense to me now to do such a thing [smile]
Game Making Tool
For Beginners
HI forum , I am new to game programming.I want to prepare an Game making tool software, like Game Maker , Multimedia fusion 2 etc. for this i made search on google i found many game engines . some are with source code. but i am not able to execute those to check whether the code useful to me or not .the game softwares uses some editors to achieve the task . like creating objects rendering those etc. even i search for editors all i found either .exe format . i want to do this using c++ . i am looking for the code related to c++ only.can any one suggest me how can i start , what are main resource that i need to start . is there any open sources available which help to my application.i dont want to start from scratch i want to build my application using the existing sources . so please share Your ideas related. thanking you in advance
I don't undestand.You want to make a kit?Or you want a kit to make a game?Don't go making an engine or a kit if you have never even made a game. ; Do you want to know HOW to develop games? what tools to use? there are many, but theese are free and fully functional.Here is a software do develop c++ applications/ games:http://www.microsoft.com/express/Windows/And you'll also need a library that can render graphics and sound, take inpust and so on. I use Dark GDK:http://gdk.thegamecreators.com/ ; lol you need to actually know the in's and out's of making games before you can make an engine like game maker. Several years knowledge and experience at the minimum. lolOnly reason I say this is because you would know where to start if you have the required knowledge. :p ; How about Construct. It is open source and free... It is made mostly by a group of former add-on developers for Multimedia Fusion. ; Thanks for sharing . firstly i am looking open source code for 2D level game editor software like Multimedia fusion2 . to prepare software like we need different editors like frame editor, object editor ,map editor etc . so i am looking to build those editors first so for this i would like to know what are the resources available . i there any open source with respect to c++ for this editors which help to my project . so please share Your ideas with respect to this. thanking you ; As with some of the other posters, I'm not sure if you want to code an editor or find a free one.If your looking for an editor I would suggest Torque2D (I think they do a 30 day trial).If you are wishing to build one yourself then I suggest you learn the structure of an engine. A good book that I have found for this are "Advanced 2D Game Development by Jonathon S. Harbour". Its a step by step approach to building a 2d engine but by the end you should understand enough to do an editor.If you haven't had much experience with C++ or DirectX before then you might find it tricky to follow. I hope that helps... ; mrobbins Thanks for Your post , Yes i am looking to build an editor , i had experience in c++ so i am search for source code of an existing editors . i feel more better to build this tool using that existing open source code rather than to start from the scratch .i found some source code for editors like map , egameeditor etc but those are not in c++.Any ideas? ; I did a search and found an open source editor: http://dannylum.com/D2DProject/Its C# / .NET based so you can use it as a reference but not really as an implementation. I would recommend you find an engine as you will still need one to build an editor on top of.Also, you should probably contact the guy who made it and give him some praise for it. ; Its not a complete tool , it is map editing tool i observe that we have to do some programming for creating game using this.the code is completely c# where difficult to me to understand can any one suggest more.
Sending large data through TCP winsock
Networking and Multiplayer;Programming
I've been busy with Winsock for a while now, creating a program that sends snapshots of the desktop through a socket to the client.Everything works when I'm trying to send small packets of data through the socket, stitching the packets back together works! This means I can send small packets of data (the rectangle of which to capture data, small messages etc.) I can even send small images through the socket. The problem is that when I send a relatively large piece of data (+/- 15000 bytes) through the socket, it will only receive 8192 (or 2^13 bytes). After this, the Receive event will not get raised anymore.How do I fix this?this is the code that I use to receive data://'Socket *pSocket', is a pointer to a class that wraps around //the socket part of Winsock//'WSAEVENT hRecvEvent' is the event that indicates if there is any data//to receive//'std::vector<Buffer> *pBufferVector' is a vector of buffers, used to //receive multiple packets of data if there are large packets//'bool &bTotal' is a boolean flag that will be set if the first element//in the vector contains a complete bufferbool ReceiveData(Socket *pSocket, WSAEVENT hRecvEvent, std::vector<Buffer> *pBufferVector, bool &bTotal){Buffer tempBuffer;DWORD dwResult = WSAWaitForMultipleEvents(1, &hRecvEvent, FALSE, 0, FALSE);if (dwResult == 0) {//data is waitingwhile (dwResult == 0) {//loop until all pending data is receivedWSAResetEvent(hRecvEvent);const unsigned int nCurSize = tempBuffer.GetSize();Buffer partialBuffer;SocketReturn socketRes = pSocket->Receive(&partialBuffer, INTERPCMESSAGE_BATCHSIZE, &hRecvEvent);if (socketRes != SOCKETRETURN_FAILURE && partialBuffer.GetSize() != 0) {tempBuffer.Resize(nCurSize + partialBuffer.GetSize());tempBuffer.SetData(partialBuffer.GetBuffer(), nCurSize, partialBuffer.GetSize());}//retrieve result for Receive Event for next while loopdwResult = WSAWaitForMultipleEvents(1, &hRecvEvent, FALSE, 0, FALSE);}//now analyze buffer vectorif (pBufferVector->size() != 0) {//push back current buffer (now >= 2 buffers in vector)pBufferVector->push_back(tempBuffer);std::vector<Buffer>::iterator firstIt = pBufferVector->begin();//get first 4 bytes --> size of messageunsigned int nSize;firstIt->GetData(&nSize, 0, 4);unsigned int nTotalSize = 0;for (std::vector<Buffer>::iterator it = pBufferVector->begin(); it != pBufferVector->end(); it++) {nTotalSize += it->GetSize();if (nSize == nTotalSize) {break;}}if (nSize == nTotalSize) {//somewhere the sizes matched, this means that when we're going to add//all the buffers in the vector, we have a complete messageunsigned int nCounter = 0;for (std::vector<Buffer>::iterator it = pBufferVector->begin() + 1; it != pBufferVector->end(); it++) {const unsigned int nCurFullSize = firstIt->GetSize();const unsigned int nCurSize = it->GetSize();firstIt->Resize(nCurFullSize + nCurSize);firstIt->SetData(it->GetBuffer(), nCurFullSize, nCurSize);nCounter++;if (nCurFullSize + nCurSize == nSize) {break;}}//erase all used bufferspBufferVector->erase(pBufferVector->begin(), pBufferVector->begin() + nCounter);bTotal = true;return true;}bTotal = false;return true;} else {//check if current size matches total size, if so, do nothing//at all, otherwise push on vector stackunsigned int nSize;tempBuffer.GetData(&nSize, 0, 4);pBufferVector->push_back(tempBuffer);if (nSize != tempBuffer.GetSize()) {bTotal = false;return true;}bTotal = true;return true;}}bTotal = false;return true;}And this is the Receive function on my Socket:SocketReturn Socket::Receive(Buffer *pBuffer, unsigned int nBatchSize, WSAEVENT *pRecvEvent){//initialize variablesint nTotalReceived = 0;char *pCurBuf = new char[nBatchSize];int nReceived = 0;do {//receive datanReceived = recv(m_hSocket, pCurBuf, nBatchSize, NULL);if (nReceived > 0) {//connection wasn't closed (or nReceived should be 0)//resize buffer to store datapBuffer->Resize(nTotalReceived + nReceived);//store dataif (!pBuffer->SetData(pCurBuf, nTotalReceived, nReceived)) {delete [] pCurBuf;return SOCKETRETURN_FAILURE;}if (nReceived < int(nBatchSize)) {//got all datadelete [] pCurBuf;return SOCKETRETURN_SUCCESS;}//update total received variablenTotalReceived += nReceived;} else if (nReceived == SOCKET_ERROR) {//check if error was because socket would blockdelete [] pCurBuf;if (WSAGetLastError() == WSAEWOULDBLOCK) {return SOCKETRETURN_WOULDBLOCK;}return SOCKETRETURN_FAILURE;}} while (nReceived > 0);delete [] pCurBuf;return SOCKETRETURN_SUCCESS;}Buffer is a wrapper class for a data buffer that makes it easier for me to move data around.I really hope that somebody can help me out, because I'm stuck for a couple of days now.
Do not use "asynchronous" or "event" sockets in WinSock. Both models are inefficient and full of problems. Instead, use either good-old select(), or tie socket operations to an I/O completion port.; I just wished I heard that a bit earlier. I guess I'll be recoding the entire thing over the next couple of days, thanks for the info anyways!
What books did developer read for game development in the 1990s?
For Beginners
I want to make a game But I wonder how game developers worked in the 1990s, how they made games, how they learning before the Internet became as widespread as it is today. etc.how do they know how to build game mechanics as character ability power up system?how they know to reverse engineering game competitor company.what book I should read?
As far as I know (not being a programmer myself), books on the subject started appearing in the early 2000s. Up to that point, it was “learn by doing” and tips from one another. ;The first book that came to mind was Tricks of the Game-Programming Gurus: Lamothe, Andre, Ratcliff, John, Tyler, Denise: 9780672305078: Amazon.com: Books, which was geared toward beginners/students/amateurs. There were others, but that's the best selling pre-2000. After that point in time, game development became a hot topic in the book publishing world. Even GameDev.net has a series - Beginning Game Programming: A GameDev.net Collection (Course Technology Cengage Learning): 9781598638059: Computer Science Books @ Amazon.com.Otherwise, in the professional realm a lot was “learn by doing” as Tom said, or through word of mouth on early Usenet/IRC/websites (pre-GameDev.net in 1999 - see About GameDev.net). ;Computers in that era didn't have an OS like we have today. The machine booted, and you were dropped in a command shell or in an interactive BASIC interpreter. You basically programmed directly at the metal. Video memory was directly accessible, by writing in a known address range you could make pixels appear at the screen in various colors. The “OS” had a corner in the memory too for its data, but nothing prevented you from poking around there. Lua, Python, C#, C++ didn't exist, ANSI-C was just invented (K&R book about that was in 1989 iirc). Assembly language of course did exist (with books) and was used.Monthly computer magazines were published for all types of home computers. Tips and tricks were exchanged in that way, also program listings were printed in those magazines that you could then enter at your own computer. Studying those listings, and trying things for yourself is how you learned. There was also technical documentation about the computer.If you want to enjoy that stuff, today there is a retro-computing movement, that lives in that era, except with slight more modern hardware but still no OS, etc.;Alberth said:Computers in that era didn't have an OS like we have today.In the 1990s there was MSDOS, Several versions of Windows, and of MacOS. And that's not all the operating systems of the nineties, most likely.Like Linux, for instance.;Tom Sloper said:Alberth said:Computers in that era didn't have an OS like we have today.In the 1990s there was MSDOS, Several versions of Windows, and of MacOS. And that's not all the operating systems of the nineties, most likely.Like Linux, for instance.Yep. There were things like Windows 95, Win 98, and at the time I was still using a Commodore Amiga (AmigaOS) .To deal with the original question “what game dev books was I reading in the 90s?” Back in that era, one of my favorites was : The Black Art of 3D Game Programming by André LaMothe. ;Abrash was the guy who did the Windows NT graphics subsystem and worked on Quake.https://www.drdobbs.com/parallel/graphics-programming-black-book/184404919 ;There are a couple of" history of video games" books, that track the rise of the medium and genre.Just google for them. ;GeneralJist said:There are a couple of" history of video games" booksThat's not what the OP is looking for.;Thanks all
Choosing a career in AI programmer?
Games Career Development;Business
Hello everyone, my name is Ramon Diaz; I am currently studying Game development and programming at SNHU. I have taken the initiative to learn about a professional career in AI programming. I have a lot of gaps in my development in the short term. I have blueprint experience with AI but not enough to choose a career in this profession. I would like to know how I can be competitive leaving the university in 5 months after finishing my studies. I am looking for knowledge from all of you who have been in the industry for years.
Entry level? Know your algorithms, it will help you at interviews. If you have made demos it can help you get jobs, but the market is wide open right now and should be relatively easy to find work for the foreseeable future. Overall, it reads like you are on the right path. When you graduate and start looking for work, be open to any positions rather than just an AI specialty. Once you have a job it is easier to transition into whatever specialty you prefer.;Thank you. ;I would like to know how I can be competitive leaving the university in 5 months after finishing my studies.Talk about last minute. Create AI projects? Or A game with character behaviors? Pathfinding examples. Crowd movements. Anything really. Learn how navigation meshes work.;@dpadam450 Character Behavior is what I doing in the project at this moment. Everything related to AI programming.;@dpadam450 Is it the same when learning C++ in AI as visual scripting Blueprint? If I were to make a demo, what kind of programming should I focus on my attention? ;@frob It is important to have a portfolio? ;Not for programming. You will need to show you know how to do the work, but it is usually some interview questions and writing some code of their choice. If you have something you want to share with them, you can do it if you want. Having done fancy demos can sometimes help get interviews, and can help show your interest and abilities, but it is generally not needed. It does not hurt, unless you do it badly and therefore becomes a cautionary warning. Build it if you want. I have interviewed and hired bunches of programmers without portfolios. ;I'm studying AI at the moment, in terms of statistical learning. I've learned so much about AI over the past few weeks. Check out: https://hastie.su.domains/ISLR2/ISLRv2_website.pdf​andMachine Learning with R: Expert techniques for predictive modeling, 3rd Edition
Newbie desperate for advice!
Games Business and Law;Business
Hi allI'm new to the game development community and need some advice.I've created 2 educational games with a simple idea but are sufficiently challenging for all ages. These could be played on pcs or phones.Is it worth patenting any parts of the games?What would be the best way to monetize?How should I market the games?
hendrix7 said:I'm new to the game development communityReally? Your profile shows that you've been a member here since 2004, and your last activity was in 2007, asking about raycasting.hendrix7 said:Is it worth patenting any parts of the games?Probably not. Expensive and there will be hurdles, and possible lawsuits after the patent is granted (if it is).hendrix7 said:What would be the best way to monetize? How should I market the games?There are several threads here in the Business and Law forum about that. While you wait for more replies from the community, you can read up on those previous answers to those questions. Mainly, “you should have thought about that before you finished your games.” (You wouldn't be “desperate” now.) Good luck with your sales!;@hendrix7 Filing for a patent can be expensive, and you need to document the solution and how it separates from anything else. I have developed software that solved problems in a way that no other software does, but there is only a very small portion of that that can actually be patented. Even though you can file an application yourself, I would recommend hiring an experienced IP attorney. This too is very expensive, though, so you are best off doing this if this idea can provide millions in income. If it can't, then it's actually not that harmful if anybody copies it.You could look at registering trademarks, design and other parts of the games. This is cheaper, but it will protect you brand more than your idea or solution.Again, if this is something that could turn a real profit, it might be worth looking into. If not, it's a very costly waste of time.As for marketing - my day job is actually creating videos and commercials etc., so naturally that's the first thing that comes to mind.Make videos for social media or other platforms where your target audience is likely to see it. Oh, and you need to define a target audience. Know where they are, what they respond to, what their struggles are and how your product will solve their problems, enhance their life experience or in other ways contribute positively to their life.There are several other ways to do this, but the list exceeds my level of expertise in the area.;patenting is costly, and time intensive. As said above, it depends on a lot if it's worth it. ;@hendrix7 Nothing is worth patenting unless you're willing and able to defend your patent. There is no patent police; you're responsible for finding and prosecuting infrigement.What you're patenting has to be novel and non-obvious to a person skilled in the art. You called your idea ‘simple’ which makes me wonder if it's obvious or already in use.;@Tom Sloper Thanks TomI have been programming for a while but not games until now.Thanks for getting back and your advice, particularly patents.;@scott8 Thanks for your reply.I see. The play of the game utilises basic maths skills so I'm guessing it'll be difficult to identify anything that's unique. I suppose, in a similar way, it would be difficult to patent something like ‘Wordle’. Am I right?
Hi I'm new. Unreal best option ?
For Beginners
Hallo everyone. My name is BBCblkn and I'm new on this forum. Nice to virtually meet you 🙂. One of my biggest dreams is to make my own videogame. I love writing design as in text on how my dream game would be. Now I got no skills to create it. But who knows what life will bring. Is Unreal the best program to have fun with an experience ? Obviously I prefer a simple but capable program. Not pre designed auto drop. Why not install Unreal and roam into it and see if anything happens.My favorite games are in the genre of Fantasy, usually stone age with magic. Dota, Homm, Diablo and the odd one out is the genius Starcraft 1. But I played plenty of different games, especially when I way younger. I don't game currently at all but designing gets my creative juices flowing and is so inspiring and fun. Thanks for having me guys
BBCblkn said:My name is BBCblknI am truly sorry for you. Even Elons daughter has a better name than that.BBCblkn said:Is Unreal the best program to have fun with an experience ?Give it a try, but it's not meant for total beginners.Starting small always is a good idea. 2D is easier than 3D. You could try GameMaker, learn some programming language, learn some math, move on to more advanced engines like UE or Unity… ;There's honestly no perfect program for beginners. If I had to compare Unreal though at my skill level, I would probably pick Unity. However, It really comes down to your needs, and how much programming you want to learn. Furthermore, I would also keep in mind other engines.;@BBCblkn I'd recommend Gamemaker studio 2 as a first engine. It's easy to learn and I haven't had a problem making my game ideas in it yet.There are some good tutorials on YouTube to follow to learn it. Do note you'll be limited to 2D games with GMS2.Bit late to the post, but I hope it helps;gamechfo said:Bit late to the postTwo months late. Always consider whether you honestly believe that a question asked long in the past is still awaiting an answer. Thread locked.
How to publish a book?
GDNet Lounge;Community
Hello, So, over the holidays I finished my 1st book. Do any of yall writer types know where I can find:an editorpublisherIt's like 99% done, just need to know what to do next. Also, it's cross genre, so it doesn't necessarily fit the standard model.
You've given nowhere near enough information to get a final answer, but I can suggest next steps for you. (For background, I've worked as an author, co-author, editor, and ghostwriter on 9 books so far.)Publishing is a business deal. You need to figure out what business services you need.Do you even need a publisher? Do you need a distributor? You already mention needing an editor. Do you need marketing? Do you need retail agreements? Digital or physical? If physical, POD or offset, how many each of hard or soft, what size of print run can you afford? What business services do you need? Publishers have an awful lot of potential features of what they can provide and what those services cost.Once you know the list of services you actually need, your favorite bookstore will have books that have listings of all the major publishers and hundreds of minor publishers, along with the services they provide and the specialties they work with. Work through the listings methodically, and talk to them all until you've got a deal. You'll also want to start shopping around for a lawyer at that point, both because they have connections and because they'll be working with the contracts you'll be signing.Once you know what you need and have talked with your lawyer the first few times, you will be ready to start shopping around. It's far better if you have more money and are using the publisher as a paid service. That is, you pay them for the services they provide up front. It will cost you many thousand dollars but you'll require far fewer sales to reach profitability. It can be better to do an online plus POD service starting out if you're self funded. If they need to front any of the money there will be two phases to the deal, one phase before it's profitable and another after a threshold is reached and it's profitable. The exact terms will depend on your needs and the services they'll be providing. Before you sign with anyone, you'll need to work back and forth more than once with your lawyer to help you negotiate what's fair in the agreement. Good lawyers understand the costs of the various services and can help you get fair rates.Just like publishing games, the more you need from them the harder your pitch becomes. If you need a lot of services the more it will cost you. If you're looking for them to invest in you, front you money, and pay for the books, don't expect a lot of money from the deal, and in addition your pitch needs to be amazing and you'll be rejected many times. If you've got the money to self-publish and are only looking for retail agreements that's rather easy. ;hmmmWell Self publish might work too. I'm looking for:an editor publishing distribution for ebookNo hard cover or physical book planned at this timemaking cover art. Future Audio book production. I think that's it. I'd be willing to do physical print if needed, but I don't really want to pay for that at this time. frob said:You've given nowhere near enough information to get a final answer The issue is I don't know what questions or criteria I should be asking or looking for. ;Have you considered publishing with Packt?https://www.packtpub.com/;GeneralJist said:2. publishing distribution for ebook 3. No hard cover or physical book planned at this timeFor distribution of an ebook there are plenty of options. Amazon is the biggest with kindle direct publishing requiring little more than an html file and an image for the title. If you are comfortable with software tools you can use that same document to build/compile every other format out there. You're on the hook for everything else with the business if you go that route, but it can work well if you are marketing through your own channels.There are many ebook publishers out there targeting specific platforms and specific readers or specific genres. I mentioned publisher lists, they also include electronic-only publishers. Understand the tools they use against piracy are also helpful since otherwise anybody with access to the file can make unlimited copies.Be careful of contracts, you almost certainly want something that has a non-exclusive agreement since you've done all the work yourself already. If a publisher wants an exclusive deal they need to be putting quite a lot on the negotiating table.GeneralJist said:4. making cover art.Find an artist with the style you like and contact them. Often it's in the range of a couple hundred bucks, especially for ‘unknown’ artists when they're starting with something that wouldn't have seen the light of day otherwise. Artist friends are best, and asking around at local art schools is inexpensive.GeneralJist said:5. Future Audio book production.If you don't need it now, it's something easily done later.GeneralJist said:1. an editorThis one is the most difficult. Skilled editors are amazing. If you go with a publishing house they'll provide professional editors, at professional rates. ;taby said:Have you considered publishing with Packt?https://www.packtpub.com/hmmm 1st time hearing of them.Looks like they are more of an educational option?My book is a mix of mental health journey auto bio, and Sci Fi elements. It's not really a standard “how to” for game dev. ;so I just heard back from my 1st publisher submission.https://triggerhub.org/​And they essentially say they be willing to look at it deeper, and have extensive edits to focus on the mental health angle. but they would want me to cut a lot. From what they are hinting at, It sounds like they want to cut a lot of the Game dev and gaming journey, as they are a publisher focused on mental health.So, now I need to decide what to do.I sent them back an email saying I'm open to continued dialogue.Without knowing exactly what they want to cut, and edit, I don't know how to proceed.Also, would it be better to hold out, and find a publisher that is willing to accept most of the game dev journey, as I'm looking for a continued publisher to work with, aka accept most of the book as is. Any advice would be helpful.Thanks yall. ;GeneralJist said:Any advice would be helpful.Look into your own mind and heart.;hmmmok,So I've submitted to a few other places.We shall see.I submitted to this place called author House, and they got back to me really quick, but it looks like they want me to pay a couple thousand for a package:https://www.authorhouse.com/en/catalog/black-and-white-packages​I personally find that a bit frustrating.I mean, really, I wrote the book, I thought traditional publishers get paid from a % of sales?@frobWhat do you think?Is the above package a good deal?I was also a little put off, as it seems the person who called me didn't even read anything about my book, and asked me “so what's your book about?"beyond the above, how does this usually work? Edit: so, after a bit of basic research, it seems the above organization is a bit scamy. The hunt continues. ;You're unlikely to get a publisher deal, where the publisher pays you an advance and distributes your book to retail outlets.You'll have to self-publish, meaning you have to bear all the costs for printing, and nobody will distribute it for you. https://en.wikipedia.org/wiki/Vanity_press​
First-person terrain navigation frustum clipping problem
General and Gameplay Programming;Programming
I am trying to develop first-person terrain navigation. I am able to read a terrain and render it as well as to move around the terrain by interpolating the location of the camera every time I move around. The main problem I have is that depending on the terrain, i.e. moving on a sloping terrain, the near plane clips my view (see below). What is the best way to avoid this? Presumably, I can interpolate the heights for the bottom corners of the near plane … any help would be appreciated.
I believe this can aways be an issue. I mean if you are clipping to a near plane and that plane passes through geometry, it has to do something. That being said you technically don't have to clip to a near plane at all, however many graphics APIs require it. Another other thing to consider is once you have collision working, you can put your camera, including your near clipping plane inside a collidable object, for instance a sphere, such that this problem will never occur. If you are eventually going to make this a real first-person game, that should take care of the problem since your camera will be inside the players head. Even in a 3rd person game you can put them inside a floating sphere. ;Gnollrunner said:That being said you technically don't have to clip to a near plane at all, however many graphics APIs require it.The near clip plane is always needed, even if you use a software rasterizer. If you don't do the clipping, vertices would flip behind the camera, causing glitches way worse than what we get from clipping.mllobera said:What is the best way to avoid this? Presumably, I can interpolate the heights for the bottom corners of the near plane … any help would be appreciated.Yes, basically you want to ensure that the camera is in empty space (above the hightmap), not in solid space (below the heightmap).But in general you can not treat the camera as a simple point, because the front clip plane requires a distance larger than zero. So ideally you build a sphere around the camera which bounds the front clip rectangle of the frustum, and then you make sure the sphere is entirely in empty space, for example. In the specific case of your terrain not having too steep slopes however, it should work well enough to sample height below camera, add some ‘character height’, and place the camera there. That's pretty simple and usually good enough for terrain.It's quite a difficult problem mainly for 3rd person games in levels made from architecture. It's difficult to project the camera out of solid space in ways so the motion still feels smooth and predictable.Some games additionally fade out geometry which is too close, attempting to minimize the issue.Imo, the ‘true’ solution to the problem would be to let the clipping happen, but rendering the interior volume of the geometry as sliced by the clipping plane.That's pretty hard with modern rendering, which usually lacks a definition of solid or empty space. But it was easy to do in the days of Doom / Quake software rendering. When i did such engine, it was possible to render clipped solid walls in simple black color. This felt really robust and not glitchy, so while it does not solve all related problems, i wonder why no game ever did this. ;@undefinedJoeJ said:The near clip plane is always needed, even if you use a software rasterizer. If you don't do the clipping, vertices would flip behind the camera, causing glitches way worse than what we get from clipping.You can clip to a pyramid instead of a frustum. I used to do this many years ago on old hardware. So there is no near clipping plane. In fact you don't need a far clipping plane either.Edit: Just wanted to add as far as I know the near and far clipping planes mostly have to do with optimizing your Z resolution. If you are dealing with that in other ways, I think they aren't strictly necessary. I currently don't even deal with the far plane and let LOD solve Z-fighting issues.;Gnollrunner said:You can clip to a pyramid instead of a frustum.I see. You still have front clip. It is a point, formed indirectly as the intersection of the other other frustum planes.I've misunderstood your claim to be ‘you don't need a front clip’. But you didn't say say that. Sorry. But now i'm curious about the experience with z precision you have had. I guess it just worked? Which then would probably mean: All those painful compromises of ‘make front plane distant so you get acceptable depth precision for large scenes’, are a result of a bad convention being used by APIs?Or did you use no z-Buffer? ;@undefined My whole engine is based on aggressive LOD and culling. I don't do projection in the matrix. It's a post step. My Z coordinates are world distances. My current project does have a near clipping plane mainly because DirectX wants one, but it's not that relevant for my application.;Ah, so you use the pyramid for culling only. But for rasterization, the usual front clip plane at some distance i guess.Still an interesting question if ‘some distance’ is really needed, but i guess yes.I did some experiment about point splatting. It uses spherical projection, which is simple than planar projection:auto WorldToScreen = [&](Vec4 w){Vec4 local = camera.inverseWorld * w;if (local[2] < .1f) return (Vec3(-1)); // <- front clip at some distance of 0.1Vec3 screen = (Vec3&)local;screen[2] = length(screen); // if it was zero, i'd get NaN herescreen[0] = (1 + screen[0] / (screen[2] * camera.fov)) / 2;screen[1] = (1 + screen[1] / (screen[2] * camera.fov)) / 2;return screen;}; Planar projection would cause division by zero too, i guess.;Thanks for all your comments! I will need to investigate how to do what Gnollrunner proposed (about putting the camera inside of a sphere). ;This may be obvious, but in case it helps:Let me note that, as a first-person camera may be more likely than a third-person camera to draw very close to geometry, it likely makes some sense to have a smaller near-plane distance for the former than the latter.Now, this only ameliorates the problem, it doesn't remove it entirely: it means that the problem will still appear, but only if the player gets very close indeed to a surface. It's intended to be used in conjunction with one or another means of preventing the camera from approaching quite so near to a surface (such as the sphere-approach mentioned by others above).;Thaumaturge said:This may be obvious, but in case it helps:Let me note that, as a first-person camera may be more likely than a third-person camera to draw very close to geometry, I'm not sure that's so true. I mean in both cases you have to take care of the problem somehow. The case of a first-person camera is a bit easier because it should always be in the collision boundary of the player (sphere(s), ellipsoid, capsule etc.). As along as the near plane is also within that boundary, the problem should never occur. So if you have a 10cm radius sphere and put the camera in the back of it, that gives you maybe a 10 to 15 cm camera to near clipping plane distance to play with depending on the field of view you are going for. With a 3rd person camera, you can also get very close to terrain, in fact your camera can end up within terrain or some object if you don't do anything to solve that problem, and this will happen very often without separate camera collision. One typical way to handle this is just implement your following camera, ignoring terrain considerations. Then to figure out your camera's actual position, project a line back from the head of the avatar to the camera's ostensible position, and see if it intersects anything to get the camera's true position. In reality you should project a cylinder and not a line since your camera will need its own bounding sphere to contain the near clipping plane. In any case this means that as you move around your camera can jump forward to clear terrain and objects. I've seen this in a few MMOs. However, when you leave blocking terrain you have the option of implementing smooth movement back to the cameras desired location. If you want to get really fancy, I guess you could try to predict when your camera will need to jump forward ahead of time and try to do smooth moment forward too. Maybe you can have a second camera bounding sphere which is somewhat larger, that would trigger smooth movement, but I think you would still need a fallback camera jump routine to be safe.
strange speed problem
For Beginners
I was tinkering with code for an SFML C++ project and suddenly everything except my avatar started moving extremely slowly. I looked at the performance tab and I had plenty of memory and cpu. I tried for hours removing everything and starting and stopping the program but nothing would speed it up. I didn't notice anything else strange happening. I got home and started it up again and it was back at full speed. What could have caused this?
Could you tell us what was running slow?if it was your computer, just try a restart your computerif it was your IDE, first try to restart the IDE, else: restart your computerassainator
[.net] vb.net logger question
General and Gameplay Programming;Programming
heey all,At the moment i have a logger* in my program. (* I don't know what it name is, it writes all actions to a file.)The only problem is: The data is only written to the file when it is closed properly. (streamWriter.close() (replace streamWriter with var name)) This is done when the application is end's as it should. But when the app crashes, the data is not written to the file and I can't find out what happend.my codePublic Class Logger Private _LogMessages As ULong = 0 Private stream As IO.StreamWriter Public Sub OpenLog(ByVal file As String) stream = New IO.StreamWriter(file) End Sub Public Sub CloseLog() stream.Close() End Sub Public Sub Write(ByVal msg As String) If _LogMessages < 1000000 Then stream.Write(msg) _LogMessages += 1 End If End Sub Public Sub WriteLine(ByVal msg As String) If _LogMessages < 1000000 Then stream.WriteLine(msg) _LogMessages += 1 End If End SubEnd Classin the app it would be used as:1. when the app start's the first thing it does is opening the log.2. the app is in the main loop and does what it should do, logs everything3. the app quit's and closes the logger.But if the app crashes the 'stream' is not closed properly so the data is not written to the file.the question get's down to:What can i do to make sure the filestream is closed properly even if the app crashes?thanks in advance,assainator
First quick answer:Use the Flush method after each Write. That will solve your problem.Second answer:Have a look at the Tracing classes in .NET. There is a class that will do all of this for you by simply configuring it. ; Another solution is to use exception handling, by using the Try/Finally statements:logger = New Logger()Try ' Main application code here - try to enclose as much of it as possible ' by wrapping it as close to the entry point as possibleFinally logger.CloseLog()End Try.. or implement IDisposable and use the Using statement:Using logger As New Logger() ' Main application code here, as aboveEnd Using; Thanks for all input, I have it working now.assainator
[Solved]My model is rendered one half from the front and the other half from the back
For Beginners
Hi i made a human face and when i render it i saw one half of the face from the front and the other half from the back, here is a capture changing from z to -z the eye vector:http://img696.imageshack.us/g/57765909.png/[Edited by - jor1980 on December 28, 2009 5:09:32 PM]
Are the normals on half the head reversed? Possibly during mirroring? ;Quote:Original post by DerangedAre the normals on half the head reversed? Possibly during mirroring?In my FVF i didn´t use normals, here i leave you the code to you to see if there are something wrong.Imports Microsoft.DirectX.Direct3DImports Microsoft.DirectXPublic Class Form1 Private device As Device Dim verticest As CustomVertex.PositionTextured() = New CustomVertex.PositionTextured(1398) {} Dim indices As Short() = New Short(7991) {} Public Sub Initialize() Dim Present As PresentParameters = New PresentParameters Present.Windowed = True Present.SwapEffect = SwapEffect.Discard device = New Device(0, DeviceType.Hardware, Me.Handle, CreateFlags.SoftwareVertexProcessing, Present) device.RenderState.Lighting = FalseEnd Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Text = "DirectX Tutorial using Visual Basic" Me.Setstyle(Controlstyles.AllPaintingInWmPaint Or Controlstyles.Opaque, True) Initialize() Dim nºarchivo As Integer = FreeFile() FileOpen(nºarchivo, My.Computer.FileSystem.SpecialDirectories.Desktop & "\cara.3d", OpenMode.Input) For i = 0 To 1398 Dim dato As String dato = LineInput(nºarchivo) Dim Datoparts As String() Datoparts = Split(dato, " ") verticest(i).SetPosition(New Vector3(NumerosDecimales(Datoparts(0)), NumerosDecimales(Datoparts(1)), NumerosDecimales(Datoparts(2)))) verticest(i).Tu = (NumerosDecimales(Datoparts(3))) verticest(i).Tv = 1 - (NumerosDecimales(Datoparts(4))) Next For i = 0 To 2663 Dim dato As String dato = LineInput(nºarchivo) Dim Datoparts As String() Datoparts = Split(dato, " ") indices(3 * i) = Datoparts(0) indices((3 * i) + 1) = Datoparts(1) indices((3 * i) + 2) = Datoparts(2) Next End Sub Private Sub Form1_OnPaint(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Me.Paint device.RenderState.CullMode = Cull.None device.RenderState.FillMode = FillMode.Solid device.Clear(ClearFlags.Target, Color.Black, 1, 0) Dim imagen As New Bitmap("C:\Users\Jorge\Desktop\fernando.png") Dim textura As New Texture(device, imagen, Usage.Dynamic, Pool.Default) device.MultiplyTransform(TransformType.Projection, Matrix.PerspectiveFovLH(Math.PI / 4, _Me.Width / Me.Height, 1, 100))device.MultiplyTransform(TransformType.World, Matrix.LookAtLH(New Vector3(0, 0, -8), New Vector3(0, 2, 0), New Vector3(0, 1, 0)))device.BeginScene() device.SetTexture(0, textura) device.VertexFormat = CustomVertex.PositionTextured.Format device.DrawIndexedUserPrimitives(PrimitiveType.TriangleList, 0, 1399, 2664, indices, True, verticest) device.EndScene() device.Present() End Sub ; I don't know if it is enabled by default, but is depth test enabled? ;Quote:Original post by fcoelhoI don't know if it is enabled by default, but is depth test enabled?All i did is in the previous code, i don´t know how to solve this ; Even if you don't use per-vertex normals (as in lighting), the hardware still calculates face normals for your triangles for the purpose of backface culling. When you have mirrored your geometry, the winding order (counterwise or counterclockwise vertices) of the triangles has mirrored accordingly and thus their geometric normal points in the opposite direction from what you'd expect. As a quick fix, try disabling backface culling. The long-term fix is to fix your model so that the winding order of your triangles is consistent.Most modeling programs automatically correct the winding order for you when you use a "mirror modifier" (exact name varies). Either your program doesn't, or you used some kind of negative scaling modeling technique that didn't capture the intent of the modification (for example, mirroring only vertex positions). ; As a separate note, it is a very bad practice to hard-code stuff like the number of indices and vertices. Instead, determine such values from the model file. This way, when the file changes, your code will not break. There are other problems with your code structure as well, but I don't iterate them here unless you want me to.Also, Managed DX is effectively dead. I recommend using SlimDX to replace it, seeing as you use VB. ;Quote:Original post by Nik02As a separate note, it is a very bad practice to hard-code stuff like the number of indices and vertices. Instead, determine such values from the model file. This way, when the file changes, your code will not break. There are other problems with your code structure as well, but I don't iterate them here unless you want me to.Also, Managed DX is effectively dead. I recommend using SlimDX to replace it, seeing as you use VB.Of course you can tell me all my faults, i want to learn and thats the way.The reason i use managed directx is because slimdx seems to be a little bit diferent froma managed directx, and i tried to make the same program on slimdx and i can´t see anything in the screen ; I'll get back to you about the code tomorrow, as I need to sleep for a while now [smile]In the meanwhile, apply my quick fix by setting the cull render state to "none".Also, fcoelho was correct in that you don't use depth buffering. For anything but the most simple of meshes you do want to use it. It can be enabled by setting the AutoDepthStencil and DepthStencilFormat fields of your present parameters structure to appropriate values. If you do enable it, be sure to clear the depth buffer in addition to the ordinary color buffer when you call Clear.You shouldn't give up on SlimDX so easily. While the syntax is a bit different than MDX (as SlimDX is closely modeled after native DX), the underlying concepts of drawing stuff to the screen are exactly same. And if you do your coding with the DX debug systems running, you can get very accurate info as to why something doesn't work.Also, there's no guarantee that MDX still works on newer versions of Windows. I haven't tested it on "7" but I wouldn't be surprised if it ceased to initialize out of the box. ; Okay, here's my analysis of your code in general, and recommendations on how to fix the flaws. I don't drill very deep on the issues; for that, I recommend reading relevant articles from MSDN. If I sound harsh here, it is unintentional. My goal in this post is to help you.VB usage/coding style:-You have defined all the functionality in one module, Form1. To reap the benefits of the object-oriented paradigm, you should divide your functionality into classes - for example, a Mesh class which has member functions Load(fileName as String, parentDevice as Direct3D.Device), Render() etc. (for example). This way, you don't have to search thru a lot of irrelevant code everytime you change something. This approach has a lot of other benefits too, but listing them would require a whole book.-FreeFile and FileOpen are deprecated functions, they are only provided for backwards compatibility with older versions of Visual Basic. Consider using the stream classes to do your file handling - in addition to reading actual disk files, you can use network or memory streams instead for no additional work. Also, the stream classes have additional functionality such as asynchronous processing.-You don't do any error checking whatsoever. You should check that a file open operation succeeded before reading data off it, and that a D3D device was successfully initialized before you send requests to it. If something goes wrong, your code will crash as it is. With proper error handling, you can gracefully handle the exception conditions. A D3D device can be especially crash-prone and cause blue screens upon exceptions, since it is only a relatively thin layer between your program and the hardware.D3D usage:-Usually, rendering is done on the idle time of the application instead of the OnPaint handler - that is, everytime the app's Windows message queue is empty, render. Google for "d3d message pump vb" for a proper implementation. Of course, if it is enough to paint the screen less often (such as in a chess game, for example), OnPaint can be fast enough.-You don't seem to call Device.SetTransform anywhere in the code. MultiplyTransform multiplies the previous transform of the device with the new transform you provide, so the effect will be cumulative. This is usually not what you want. In your case, I could imagine that the side effects of MultiplyTransform cause your model to zoom away from the screen everytime you render, since you multiply the view and projection matrices by their previous values.-Consider using vertex and index buffers to feed your geometry to the hardware. User primitives are not optimal since the device cannot allocate them statically for best performance, and you will upload the geometry every time you call the drawing function.-You should release all device resources upon exiting your app. Otherwise, your app can cause memory leaks as the system cannot determine which objects it can unload from memory and/or release physical device resources from.-Use the D3D debug runtime when developing apps. Seriously. If you don't know how, read up on MSDN. It is time well spent.General best practices:-You are re-loading and re-creating your texture every single frame. This destroys your performance, and it can't be good for your hard drive either in the long run.-As I said previously, it is a bad practice to hard-code any values to your files. In your case, the number of vertices and indices should be read from the model file itself. Also, you should store material settings (and other related stuff) or at least references to them in the model file. From your code, I can deduce that the file format is too simple for this kind of robust handling, so consider defining a file format that can store all the data, or use a well-known file format. Obj format is pretty close to your current format.-Don't hardcode file paths. Even though SpecialDirectories.Desktop is technically not a hard-coded path, wouldn't it make more sense to store your resources relative to the executable path?-In general, in my opinion VB isn't the greatest language for game development. However, the priority should be in getting stuff done. If you know the language well, do keep using it but consider learning C-style languages as well. Native D3D development is done in C++, and it is the thinnest possible interface between your app and D3D.Consider this list as a summary, not a comprehensive list of all possible issues.I hope this helps!
Visual Studio Macros for the Game Programmer
Old Archive;Archive
Comments for the article Visual Studio Macros for the Game Programmer
Excellent article, very useful and inspiring. Thank you! ; Nice introduction to Visual Studio Macros. I've never done anything with them before but I'm really planning to after reading this article.I just tried your example:Sub Signature() Dim sel As TextSelection = DTE.ActiveDocument.Selection sel.Insert("MikeCline ") sel.Insert(Format(Date.Today, "MMM dd yyyy")) sel.Insert(".")End SubI noticed that when you want to undo this, VS will undo every Insert call and not undo it at once. So my tip is that you probably want to insert that text at once so it's easy to undo.Sub Signature() Dim sel As TextSelection = DTE.ActiveDocument.Selection Dim str As String str = "MikeCline " + Format(Date.Today, "MMM dd yyyy") + "." sel.Insert(str)End SubNice article. ;Quote:Original post by WalterTamboerNice introduction to Visual Studio Macros. I've never done anything with them before but I'm really planning to after reading this article.I just tried your example:*** Source Snippet Removed ***I noticed that when you want to undo this, VS will undo every Insert call and not undo it at once. So my tip is that you probably want to insert that text at once so it's easy to undo.*** Source Snippet Removed ***Nice article.Thats a good tip. I found the same problem with macros that someone else has written. ; Amazing... I never thought of doing any of this, great article. ;Quote:Original post by DaveQuote:Original post by WalterTamboerNice introduction to Visual Studio Macros. I've never done anything with them before but I'm really planning to after reading this article.I just tried your example:*** Source Snippet Removed ***I noticed that when you want to undo this, VS will undo every Insert call and not undo it at once. So my tip is that you probably want to insert that text at once so it's easy to undo.*** Source Snippet Removed ***Nice article.Thats a good tip. I found the same problem with macros that someone else has written.If you want to have the undo feature remove the changes your macro made all at once, you can open an UndoContext around your macro changes, then close the UndoContext afterwards. Then, when you perform an undo, it will remove everything at once. Like so: Public Sub InsertLineComment() Dim name As String = "KJF" Dim selection As TextSelection selection = CType(DTE.ActiveDocument.Selection, TextSelection) If (Not DTE.UndoContext.IsOpen()) Then DTE.UndoContext.Open("KJF Insert Line Comment") End If selection.EndOfLine() ' Go to the end of the line to insert the comment Dim comment As String comment = "//" + name + " " + Date.Now.ToString("dd-MM-yyyy") + " - " selection.Insert(comment) If (DTE.UndoContext.IsOpen()) Then DTE.UndoContext.Close() End If End Sub;Quote:Original post by DorvoThen, when you perform an undo, it will remove everything at once.Ah :) That's even better! Thnx. ; Another thumbs up for this informative article :-) Definitely I can find some use for them.I also have a snippet here to share, for trimming of trailing whitespaces, which is missing from VS. It is basically just a replace all using regexp.Dim textDocObj As TextDocument = DTE.ActiveDocument.ObjecttextDocObj.ReplacePattern( "[ \t]+\n", ControlChars.NewLine, vsFindOptions.vsFindOptionsRegularExpression)I've the full macro implementation on my page if anyone's interested. ; Great article! opened a door I hadn't even considered. Thank you. ; Nice job. But your first example, switching between header and source file, is sort of built in. Visual C++ 2005 express, no add-ins that I remember, and if I right click on a source file there is a Go To Header File option. There doesn't seem to be an equivalent for going from header to source though.
sfml mouse coordinate problem
For Beginners
heey all,lately i was trying to use the mouse more in my app. I use sfml to handle input, graphics and display.i'm using the following code, the X code display's properly, tough the Y code stays at 512. even stranger is that the windows is only 500 pixels high.....int main(){//create a SFML windowsf::Window App(sf::VideoMode(500, 500, 32), "gameUI test");//set opengl coordsystemglOrtho(-250.0f, 250.0f, -250.0f, 250.0f, 2.0f, -2.0f);//prepare openGL depthglClearDepth(1.f);glClearColor(0.f, 0.f, 0.f, 0.f);//enable depthbuffer use (wich we don't use)glEnable(GL_DEPTH_TEST);glDepthMask(GL_TRUE);//prepare for 3d usage(but we only use 2d)glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective(90.f, 1.f, 1.f, 500.f);//while the app is runningwhile(App.IsOpened()){//get eventssf::Event Event;while(App.GetEvent(Event)){//if escape is pressed, exitif(Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::Escape){App.Close();}else if(Event.Type == sf::Event::Closed){App.Close();}//if the mouse moves, output coordselse if(Event.Type == sf::Event::MouseMoved){printf("X: %i, Y: %i\n", Event.MouseButton.X, Event.MouseButton.Y);}}//make the window the current render window (for use in multiple windows (wich we don't use))App.SetActive();//clear buffersglClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);glLoadIdentity();//display all changesApp.Display();}return 1;}does anyone know what i'm doing wrong?thanks in advance,assainator
Looks like you're using the Mouse Button field of the Event, when you should be using the MouseMove field. ; Thanks, that solved the problem.assainator
Render to texture Reply Quote Edit
Graphics and GPU Programming;Programming
Hi guys,I'm new to DirectX, and now i have to render some scene to a texture, and then i will have to work with these texture.I have try to write a function to render a simple Box to a texture. Then i will use this texture to render the box again, using the texture above to this new BoxThis is my code<CODE>void RenderTheBlocker(IDirect3DDevice9* pd3dDevice,float fElapsedTime,ID3DXMesh* mBox) {HRESULT hr; hr = D3DXCreateTexture( pd3dDevice,RENDERTOSURFACE_WIDTH,RENDERTOSURFACE_HEIGHT,1,D3DUSAGE_RENDERTARGET,D3DFMT_A8R8G8B8,D3DPOOL_DEFAULT,&g_pDynamicBlockerTexture ); // //g_pDynamicTexture D3DSURFACE_DESC desc;g_pDynamicBlockerTexture->GetSurfaceLevel( 0, &m_pTextureSurface );m_pTextureSurface->GetDesc( &desc ); hr = D3DXCreateRenderToSurface( pd3dDevice, desc.Width, desc.Height, desc.Format, TRUE, D3DFMT_D16, &m_pRenderToSurface ); m_pRenderToSurface->BeginScene( m_pTextureSurface, NULL );pd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE(0.0f,1.0f,0.0f,1.0f), 1.0f, 0);pd3dDevice->SetTransform( D3DTS_PROJECTION, g_LCamera.GetProjMatrix()); //g_matProjection_offscreenSurfacepd3dDevice->SetTransform( D3DTS_WORLD, g_LCamera.GetWorldMatrix()); pd3dDevice->SetTransform(D3DTS_VIEW,g_LCamera.GetViewMatrix());mBox->DrawSubset(0);m_pRenderToSurface->EndScene( 0 ); //Testpd3dDevice->Clear( 0, NULL, D3DCLEAR_TARGET | D3DCLEAR_ZBUFFER, D3DCOLOR_COLORVALUE(0.0f,0.0f,1.0f,1.0f), 1.0f, 0 ); pd3dDevice->BeginScene(); pd3dDevice->SetTransform( D3DTS_PROJECTION, g_LCamera.GetProjMatrix()); pd3dDevice->SetTransform( D3DTS_WORLD, g_LCamera.GetWorldMatrix() ); pd3dDevice->SetTransform( D3DTS_VIEW,g_LCamera.GetViewMatrix()); pd3dDevice->SetTexture( 0, g_pDynamicBlockerTexture); mBox->DrawSubset(0);pd3dDevice->EndScene();pd3dDevice->Present( NULL, NULL, NULL, NULL ); } </CODE>When i run this, it only appear a blue scene. No box at allCan anyone help me with this?
1. If you render the box mesh to the screen, rather than to a texture, does it render correctly?2. Do you set the viewport somewhere other than the posted code?3. Do you create the normal render buffer using D3DFMT_A8R8G8B8 also? ; I figured out my mistake when i created D3DXCreateRenderToSurface inside this function. Thanks anyway :)
2D diagram
Graphics and GPU Programming;Programming
I'm not developing a game, but I haven't been able to get a satisfactory answer elsewhere and I figure this is where the graphics experts are.I need to display a large number (thousands or tens of thousands) of points in 2D space with lines connecting pairs of points. The user needs to be able to zoom (preferably "infinitely"), with the points behaving dimensionlessly and the lines behaving one-dimensionally (i.e. zooming in, the ellipses representing points get farther apart but don't get bigger, and the lines get longer but not thicker). The user also needs to be able to scroll.I tried doing this in GDI+ (iterating through a linked list of ellipses, drawing one at a time) but it was way too slow. You'd have to wait for several seconds for all the points to reload after clicking a scroll button. Drawing to bitmaps first, then displaying a bitmap solves the laggy scrolling problem but makes zooming tedious and only allows a fixed number of zoom levels. I'm guessing OpenGL or DirectX is needed.Can someone point me towards the right API and techniques?How are these problems solved in CAD or GIS applications?Are there any relevant books?The next thing I'm planning to try is OpenGL with Qt, if anyone can comment on that.Thanks a lot for your help.
(thousands or tens of thousands) is n't a big number for 3D rendering, but OpenGL doesnot support 2D rendering originally. If you are sticked to OGL, you can try to extend any of the open src 3D engines. It would take several thousands of lines.With Win Vista/7, maybe You can try the Direct2D. I just read a little of that. It's easy to use and should be of high performance. ; You need to re-think things just a bit. You need two things to do this efficiently; a spatial partitioning system, and a view-oriented rendering system instead of a world-oriented one.First look up "quadtree". You want to put your points and lines into the quadtree, and when you render an area from the tree you want to query the tree for all points and lines that intersect with the view rectangle. This is very fast because of how a quadtree works; you only draw those lines and points that are going to be visible (more or less).Second, once you have that information, you know the exact screen-space dimensions you want your points and lines to have, so just render them that way. Don't think of them being of a certain size in world-space; this is in fact probably exactly what you're doing right now, you just haven't noticed that zooming to any scale except 1:1 will produce separate view, screen, and world spaces, where you currently seem to be thinking in only world space.Edit: Oh, and also; linked lists are generally for data sets that need frequent add/remove operations at arbitrary locations, but get fully iterated or searched only infrequently. Try using vectors or other dynamic-sizing array replacements.
Adding a road to terrain
Graphics and GPU Programming;Programming
How would you go about adding a road to a terrain generated with a heightmap? i tried just creating some triangles and adding a road texture to it, but because my road coordinates are singles(or floats in c#) it can be places anywhere so the terrain pokes through it in some places... I also tried drawing to a texture and adding roads to that texture, then drawing the terrain texture from that texture, but it ends up gettin shinked and mirrored :S and help would be great!
C++ Book
For Beginners
I was wondering what book I should read next after C Plus Plus for Dummies? I am currently reading it and it is a rather confusing book, even with Basic experience. Any advice would be appreciated.
From personal experience, I wouldn't recommend the Dummies books. My Dad was a director (retired recently) at the company that publishes them. He agreed with me over Christmas dinner that they weren't very good (although I guess it depends on the author).I am in a similar position to you on the experience front. I am currently reading 'The C Programming Language' by K&R. According to reviewers on Amazon the equivalent C++ book, written by Bjarne Stroustrup (creator of C++), isn't the easiest thing to read and isn't a great start for beginners. Now, I know you shouldn't blindly go on the opinion of others, but the reviews on Amazon have yet to let me down.My 2 pence. ; I would highly recommend switching to Thinking in C++ or C++ Primer Plus 5th edition. You can get Thinking in C++ free online at the authors website.Thinking In C++ 2nd edition; Bjarne's book is working for me. The only complaint I have is it drags in some areas (since I already have some experience but can't skip ahead due to chapters building on each other) I'm sure the extra detail will be useful sometime in the future. In other words, some parts will be repetitive but things are explained in depth and simple to understand. ; I'm learning from Sams Teach Yourself c++ in 21 Days. So far I've found it to be really good. I think The c++ workshops for beginners here on gamedev are based on it.The only thing I don't like about it (so far) is that the book teaches object-oriented programming before even getting into basic loops. I guess I just think classes should be left until more basic things have been covered.It's a pretty sizeable book, so get ready for some heavy reading lol. It's roughly 900 pages. ; I'm learning from Sams Teach Yourself c++ in 21 Days. So far I've found it to be really good. I think The c++ workshops for beginners here on gamedev are based on it.The only thing I don't like about it (so far) is that the book teaches object-oriented programming before even getting into basic loops. I guess I just think classes should be left until more basic things have been covered.It's a pretty sizeable book, so get ready for some heavy reading lol. It's roughly 900 pages. ; I wouldn't recommend Bjarne's book for a starting point to learn C++, but I would recommend that you read it eventually. It's one of the best ways to "make sure" you have a solid grasp of the language. ; c++ Primer PLus 5th edition prata
Color Theory Final
GDNet Lounge;Community
Hi, I need your guys help for a color theory final. I have a survey about Game art covers and what kind of emotion they invoke in you, and how the difference might correlate with Rated everybody and rated mature games.It would really help me out :)Part 1:http://www.surveymonkey.com/s/6ZY8HHYPart 2:http://www.surveymonkey.com/s/6ZMBNGDThanks!
Any takers are much appreciated! ; So as a survey taker should I be basing my emotional response only on the colors or on the subject matter and content as well? I tried to just stick to colors during the first survey but I know I have a tendency to look at subject and content just out of habit which may easily bias my opinion. As well, some of these games I have played while others I have not. This may in fact dictate my emotional resaponse far more than anything else. For example, I tend to mark 'other' for games I have never played as a picture on a box isn't enough information for my jaded and cynical personality to make a decision ;)I also think the choices seem rather limited. There is no 'excited', or 'uninterested' choice. ; Well, honestly, you can vote based on whatever context you feel appropriate. It probably should be based on color, but I dont' care to much! out of all of my classes, this one has the most difficult final.But thank you for taking the time to fill it out ; There's a picture of around 30 box art covers for video games and everyone is blue and gold. It's becoming a very common color. Normally blue on the top and gold on the bottom. I'd have to search for the image again though.[Edited by - Sirisian on December 14, 2009 9:49:43 PM]; Bump. I finally found that image randomly. I guess it has movies in there too.; Maybe it's due to the opponent-process theory where yellow and blue are opposites, thus creating more contrast as a bluish-yellow does not seemingly exist? ;Quote:Original post by SirisianImage SnippedDonkey Punch...the movie! WTF???;Quote:Original post by cyansoftQuote:Original post by SirisianImage SnippedDonkey Punch...the movie! WTF???the best part is that it is what you think it is.
How to design a pseudo 3d game?
For Beginners
Currently, I'm making a 2d platform game in C++ with Box2d for physics.I have an EntityManager class, which is basically an entire instance of the game encapsulated. In addition to updating and drawing entities, it transforms input into commands for the player, plays music, saves the game, etc. When the player enters a new room, the EntityManager deletes all existing entities except the player, loads the entities of the new room, and then adds the player back.However, one of my level concepts requires major changes to this design. I'm trying to figure out the best way to redesign my game.I want the game to occur in multiple planes in a sort of 3d effect. Entities can be swapped between the planes but otherwise, the physics on each one happens independently.I guess what I want is pretty similar to the game Time Fcuk.So how can I redesign my game to make this effect possible? I'll probably need a different b2World instance for every plane of every level, as well as a separate list of entities, but I have no idea how to accomplish the swapping.I was also thinking of trying to decouple the entity groups from the game instance, so that I could preload the group of entities associated with a room to speed up room transitions. But the problem is that the entities need access to the game instance so that they can use callbacks to save the game, play sounds, unlock secret items, etc.
Draw on texture in HLSL
For Beginners
Im new to xna and dont understand some of it so bare with me :P i have a project where i need to draw a road on some terrain. i tried just creating some triangles with a road texture but it didnt work very well because the terrain would poke through in some places, so i decided the best approach would be to draw the road right onto the terrain. i tried setting the render target to a texture and drawing the terrain and road to that, and then setting the terrain texture to that texture... but it didnt work. I want to know if its possible to draw the road to the texture in the HLSL code, and if it is i would like to know how. Any help would be awesome!
Retrieving Window UI graphical components
General and Gameplay Programming;Programming
I'm doing a gpu accelerated ui interface and I want some of the controls to have the same feel as the current Windows theme. I'm wondering how I can do this, or how I can get the images that Windows uses to draw its user interface.
This article should shed some light on the question [smile]
Hex Numbers... O_o
For Beginners
Hex numbers go 0 1 2 3 4 5 6 7 8 9 A B C D E F 10 11 12 13 14 15 16 17 18 19 1A 1B 1C 1D 1E 1F 20 21 22 23 24 25 26 27 28 29 2A 2B 2C 2D 2E 2F But after 9, what numerical values do the letters have? Is it going 10, 11, 12, 13, 14, 15, 10, 11, etc?
Yes, 0x0A (base 16) equals 10 (base 10); Hex -> Decimal system conversion table:A -> 10B -> 11C -> 12D -> 13E -> 14F -> 15But 10 in hexadecimal means (1 * 16 + 0)=16 in decimal system thus SIXTEEN.The same for 11 in hexadecimal that is (1 * 16 + 1)=16 in decimal system thus SEVENTEEN.In hexadecimal (and also in binary or octal systems) you should read each digt/letter by itself starting from left.To convert hexadecimal values to decimal numbers you just have to sum all digits/letter multiplied each for a 16 factor (2 in binary, 8 in octal) power by position (0 is power of most right digit/letter, 1 is power of the second most right digit/letter and so on). ; Thx alot. :D
Cloth in MMORPG game
For Beginners
Sorry for my bad English.Hello I made my character for my MMORPG game. It doesn't has any cloth so I want to make cloth, shorts, hat, etc. I don't want to bind these in modeling tool. I know I must separate it and bind it when program but if I set cloth position same character when my character playing animation e.g. attack monster you'll see cloth isn't following body. Is anyway to solve this. Thank you.PS. I don't want to use cloth in Physic Engine.
I assume you want cloth on your characters, but you are separating it out into another file for the sake of being able to turn random clothing items on and off. The best you can do, if you don't want to simulate it, is to have matching animations for cloth. So, you'd animate the cloth along side every animation for your character, and in game play the matching anims on both at the same time.; If your game is 2D, then you will be having to draw and redraw your clothing in each position, and render the clothing ontop of the character.If your game is a keyframe-based 3D, you will be effectively doing the same thing. If your game is a skeleton-based 3D, then just map the clothing to the skeleton, and you get all the animation for free.Chances are though that even if your game is a keyframe-based 3D, the animation authoring side of things is a skeleton-based 3D, so you would just use your authoring tool to spit out the keyframes.If you're looking for realistic cloth simulation, then that is another story entirely. It is also a huge topic in it's own right, and has very little to do with actual rendering.
Game Dev Think Tank
Old Archive;Archive
Team name:Game Dev Think TankProject name: none yetBrief description:Hello, my name is Nick Rodriguez. I am looking to put together a think tank of passionate game developers of all different skill-sets. As a group, we will design, develop, and sell video games and video game technology using C++ with DirectX/OpenGL. My goal is to bring a group of self-motivated developers together to produce great products that we as well as gamers would love to play. I do have some ideas for beginning projects, but I would like to make any initial concept decisions as a team. Target aim:retail/PC-downloadCompensation:Percentage of potential revenueTechnology:C++DirectX/OpenGLPhotoshop/PainterMaya/3DS Max/Lightwave3DZbrush/MudboxVisual Studio/Dev-C++/Code::BlocksTalent needed:Concept Artist - experience with Photoshop/Painter, strong foundation in the traditional arts (figure drawing, landscape painting, and illustration)Programmer - knowledge of C++, experience with DirectX/OpenGL, understanding of game programming logic, knowledge of 3D engine architecture and systemsMusic Composer - experience with a musical instrument, ability to write original compositions and to create music for various moods or genresSound Engineer - ability to create realistic sound effectsGame Designer - experience with designing games, strong creativity, understanding of the game design process, basic understanding of programming and art fundamentals 3D Artist - fluent in 3DS Max, Maya, Lightwave3D or other top-rate 3D modeling application, knowledge of photoshop, ability to model, texture, or animate next-gen models, ability to translate concepts or reference materials into 3D game content, knowledge of Zbrush or Mudbox is a plus2D Artist - knowledge of Photoshop or other powerful raster-based application, ability to create realistic pixel art, ability to create sprites, tiles, backgrounds, or textures for 2D and 3D gamesWeb Developer - proficiency in XHTML, CSS, and maybe &#106avascript, knowledge of web design fundamentals, ability to produce mock-ups and write HTML/&#106avascript/CSS from scratchTeam structure:Me (Nick Rodriguez) - Project Lead, Programmer, 3d artistWebsite:Currently in developmentContacts:[email protected] Work by Team:noneAdditional Info:If you're interested in joining the team or have questions, please leave comments or email me at [email protected]:ANY
Programming Language - 3d games
For Beginners
I was wondering what programming language I should learn first if I want to get into programming 3d games.I am pretty new to programming although i do now a little bit of visual basic.net but other then that there is nothing else
If you are on windows C# and XNA Game Studio will work. Very easy setup to use.I would recommend focusing on learning C# first tho. The download for XNAGS and Visual C# express 2008 are both on this link below.XNA GS; C++ is the language that is widely used for 3D game programming. If you go for Java, there's a great software called Unity which uses Java, and can also use C#, and a dialect of Python called Boo. DarkBASIC is another language that is geared specifically for game programming, and is based off of BASIC, but it is somewhat limited in some areas. Just remember this, whatever language you do choose, stick with it! Don't drop before even using it. Try it out, and then you can switch later if you really don't like it. Also, what are you looking for in the programming language? Ease of use, power, etc, etc?
Need some advice
Engines and Middleware;Programming
I have started working on my own MMO Engine. I have a working Authentication Server, World Server, Client, AI Client. They all work together and you can have multiple people on the serevr, see each other, and talk to each other. I got discouraged on it when I ran into some problems with getting combat working and so I switched to Multiverse where I could just focus on game logic and not have to deal with making the engine as well. However now comparing screenshots and discovering I am going to have to redo a bunch of code just to get the database working better I am having 2nd thoughts that maybe making my own engine in the long run is the best choice. Multiverse hardly ever gets updated where as with my own engine we could add the features as we needed them and wouldn't have to wait for them to be added. What do you guys think? Which way would be the best stick with multiverse or continue our own engine?
One vote for continue.Best to know exactly how your engine works and fix problems, than trying to find work-arounds for other engines.Looks like if you go down the premade engine route more problems will arise.But hey, might work for you, just thought i'd give my 2 pence.PureBlackSin ; Thanks. I really am thinking that our own engine would be the best choice. I have to talk it over with our other programmer though. He is a professional Java Programmer but the servers and client for the engine i was making uses Raknet for networking so it is all done in C++. I need to see if he would be willing to work with C++ instead of Java. I would not be able to continue the engine if it ended up just being me working on it. Way to much to do for 1 person. ; I have to say if you got as far as you did with your own engine you are in great shape. That is a lot of work and a huge accomplishment. Sure you hit a road block but that is the life of game development. We all hit our own road blocks. Just push through it research if you must. But if I got as far as you did with my own engine I would feel really bad about abandoning it. I say stick with your own engine.
[HLSL] [XNA] Diffuse light direction doesn't work correctly.
Graphics and GPU Programming;Programming
Hi folks,I am currently trying to implement some simple diffuse lighting into my game and have come across a odd problem.The direction of the light produces incorrect results.Currently I have the following inputs, along with my vertex and pixel shader:struct VertexShaderInput{ float4 Position : POSITION0; float2 TexCoord: TEXCOORD0; float3 N: NORMAL0; float4 Color: COLOR0; };struct VertexShaderOutput{ float4 Position : POSITION0; float2 TexCoord: TEXCOORD0; float3 L: TEXCOORD1; float3 N: TEXCOORD2; float4 Color: COLOR0; };struct PixelShaderOutput{float4 Color: COLOR0;};//=============================================//------------ Technique: Default -------------//=============================================VertexShaderOutput VertexShader(VertexShaderInput input){ VertexShaderOutput output; output.Position = mul(input.Position, xWorldViewProjection); output.TexCoord = input.TexCoord; output.Color = input.Color; // Will be moved into PixelShader for deferred rendering float3 lightDirection = float3(0.0f, 1.0f, 0.0f); output.L = normalize(lightDirection);// Light Direction (normalised)output.N = normalize(mul(input.N, xWorld));// Surface Normal (normalised) [World Coordinates] return output;}PixelShaderOutput PixelShader(VertexShaderOutput input){PixelShaderOutput output;// [Ambient Light] I = Ai * Acfloat Ambient_Intensity = 0.1f;float4 Ambient_Colour = float4(1.0f, 1.0f, 1.0f, 1.0f);float4 Ambient_Light = Ambient_Intensity * Ambient_Colour;// [Diffuse Light] I = Di * Dc * N.Lfloat Diffuse_Intensity = 1.0f;float4 Diffuse_Colour = float4(0.0f, 0.0f, 1.0f, 1.0f);float NdotL = dot(input.N, input.L);float4 Diffuse_Light = Diffuse_Intensity * Diffuse_Colour * saturate(NdotL);output.Color = (Ambient_Light + Diffuse_Light) * tex2D(TextureSampler0, input.TexCoord); return output;}A light direction of (1, 0, 0) produces the following incorrect result:however, the opposite direction (-1, 0, 0) produces no result:The same occurs for (0, 1, 0) with a negative y direction (0, -1, 0) producing no result:In all cases the original texture is chequered white/grey and the diffuse light is blue.Can anyone please tell me what I have done wrong?Thank you.
Well the "L" vector in your typical diffuse lighting calculations actually refers to a vector that points from your surface towards the light...this is because your normal also points away from the surface. So for a directional light you should actually use the opposite direction you want the light to face. Also on a side note...if you pass along direction vectors from your vertex shader to your pixel shader, you'll want to re-normalize them in the pixel shader. This is because linear interpolation between two normalized vectors will not result in a normalized vector...draw it on a piece of paper if you want to see why.As for why your light isn't forking for negative directions...I'm not sure. I'm not seeing anything in your shader code that would explain it. I would double-check that your vertex normals are correct for your mesh. ; hi,I cannot really help with the problem you have asked for although i notice your program solves a problem that i have been having. I notice you have used TexCoord to texture you sphere but where or how have u defined what TexCoords are for each point. i am currently using a mesh and D3DXCreateSphere.Thanks in advanceHellkite ; Normalize your normal in the pixel shaderUnsure why your negative directions don't work... Start debugging. Try outputting compress( NdotL ) to the screen to see what's happening;Quote:Original post by MJPAs for why your light isn't working for negative directions...I'm not sure. I'm not seeing anything in your shader code that would explain it. I would double-check that your vertex normals are correct for your mesh.Now that I have normalised the directions in the pixel shader, like you suggested, the negative directions work with no problems. I have left the vectors non normalised in the vertex shader though as they are not used, is this ok?Quote:Original post by MJP Well the "L" vector in your typical diffuse lighting calculations actually refers to a vector that points from your surface towards the light...this is because your normal also points away from the surface. So for a directional light you should actually use the opposite direction you want the light to face.Should the diffuse light equation then become:float NdotL = dot(input.N, -input.L);or should I negate the input light direction instead?The vertex/pixel shaders now look like the following:VertexShaderOutput VertexShader(VertexShaderInput input){ VertexShaderOutput output; output.Position = mul(input.Position, xWorldViewProjection); output.TexCoord = input.TexCoord; output.Color = input.Color; // Will be moved into PixelShader for deferred rendering float3 lightDirection = float3(1.0f, 0.0f, 0.0f); output.L = -lightDirection;// Light Direction output.N = mul(input.N, xWorld);// Surface Normal [World Coordinates] return output;}PixelShaderOutput PixelShader(VertexShaderOutput input){// If you pass along direction vectors from your vertex shader to your pixel shader, you'll want to re-normalize them in the pixel shader. // This is because linear interpolation between two normalized vectors will not result in a normalized vector...PixelShaderOutput output;// [Ambient Light] I = Ai * Acfloat Ambient_Intensity = 0.1f;float4 Ambient_Colour = float4(1.0f, 1.0f, 1.0f, 1.0f);float4 Ambient_Light = Ambient_Intensity * Ambient_Colour;// [Diffuse Light] I = Di * Dc * N.Lfloat Diffuse_Intensity = 1.0f;float4 Diffuse_Colour = float4(0.0f, 0.0f, 1.0f, 1.0f);float NdotL = dot(normalize(input.N), normalize(input.L));float4 Diffuse_Light = Diffuse_Intensity * Diffuse_Colour * saturate(NdotL);output.Color = (Ambient_Light + Diffuse_Light) * tex2D(TextureSampler0, input.TexCoord); return output;}Thanks for your help Matt. ; I would negate the light direction up in the application code somewhere so the right thing is set to the shaderAs well as setting it as a pixel shader parameter so you don't waste an interpolator sending a constant
Parse a texture type from a text file
Graphics and GPU Programming;Programming
So for the past week I have been doing my best to create a way to load my game from a map file. So far, so good actually, except I have run into one little snag. I am trying to use my text file to tell my game which LPDIRECT3DTEXTURE9 to use, and it will not work. On a related note, I decided to use a third party parser called Daabli, and it works great except for the fact that it will not parse the texture name. So far I have gotten it to use a string that converts to a LPCSTR to get the texture location, but I have no idea of how to get the LPDIRECT3DTEXTURE9 to load... I tried a reinterpret_cast<LPDIRECT3DTEXTURE9>(with an lpcstr) and it returns an error. I have a second text file that loads the sets of textures, but since I can't parse the LPDIRECT3DTEXTURE9 from the file I can't load the set of textures I want... I have the feeling that I'm going about this the wrong way... So any guidance would be incredibly helpful!File looks as such: {{x=0.0;y=0.0;z=0.0;texdword=0;startvert=0;endvert=2;Texture = "g_pTexture";},{x=0.0;y=0.0;z=0.0;texdword=0;startvert=4;endvert=2;Texture = "g_pTexture";},etc...}the "g_pTexture" does do nothing, so I hard code the texture name for now...texture file:{ {Location = "textures/ground/ground01.bmp"; Texture = g_pTexture;}}The second param is supposed to create a texture with the Location... and does not due to the fact that it will not parse the second param.I do know this because I made a simple parser in the console with Daabli, and it just says that the pointer is unrecognized...My two ideas are: Either make it parse the file straight with LPDIRECT3DTEXTURE9, or parse file and convert the types. Ideas?
Quote:Original post by gothiclySo far I have gotten it to use a string that converts to a LPCSTR to get the texture location, but I have no idea of how to get the LPDIRECT3DTEXTURE9 to load... I tried a reinterpret_cast<LPDIRECT3DTEXTURE9>(with an lpcstr) and it returns an error. That's not how you load textures :) Right now you only have the filename of the texture you want. You then need to explicitly load the texture data using something like D3DX's D3DXCreateTextureFromFile function. See the 'Loading A Texture' section of this tutorial.It sounds like that's the missing link in your set up, so hopefully it all falls into place from there. ; What I mean, is that I have a string for the loading of the location, and I was parsing the other variable, and it wouldn't work, so I tried using a lpcstr and it did not work... So, I guess my main question would be, how do you parse the LPDIRECT3DTEXTURE9 for a text file?I can load textures hard coded fine, it's just specifying multiple ones in external files that is the problem. ; If you have the filename of the texture in a string, and have the ability to load textures from hard-coded locations, it should just be a matter of using the same texture loading code you are currently using, but supplying it with the previously mentioned filename string. There should otherwise be no difference in operation.Not sure what you mean by "parse the LPDIRECT3DTEXTURE9 for a text file".. generally you only store image filenames and some other associated information for textures in game data files, like you are already doing.The only thing I can see otherwise is that you might be missing "s in your second file, the texture one:Quote:texture file:{{Location = "textures/ground/ground01.bmp"; Texture = "g_pTexture";}}FAKE EDIT: Oh, I think I see what you're getting at now. You are asking how to associate the textures mentioned in the objects (?) in your first file to the filenames in the second file?If so, specifying something like "g_pTexture" or whatever variable name in your config file alone won't do what you need - you need to handle this storage/association part yourself.What you could do is have a texture file like this (never used Daabli before, so bear with any silly mistakes):{ {Location = "textures/ground/ground01.bmp"; ID = "ground1"; }, {Location = "textures/ground/ground02.bmp"; ID = "ground2"; }, {Location = "textures/something/whatever.bmp"; ID = "whatever"; }, ... etc ...}.. and have a object file like this:{ {x=0.0;y=0.0;z=0.0;texdword=0;startvert=0;endvert=2;Texture = "ground1";}, {x=0.0;y=0.0;z=0.0;texdword=0;startvert=4;endvert=2;Texture = "whatever";}, ... etc ...}So you have a list of texture information (a filename and ID for each), and game objects can refer to what texture they need by using one of those IDs.At runtime, you load/parse the texture info file. You then go through each of the entries, loading the image from the specified filename using whatever texture loading mechanism (i.e., using D3DX as mentioned before), and store the LPDIRECT3DTEXTURE9 in a std::map, with the keys being the texture IDs.When you are loading the game objects, you can look up the texture IDs of each in that std::map and retrieve a LPDIRECT3DTEXTURE9 for each. Each texture will only be loaded once, and objects that need the same texture can share the same LPDIRECT3DTEXTURE9. ;Quote:Original post by mattdSo you have a list of texture information (a filename and ID for each), and game objects can refer to what texture they need by using one of those IDs.At runtime, you load/parse the texture info file. You then go through each of the entries, loading the image from the specified filename using whatever texture loading mechanism (i.e., using D3DX as mentioned before), and store the LPDIRECT3DTEXTURE9 in a std::map, with the keys being the texture IDs.When you are loading the game objects, you can look up the texture IDs of each in that std::map and retrieve a LPDIRECT3DTEXTURE9 for each. Each texture will only be loaded once, and objects that need the same texture can share the same LPDIRECT3DTEXTURE9.I obviously agree with your post, but I'd like to add another option which looks easier and faster.If OP used numbers instead of strings...{ {Location = "textures/ground/ground01.bmp"; ID = 0; }, {Location = "textures/ground/ground02.bmp"; ID = 1; }, {Location = "textures/something/whatever.bmp"; ID = 2; }, ... etc ...}... there would be no need to store a string in the object file:{ {x=0.0;y=0.0;z=0.0;texdword=0;startvert=0;endvert=2;Texture = 0;}, {x=0.0;y=0.0;z=0.0;texdword=0;startvert=4;endvert=2;Texture = 2;}, ... etc ...}This way OP could use a simple std::vector instead of a std::map.Furthermore, the ID could be made implicit if the loading order is fixed.So, it would be even simpler:1- load all textures without IDs, just adding them to a texture vector2- get the texture ID from the object file and use it to load the correct texture from the texture vector; The only problem with using a std::vector is maintainability.Adding new textures would be OK, just add them with the next highest ID available (or at the end of the list if using the implicit numbering idea). When you want to remove textures however, you end up with a gap in the ID numbering, and wasted space in the std::vector. One gap might not be a problem, but it could easily add up, leading to a fragmented ID space as development of the game content progresses. You could of course fill in the gaps by renumbering the IDs to be contiguous again, but then you have the problem of having to renumber the texture IDs in the objects file too.Implicit numbering has the last problem when removing textures too - all the textures past the removed one shift up one location, meaning you need to renumber the object texture IDs. ; Daabli will not create your DirectX texture for you and pass back a pointer; you'll have to do that yourself, as mattd has mentioned above.Some pseudocode:If you have your object defined like this:// Object information structurestruct Object{ float _x, _y, _z; int _texdword; int _startvert, _endvert; std::string _textureName; LPDIRECT3DTEXTURE9 _pTexture; const bool Read(Daabli::Reader &r) { _pTexture = 0; return r.Read( "x", _x ) && r.Read( "y", _y ) && r.Read( "z", _z ) && r.Read( "texdword", _texdword ) && r.Read( "startvert", _startvert ) && r.Read( "endvert",_endvert) && r.Read( "textureName", _textureName ); }};And your texture defined like this:// Texture information structurestruct TextureInfo{ std::string _location; std::string _textureName; const bool Read(Daabli::Reader &r) { return r.Read( "location", _location ) && r.Read( "textureName", _textureName ); }};Then you could read your textures and objects and associate them like this:int main(int /*argc*/, char * /*argv*/[]){ // Read the textures std::map<std::string, LPDIRECT3DTEXTURE9> texturesMap; { Daabli::Reader r; if( !r.FromFile( "textures.txt" ) ) return -1; std::list<TextureInfo> textures; if( !r.Read( "textures", textures ) ) return -1; // Create the LPDIRECT3DTEXTURE9 textures from the file names for(std::list<TextureInfo>::const_iterator itr = textures.begin(); itr != textures.end(); ++itr) { LPDIRECT3DTEXTURE9 pTexture = 0; // Create the texture from the filename //D3DXCreateTextureFromFile( // pDevice, // d3d device // (*itr)._location.c_str(), // filename // &pTexture ); // returned LPDIRECT3DTEXTURE9 texturesMap.insert( std::pair<std::string, LPDIRECT3DTEXTURE9>( (*itr)._textureName, pTexture ) ); } } // Read the objects std::list<Object> objects; { Daabli::Reader r; if( !r.FromFile( "objects.txt" ) ) return -1; if( !r.Read( "objects", objects ) ) return -1; // Assign the LPDIRECT3DTEXTURE9 textures to the objects for(std::list<Object>::iterator itr = objects.begin(); itr != objects.end(); ++itr) { (*itr)._pTexture = texturesMap[ (*itr)._textureName ]; } } // Use 'objects' here... return 0;}Where textures.txt could look like this:textures ={ { location = "ground.jpg"; textureName = "groundTex"; }, { location = "wall.jpg"; textureName = "wallTex"; }};And objects.txt could look like this:objects ={ { x=0.0; y=0.0; z=0.0; texdword=0; startvert=0; endvert=2; textureName = "groundTex"; }, { x=0.0; y=0.0; z=0.0; texdword=0; startvert=4; endvert=2; textureName = "wallTex"; }};;Quote:Original post by mattdThe only problem with using a std::vector is maintainability.Adding new textures would be OK, just add them with the next highest ID available (or at the end of the list if using the implicit numbering idea). When you want to remove textures however, you end up with a gap in the ID numbering, and wasted space in the std::vector. One gap might not be a problem, but it could easily add up, leading to a fragmented ID space as development of the game content progresses. You could of course fill in the gaps by renumbering the IDs to be contiguous again, but then you have the problem of having to renumber the texture IDs in the objects file too.Implicit numbering has the last problem when removing textures too - all the textures past the removed one shift up one location, meaning you need to renumber the object texture IDs.You're right, no doubt about that!IMHO those mainainability issues depend on how OP is going to load a level and the level of abstraction his "game level" has.From my POV one thing is to have a texture cacher/manager, another thing is to provide a list of textures for fast rendering of a game level.To my experience (but I might be wrong) the best thing to do is to always ask the cacher/manager to load textures (and store them in a map), using the full file path as a key (in case of a texture cacher with a vector, you can use a filename class member). The operations on textures are done via the manager (loading/unloading), while rendering is performed on a texture vector associated with that level.In theory, before loading each "level", the texture vector should be cleared.When a texture has to be loaded, we should ask the cacher to load it (if it's already loaded a valid * is already available to the cacher).If a texture can't be loaded (missing file or something else) the manager will return 0, and we can skip those invalid "object/tiles" with a simple test.Of course this thing is going to fail when you remove a texture from the manager, as the texture pointer stored in texture vector will still point at an invalid address.I can't see why somebody would want to unload a game level texture while the game is running, neither I expect this "feature" to produce something good onscreen... but nobody forbids OP to do something like that:mytexture *pTex = texturevector;pTextureManager->Remove(pTex);texturevector = 0;In that case all tiles/objects whose ID is 'i' will just disappear and the game will not crash.What's good is OP can do something like that easily:texturevector = pTextureManager->GetTexture(".//FooBar.jpg");ortexturevector = pTextureManager->GetTexturebyID(j);To sum up, my POV is a game level can safely access textures using relative (or implicit) IDs, since it is likely OP will need an higher level object (a cacher/manager) to do the dirty work of resource loading/releasing.In general I prefer vectors because the memory footprint of a map is more "obscure"... ; The higher-level texture cacher is a good idea.For clarification, my previous post was in the context of removing textures during development, not during runtime. For example, you might decide a texture was no longer needed in your game (maps/objects had been redesigned by an artist) and so you remove the entry from your texture config file.If this texture entry removal was done within an editor of some sort, numeric IDs pose no problem since the application can then quickly renumber any affected object texture IDs and write out the new map file. But if you're doing it by hand, it's not so nice. ; I agree, removing textures by hand when using a vector is going to be a nightmare![wink]
a* on 3d enviroment
Artificial Intelligence;Programming
Hello,I'm trying to implement A-Star Pahtfinding on 3D enviroment (triangles).I have a set of triangles (a triangle represents a NODE) with connections between them (neighbours) all setup and ok.Now, to make it more faster i've created a NxN matrice in wich i have precalculated distances between center's of the triangles (distances between nodes, i.e cost) and stored these distance in this "matrice" i've mentioned. (it is the 3d distance between two 3D points).Here is this function wich precalculates all the distances between nodes: (all working ok until now...)void CAStarSearch::PrecalculateMatrix(){// get number of nodes from listint counter = Oct.m_NavNodeList.size();// allocate "NxN" grid of floats.this->matrix = (float **)malloc(sizeof(float) * counter );for(WORD x = 0; x<counter; x++){matrix[x] = (float *)malloc(sizeof(float) * counter );Oct.m_NavNodeList[x].m_ID = x;}// loop thru this grid of float's. // for every columnfor(WORD b=0; b<counter; b++){ // for every rowfor(WORD a=0; a<counter; a++){// if a==b this means that distance between nodes is zero (i.e same node).// else the "matrix" will be filled with distances between nodes.if(a == b) matrix[a] = 0;else // compute distance between nodes matrix[a] = Oct.m_NavNodeList[a].m_Center.GetDistance( Oct.m_NavNodeList.m_Center );}}// DisplayMatrix(); }OK, now after that i'm trying to do 3d Pathfinding like so:(i've commented the lines to be more readable)1) getting the G value (cost from ENTRY to current NODE):float CAStarSearch::GetG(CNavNode* last_closednode, CNavNode *node){// return distance from last_closednode to node ( and cumulate this in "ClosedListG" variabile. )return ClosedListG += this->GetMatrixValue( last_closednode, node);}NOTE: i keep track and store in a global "ClosedListG" variable the SUM of distances starting grom ENTRY to current NODE. (ClosedListG = the distance from ENTRY to current node )2) getting the H value (cost from current NODE to EXIT node):float CAStarSearch::GetH(CNavNode* current_opennode, CNavNode *target){// return distance between current_opennode and target node.return this->GetMatrixValue( current_opennode, target);}NOTE: this also just returns distance from "current_opennode" to "target" node looking up in "matrix" table .3) given a (open) list of nodes , select the one with lowest cost "F" ,assuming that all nodes in this list have F, G and H values calculated already:CNavNode* CAStarSearch::GetLowestF(CNavNode *target){list<CNavNode*>::iterator next = m_OpenList.begin();// select first node on open.CNavNode* SelectedNode = *next;// loop thru all nodes in OPEN list.for(list<CNavNode*>::iterator it = m_OpenList.begin(); it!=m_OpenList.end(); ++it){// chosen = current item in open.CNavNode* chosen = *it;// get lowest value here.if( chosen->m_F < SelectedNode->m_F){// select this one because it has a LOW value than previous one.SelectedNode = chosen;}}return SelectedNode;}4) the A-Star seach function now:void CAStarSearch::void CAStarSearch::FindPath(CVector3 *Start, CVector3 *Target){// get current NODE for entry, result is stored in "entry" variable (entry = start position in nodes list)CNavNode entry;bool foundEntry = false;Oct.FindNode(*Start, Oct.m_pRoot , entry , foundEntry );// get current NODE for exit, result is stored in "exit" variable (exit = goal in nodes list)CNavNode exit;bool foundExit = false;Oct.FindNode(*Target, Oct.m_pRoot , exit , foundExit );// GetMatrixValue returns distance between 2 nodes. (all values have been precalculaded before // entering this function - and stored in a "N x N" grid (of floats).if(this->GetMatrixValue(&entry,&exit)==0) return;// clear CLOSED list and OPEN list.m_ClosedList.clear();m_OpenList.clear();// ClosedListG = path from ENTRY point to CURRENT node. // (it is the G value from A-star, and represents distance from ENTRY point node to CURRENT node.// For now ClosedListG is 0 ( it's value is computed and kept track in GetG() function )this->ClosedListG = 0;// add ENTRY yo CLOSED list.m_ClosedList.push_back(&entry);// add ENTRY's CONNECTIONS to OPEN list.for(BYTE c=0; c<entry.m_NoConnections; c++){entry.pConnection[c]->m_G = GetG(&entry, entry.pConnection[c]);entry.pConnection[c]->m_H = GetH(entry.pConnection[c], &exit);entry.pConnection[c]->m_F = entry.pConnection[c]->m_G + entry.pConnection[c]->m_H;m_OpenList.push_back(entry.pConnection[c]);}// as long as OPEN list is NOT empty (0).while(!m_OpenList.empty()){// select a NODE with lowest F value from OPEN list.CNavNode *current = this->GetLowestF(&exit);// have we reached exit (goal node) ??if(this->GetMatrixValue(current ,&exit)==0) break;else{// add current NODE to CLOSED list.m_ClosedList.push_back(current);// remove current NODE from OPEN list.m_OpenList.remove(current);// for every CONNECTION in current NODE.for(BYTE c=0; c<current->m_NoConnections; c++){// does it exist in OPEN list ? if YES -> skip if(Exist(current->pConnection[c], m_OpenList)) continue;// does it exist in CLOSED list ? if YES -> skip if(Exist(current->pConnection[c], m_ClosedList)) continue;// compute current's CONNECTION's -> F,G,H values.current->pConnection[c]->m_G = GetG(current, current->pConnection[c]);current->pConnection[c]->m_H = GetH(current->pConnection[c], &exit);current->pConnection[c]->m_F = current->pConnection[c]->m_G + current->pConnection[c]->m_H;// add above selected (low score) node to CLOSED list.m_OpenList.push_back( current->pConnection[c] );}}}// used "nodez" variable here - just to display how many nodes were found when reached goal node.extern int nodez;nodez = m_ClosedList.size();// draw all nodes in CLOSED list.DrawClosedList();}NOTE: i call "FindPath" function every frame !5) and last function that checks if a node exists in list:bool CAStarSearch::Exist( CNavNode *test_node, list<CNavNode *>lst ){// test if empty list if(lst.size()==0) return false;list<CNavNode*>::iterator it = lst.begin();// loop thru all nodes in "lst" while(it!=lst.end()){// check if equal here , if YES return true.CNavNode *chosen = *it;if(chosen == test_node) return true;it++;}return false;}PROBLEMS: 1) Search time (from ENTRY to EXIT) is slow (if m_ClosedList has more than 3 to max 50 nodes - the FPS drops from 1400fps to 60fps). Is it because of the STL list functions wich are somekind slowing things down ?? What i'm doing wrong ? 2) Don't know if i'm using the correct algorithm/function for calculating H value (i.e. GetH()) . I just used DISTANCES from a node to another node for calculating this value (and stored them in "matrix" , i.e float distances between nodes). 3) I think i'm doing something wrong in A-Star Search Function because it seems that "m_ClosedList" ends with some nodes that DONT belong to path (this i think is due to the H value i've mentioned above).I know i've posted a lot of code and i appoligise for that !!(i could upload a screenshot but i dont know how...) Thank you , any sugestions will be apreciated. :)[Edited by - redbaseone on December 26, 2009 2:25:19 PM]
Hi, you may want to place your code between the source tags (http://www.gamedev.net/community/forums/faq.asp#tags). ;Quote:Original post by leet bixHi, you may want to place your code between the source tags (http://www.gamedev.net/community/forums/faq.asp#tags).all done. thank you. please escuse me , im new to this forum. :) ; OK, seems that i've found the solution for PROBLEMS 2) and 3). The heuristic function works just fine!I've missed that i have to recalculate the F,G,H for all the EXISTING nodes in OPEN list (for a certain step in FindPath - in the while loop).Here is the function again corrected: void CAStarSearch::FindPath(CVector3 *Start, CVector3 *Target){// get current NODE for entry, result is stored in "entry" variable (entry = start position in nodes list)CNavNode entry;bool foundEntry = false;Oct.FindNode(*Start, Oct.m_pRoot , entry , foundEntry );// get current NODE for exit, result is stored in "exit" variable (exit = goal in nodes list)CNavNode exit;bool foundExit = false;Oct.FindNode(*Target, Oct.m_pRoot , exit , foundExit );// GetMatrixValue returns distance between 2 nodes. (all values have been precalculaded before // entering this function - and stored in a "N x N" grid (of floats).if(this->GetMatrixValue(&entry,&exit)==0) return;// clear CLOSED list and OPEN list.m_ClosedList.clear();m_OpenList.clear();// ClosedListG = path from ENTRY point to CURRENT node. // (it is the G value from A-star, and represents distance from ENTRY point node to CURRENT node.// For now ClosedListG is 0 ( it's value is computed and kept track in GetG() function )this->ClosedListG = 0;// add ENTRY yo CLOSED list.m_ClosedList.push_back(&entry);// add ENTRY's CONNECTIONS to OPEN list.for(BYTE c=0; c<entry.m_NoConnections; c++){entry.pConnection[c]->m_G = GetG(&entry, entry.pConnection[c], 0);entry.pConnection[c]->m_H = GetH(entry.pConnection[c], &exit);entry.pConnection[c]->m_F = entry.pConnection[c]->m_G + entry.pConnection[c]->m_H;m_OpenList.push_back(entry.pConnection[c]);}int i=0;// as long as OPEN list is NOT empty (0).while(!m_OpenList.empty()){// select a NODE with lowest F value from OPEN list.CNavNode *current = this->GetLowestF(&exit);// have we reached exit (goal node) ??if(this->GetMatrixValue(current ,&exit)==0) break;else{// add current NODE to CLOSED list.m_ClosedList.push_back(current);// remove current NODE from OPEN list.m_OpenList.remove(current);// ******* FIX *************************************// recalculate costs for EXISTING nodes in OPEN list.for(list<CNavNode*>::iterator it = m_OpenList.begin(); it!=m_OpenList.end(); ++it){// chosen = current item in open.CNavNode* chosen = *it;chosen->m_G = GetG(current, chosen, current->m_G );chosen->m_H = GetH(chosen, &exit);chosen->m_F = chosen->m_G + chosen->m_H;}// *************************************************// for every CONNECTION in current NODE.for(BYTE c=0; c<current->m_NoConnections; c++){// does it exist in OPEN list ? if YES -> skip if(Exist(current->pConnection[c], m_OpenList)) continue;// does it exist in CLOSED list ? if YES -> skip if(Exist(current->pConnection[c], m_ClosedList)) continue;// compute current's CONNECTION's -> F,G,H values.current->pConnection[c]->m_G = GetG(current, current->pConnection[c], current->m_G );current->pConnection[c]->m_H = GetH(current->pConnection[c], &exit);current->pConnection[c]->m_F = current->pConnection[c]->m_G + current->pConnection[c]->m_H;// add above selected (low score) node to CLOSED list.m_OpenList.push_back( current->pConnection[c] );}}}// used "nodez" variable here - just to display how many nodes were found when reached goal node.extern int nodez;nodez = m_ClosedList.size();// draw all nodes in CLOSED list.DrawClosedList();}also, GetG() function modifies (not so much) : float CAStarSearch::GetG(CNavNode* last_closednode, CNavNode *node, int LastNode_GValue){// return distance from last_closednode to node ( and cumulate this in "ClosedListG" variabile. )return this->GetMatrixValue( last_closednode, node)+LastNode_GValue;}GetG() = takes one more parameter into account "LastNode_GValue" wich represents "last node"'s G Value (last NODE's G-value from CLOSED list).The path is correctly generated now with the function above corected !!(If you have any questions i'll gladly answer for how i've done that until now).correct way:other pics (some of them with not working algo'):http://img707.imageshack.us/g/pathfinding2.jpg/It remains just one problem : How do i make it faster ? STL::list is somekind slowing things down ? What should i do ? Please help ... ; Hi, I don't have the time to read all the code right now, but good job getting it to work! Persistence is important. You my want to consider replacing the std::list open list with a std::priority_queue or by using the heap functions.Also, why are you running this every frame? Do you really need to? If you have enough memory to store a lookup table between each node do you have twice that much space (you'd be able to store a complete path lookup table if so)?If you don't already know about it, you may want to take a look at AMD's free performance analyzing tool Code Analyst. It works with Intel CPUs too, but only certain features. ;Quote:How do i make it faster ? STL::list is somekind slowing things down ? What should i do ? Please help ...What compiler/IDE are you using? Are you measuring the performance of a debug build, or a release build?Also, if you're using Visual Studio and are using a release build, have you added the necessary preprocessor definitions to disable iterator debugging?I didn't look at the code, but in many cases std::vector can be a faster/better solution than std::list for reasons having to do with cache coherency and how the memory is managed internally. There are quite a few ways A* can be made to run faster, but a good first step is simply to choose appropriate container types.For what it's worth, I use std::vector along with the standard library's 'heap' functions (make_heap(), etc.) and have gotten good results (although the demands placed on the pathfinding code have been fairly light so far).In summary:1. Make sure you're testing with a release build.2. If you're using Visual Studio, make sure iterator debugging is turned off.3. Switch from list to vector if possible.4. Profile to see where the time is being spent (maybe this should be step 3 :) ;Quote:Original post by Ken SHi, I don't have the time to read all the code right now, but good job getting it to work! Persistence is important. You my want to consider replacing the std::list open list with a std::priority_queue or by using the heap functions.Also, why are you running this every frame? Do you really need to? If you have enough memory to store a lookup table between each node do you have twice that much space (you'd be able to store a complete path lookup table if so)?If you don't already know about it, you may want to take a look at AMD's free performance analyzing tool Code Analyst. It works with Intel CPUs too, but only certain features.First of all, please escuse me because my english is not very good. :)Thank you for replying. Up until now i didn't used std::list so much, but they are useful at least in debug phase and not only for me here in this application. I will take a look to priority_queue and i'll be back with more info.Regarding function callback - the function must be called at least 5 times per frame (this could speed things up a little). This is used because the "monster" constantly is searching for his "enemy" on the map.As for memory requirements, i think u are very right. If let's say i have a NavMesh with 5000 nodes this means i have a matrice wich holds distances between neighbours , and wich occupies: 5000x5000 x sizeof(float) = 5000 x 5000 x 4 = ~ 100MB if i'm not mistaken , wich is A LOT of memory waste !! :) But, for now i dont have as much nodes in my application, and thank you for observing that and must find a way also for fixing that. For now im concernig at speed and getting A-Star work right.Thank you again ! ;Quote:Original post by Ken SHi, I don't have the time to read all the code right now, but good job getting it to work! Persistence is important. You my want to consider replacing the std::list open list with a std::priority_queue or by using the heap functions.Also, why are you running this every frame? Do you really need to? If you have enough memory to store a lookup table between each node do you have twice that much space (you'd be able to store a complete path lookup table if so)?If you don't already know about it, you may want to take a look at AMD's free performance analyzing tool Code Analyst. It works with Intel CPUs too, but only certain features.First of all, please escuse me because my english is not very good. :)Thank you for replying. Up until now i didn't used std::list so much, but they are useful at least in debug phase and not only for me here in this application. I will take a look to priority_queue and i'll be back with more info.Regarding function callback - the function must be called at least 5 times per frame (this could speed things up a little). This is used because the "monster" constantly is searching for his "enemy" on the map.As for memory requirements, i think u are very right. If let's say i have a NavMesh with 5000 nodes this means i have a matrice wich holds distances between neighbours , and wich occupies: 5000x5000 x sizeof(float) = 5000 x 5000 x 4 = ~ 100MB if i'm not mistaken , wich is A LOT of memory waste !! :) But, for now i dont have as much nodes in my application, and thank you for observing that and must find a way also for fixing that. For now im concernig at speed and getting A-Star work right.Thank you again ! ;Quote:Original post by jykIn summary:1. Make sure you're testing with a release build.2. If you're using Visual Studio, make sure iterator debugging is turned off.3. Switch from list to vector if possible.4. Profile to see where the time is being spent (maybe this should be step 3 :)Thank you for reply ! :)I will run a benchmark now to see where the bottlenecks are ... :)Im using MSVC , debug build, preprocessor definitions to disable iterator debugging are ENABLED . will turn this off and see what results will came up. ;Quote:I will run a benchmark now to see where the bottlenecks are ... :)Im using MSVC , debug build, preprocessor definitions to disable iterator debugging are ENABLED . will turn this off and see what results will came up.Just to be clear, you should try benchmarking using *release* build, and with iterator debugging *disabled*. To disable iterator debugging, you need to add two preprocessor definitions at the project level; if I'm not mistaken, the definitions you need to add are _SCL_SECURE=0 and _HAS_ITERATOR_DEBUGGING=0.Maybe that's what you intend, or are already doing - I guess 'preprocessor definitions to disable iterator debugger are ENABLED' is the same as iterator debugging being disabled :)Anyway, before jumping to any conclusions about performance, make sure you're in release mode and that iterator debugging is off; then, if the performance is still not satisfactory, profile to determine where the bottlenecks are.
AP Computer Science?
Games Career Development;Business
Hey there everyone. Merry Christmas. I just thought I'd ask for some information on AP Computer Science seeing as my school does not offer it but one is allowed to take the exam without taking the class and I may self-teach ( I wouldn't take the exam until Spring of 2011 as I'd have to learn everything in a very small amount of time). Basically, what does the exam cover? What does a class used to prepare for the exam focus on? How is the exam split up? What are all the concepts that I'd need to know for the exam? Lastly, do you think it is practical to try and self-teach in preparation for such an exam? PS: My school barely has any computer science at all. We lost computer science 2 due to lack of interest and barely have enough people a year for computer science 1 which could be taken Sophomore and up.
Have you checked the official description? Here it is for Computer science A: http://www.collegeboard.com/student/testing/ap/sub_compscia.htmlThe exam isn't too hard. I didn't take it, but I had planned on it. It turns out my school didn't do the necessary paperwork on time to order the exams and didn't tell me until it was too late. It covers what pretty much what I would expect someone would learn after one semester of an introductory Java course. If you have enough experience with Java, I don't think you'd need to spend a lot of time studying.If you have programming background and can take it, I'd really recommend doing it. The worst that can happen is that you pay for the test but don't score high enough to get college credit. The best is that you get an edge in college and start a class or two ahead, and that's a bigger deal (in my opinion) than it seems: it means more time for upper-level coursework, which is both more interesting and more important. ; Oh, it's in Java? I didn't know that. It seems then that it's not in my interest to take it as I'm not familiar in Java. I'm not sure if understanding c++ at all will help but I really don't understand Java too well and have most experience with c++. ;Quote:Original post by FujiOh, it's in Java? I didn't know that. It seems then that it's not in my interest to take it as I'm not familiar in Java. I'm not sure if understanding c++ at all will help but I really don't understand Java too well and have most experience with c++.If you are fairly competent with C++, you can be up to speed in Java in a couple of weeks - less if dedicated. I won a small web development contract some years back, realised at the last minute that the requirements document specified Java, and taught myself as I went along [smile]Almost every university computer science program teaches the first couple of introductory courses in Java these days, so whether or not you score well on the exam, you will be ahead of the curve if you learn Java. ;Quote:Original post by FujiOh, it's in Java? ... I'm not sure if understanding c++ at all will help but I really don't understand Java too well and have most experience with c++.If you can learn one language you can learn another. Truth be told, you're going to have to learn several computer languages anyway. Get used to it. ; In that case, I DO have a $45 gift card for Barnes and Nobel. Any books you can recommend that cover Java? I do have JCreator set up on my computer and I have dealt with C# and Java a little in the past. Either way, anything that strengthens my programming ability is something I am willing to consider. ; I'd say go for it. You'll need to know the material sooner or later.I don't know if this will interest you, but I personally learned Java by participating each year of high school in a competition at a nearby university using Robocode. I had a lot of fun developing AI for the robots, and I just picked up Java naturally as I went on using online materials. Robocode's just a very nice learning environment; you can get a lot of interesting results without too much effort, but to get the best results could take a month or more of work. ; I think the AP board made a new policy this year that students aren't allowed to take an AP exam if one hasn't taken the course. This is because in previous years, students who didn't take the course usually performed worse as a whole and thus raised the curve on the tests. ; The guy above is wrong, according to the College Board website... supportI took Comp Sci A in high school, with no knowledge of Java besides what I learned while prepping. Java is really quite similar syntactically to C++, and syntax is what's most important on A, or at least that's my opinion of the test (which is low, I finished in like 20 minutes and had to sit for 3 hours).I will also mention, however, that even though I got a 5, it didn't get me out of any college courses. My college, and from what I understand a lot of colleges, want the AB test, which focuses more on data structures. I didn't take that one, but a friend of mine without a Java background did and he did quite well. Course, he's brilliant, so it has to do with how good you think you are.I did most of my prep from this website: http://javabat.com/ . I found it really quite helpful, and it was pretty representative of the sorts of things I saw on the test (just not ALL of it, for instance there's no OOP). ; Related, I'm taking APCS this year.Is it true that the AB exam was dropped? The A exam is completely useless. Am I screwed?
C++ Struct constructor problem
General and Gameplay Programming;Programming
Hello all,I have a little problem that's been nagging me, and I'm hoping somebody could shed some light on it. I have a simple struct declared/defined as so:struct XFileInfo{XFileInfo(): is32BitFloat( false ),isText( false ){}bool is32BitFloat;bool isText;};And then I create an instance of this struct on the stack within a function like this:void XFileLoader::LoadTemplatesFromFile( const char* filename ){std::ifstream xFile( filename );XFileInfo info();if (!ValidateXFile( xFile, info )){// invalid X filereturn;}}But the problem is, I get the following error from the VS compiler:1>.\XFileLoader.cpp(28) : error C2664: 'ValidateXFile' : cannot convert parameter 2 from 'XFileInfo (__cdecl *)(void)' to 'XFileInfo'1> No constructor could take the source type, or constructor overload resolution was ambiguousI'm not sure what the issues are with constructor overload resolution here. I defined a single default constructor, what is the ambiguity? Or is this a symptom of something completely different?Thanks much for any advice!
XFileInfo info(); <-- Function declaration (note: declaration, not definition).XFileInfo info; <-- variable declaration and construction. ; This line:XFileInfo info();This is a function declaration. C++ allows functions to be declared inside other functions. You can rewrite it as:XFileInfo info;Which is does call the constructor. ; I see, so if I had arguments to pass in it would be treated as a constructor call, but if I have no arguments and just parentheses it assumes that this is an inline function declaration. Is this correct? ; Yep, because then it couldn't be a function declaration. One of the rules in C++ parsing is along the lines of "if it can be a function declaration, parse it as such"
Mobile Gaming ISV Kickoff Event at CES
Your Announcements;Community
On behalf of Connectsoft and event co-hosts Dell and Broadcom, we would like to invite game and mobile application developers to our ISV Kickoff Event at the Consumer Electronics Show in January to introduce a new wireless application platform. Please contact me at the following if you are interested in attending and/or learning more. David G. BrennerVP Marketing and Business DevelopmentConnectSoft, Inc.Direct / Mobile (214) [email protected]
[win32/c++] Displaying Bitmap causes crash
General and Gameplay Programming;Programming
HelloI have made a simple win32 application that converts temperatures.Problem:I am displaying a bitmap image in a static control that is scaled usingStretchBlt(). But when the application runs it goes into an infinite loop,doesn't display the bitmap & crashes.I believe the problem is either to do with the static window where the bitmapis loaded to OR in the painting area.To make it easy to find where the problem occurs, I think its in the Windows Proceedure function in either:- WM_CREATE- WM_PAINT#include <windows.h>#include <cstdlib>#include <string>#include <stdio.h>#include "converter.h"using namespace std;const char g_szClassName[] = "myWindowClass";static HINSTANCE gInstance;HBITMAP header = NULL;bool convert = false;// Functions List //LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);bool isEqual(double cel, double fahr);double findFahren(double cel);double findCel(double fahr);int WINAPI WinMain(HINSTANCE gInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow){ WNDCLASSEX wc; HWND hwnd; MSG Msg; //Step 1: Registering the Window Class wc.cbSize = sizeof(WNDCLASSEX); wc.style = 0; wc.lpfnWndProc = WndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance= gInstance; wc.hIcon = LoadIcon(NULL, IDI_APPLICATION); wc.hCursor = LoadCursor(NULL, IDC_ARROW); wc.hbrBackground = (HBRUSH)(LTGRAY_BRUSH); wc.lpszMenuName = NULL; wc.lpszClassName = g_szClassName; wc.hIconSm = LoadIcon(NULL, IDI_APPLICATION); // if registration of main class fails if(!RegisterClassEx(&wc)) { MessageBox(NULL, "Window Registration Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } // Step 2: Creating the Window hwnd = CreateWindowEx( 0, g_szClassName, "Temperature Converter", WS_OVERLAPPEDWINDOW | WS_VISIBLE | SS_GRAYFRAME, CW_USEDEFAULT, CW_USEDEFAULT, 410, 200, NULL, NULL, gInstance, NULL); if(hwnd == NULL) { MessageBox(NULL, "Window Creation Failed!", "Error!", MB_ICONEXCLAMATION | MB_OK); return 0; } ShowWindow(hwnd, nCmdShow); UpdateWindow(hwnd); // Step 3: The Message Loop while(GetMessage(&Msg, NULL, 0, 0) > 0) { TranslateMessage(&Msg); DispatchMessage(&Msg); } return Msg.wParam;}// Step 4: the Window ProcedureLRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam){ HWND btnConvert, fldCelcius, fldFaren, cbFtc, cbCtf; // Labels HWND stBgd, stBox, lbCelcius, lbFaren; switch(msg) { case WM_CREATE: { //load bitmap header = LoadBitmap(GetModuleHandle(NULL),MAKEINTRESOURCE(IDB_HEADER)); //if fails if (header == NULL) { MessageBox(hwnd,"Failed to load bitmap","Error",MB_OK); }// Create labels, buttons, edits etc. stBgd = CreateWindowEx( 0, "Static", "", WS_BORDER | WS_VISIBLE | WS_CHILD, 2,2, 390,160, hwnd,NULL, gInstance, NULL); // Window to load & display bitmap header stBox = CreateWindowEx( 0, "Static", "", WS_BORDER | WS_CHILD | WS_VISIBLE | SS_BITMAP, 10,10, 350,147, hwnd, (HMENU)IDT_TEXT, gInstance, NULL); fldCelcius = CreateWindowEx( 0, "EDIT", "0", WS_BORDER | WS_VISIBLE | WS_CHILD | ES_NUMBER, 20,80, 100,20, hwnd,(HMENU)ID_CELCIUS, gInstance, NULL); // Label lbCelcius = CreateWindowEx(0,"STATIC","Celcius",WS_VISIBLE | WS_CHILD,122,80,60,20,hwnd, NULL,gInstance,NULL); btnConvert = CreateWindowEx( 0, "BUTTON", "Convert", WS_BORDER | WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 200,120, 100,20, hwnd,(HMENU)ID_CONVERT, gInstance, NULL); cbFtc = CreateWindowEx( 0, "BUTTON", "F-C", WS_BORDER | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BST_UNCHECKED, 80,120, 50,20, hwnd,(HMENU)ID_CEL, gInstance, NULL); cbCtf = CreateWindowEx( 0, "BUTTON", "C-F", WS_BORDER | WS_VISIBLE | WS_CHILD | BS_AUTOCHECKBOX | BST_CHECKED, 20,120, 50,20, hwnd,(HMENU)ID_FAHR, gInstance, NULL); fldFaren = CreateWindowEx( 0, "EDIT", "0", WS_BORDER | WS_CHILD | WS_VISIBLE | ES_NUMBER, // only take numbers 200,80, 100,20, hwnd,(HMENU)ID_FAHREN, gInstance, NULL); // Label lbFaren = CreateWindowEx( 0, "STATIC", "Fahrenheit", WS_VISIBLE | WS_CHILD, 302,80, 80, 20, hwnd, NULL, gInstance, NULL); }break; case WM_COMMAND: switch(LOWORD(wParam)) { case ID_CONVERT:{BOOL cSuccess;BOOL fSuccess;double celcius = GetDlgItemInt(hwnd,ID_CELCIUS,&cSuccess,true);double fahrenheit = GetDlgItemInt(hwnd,ID_FAHREN,&fSuccess,true);// if either GetDlgItemInt failsif (!cSuccess | !fSuccess) { MessageBox(hwnd,"Get numbers from text fields failed", "Error!",MB_OK);}if (!isEqual(celcius,fahrenheit)) { if (convert) { celcius = findCel(fahrenheit); SetDlgItemInt(hwnd,ID_CELCIUS,(int)celcius,true); } else { fahrenheit = findFahren(celcius); SetDlgItemInt(hwnd,ID_FAHREN,(int)fahrenheit,true); }} } break; default:break; } switch (HIWORD(wParam)) { case BN_CLICKED:{if (LOWORD(wParam) == ID_CEL) { if (SendDlgItemMessage(hwnd,ID_CEL,BM_GETCHECK,0,0) == BST_CHECKED) { convert = true; SendDlgItemMessage(hwnd,ID_FAHR,BM_SETCHECK,BST_UNCHECKED,0);} }if (LOWORD(wParam) == ID_FAHR) { if (SendDlgItemMessage(hwnd,ID_FAHR,BM_GETCHECK,0,0) == BST_CHECKED) { convert = false; SendDlgItemMessage(hwnd,ID_CEL,BM_SETCHECK,BST_UNCHECKED,0); }}}break;default:break; } break; case WM_PAINT: { BITMAP bm;PAINTSTRUCT ps; // To paint outside the update rectangle while processing // WM_PAINT messages, you can make this call: //InvalidateRect(hwnd,NULL,TRUE); HDC hdc = BeginPaint(GetDlgItem(hwnd,IDT_TEXT), &ps);HDC hdcMem = CreateCompatibleDC(hdc);HBITMAP hbmOld = (HBITMAP)SelectObject(hdcMem,header);GetObject(header, sizeof(bm), &bm);//BitBlt(hdc, 0, 0,346, 148, hdcMem, 0, 0, SRCCOPY); //SCALE BitmapStretchBlt(hdc,0,0,(int)(bm.bmWidth/7),(int)(bm.bmHeight/7),hdcMem,0,0,bm.bmWidth,bm.bmHeight,SRCCOPY); SelectObject(hdcMem, hbmOld);DeleteDC(hdcMem);EndPaint(hwnd, &ps); } break; case WM_CLOSE: DestroyWindow(hwnd); break; case WM_DESTROY: DeleteObject(header); PostQuitMessage(0); break; default: return DefWindowProc(hwnd, msg, wParam, lParam); } return 0;}bool isEqual(double cel, double fahr) {double result = (5.0 / 9.0) * (fahr - 32);// return if celcius equals fahr converted to celciusreturn (cel == result); }double findFahren(double cel) { return ((9.0 / 5.0) * cel) + 32;}double findCel(double fahr) { return (5.0 / 9.0) * (fahr - 32);}[Edited by - gretty on December 28, 2009 1:07:28 AM]
Give us some hints :)What information does the crash give you? Accessing an invalid memory location? If so, what location? What line does the crash point to?Also, try putting your code in [source] .. [/source] tags. ; That is not the correct way to use SS_BITMAP. Currently, you are trying to render the bitmap in the static control from within the parent window's WM_PAINT, for which you should not do. That BeginPaint call you have there is probably why it is crashing, since you pass it a window handle that is not the one receiving the current WM_PAINT message.In general, the static control renders the bitmap for you and you shouldn't have to paint it yourself. See below for proper use of SS_BITMAP.winmain.cpp#include<windows.h>static HINSTANCE basead = 0;LRESULT CALLBACK StdWndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam);int WINAPI WinMain(HINSTANCE instance, HINSTANCE, LPSTR, int){ basead = instance; WNDCLASS wc; ZeroMemory(&wc, sizeof(wc)); wc.style = 0; wc.lpfnWndProc = StdWndProc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = instance; wc.hIcon = LoadIcon(0, IDI_APPLICATION); wc.hCursor = LoadCursor(0, IDC_ARROW); wc.hbrBackground = (HBRUSH)GetStockObject(WHITE_BRUSH); wc.lpszMenuName = 0; wc.lpszClassName = TEXT("MAINWINDOW"); if(!RegisterClass(&wc)) return -1; HWND window = CreateWindowEx(0, TEXT("MAINWINDOW"), 0, WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, 0, 0, instance, 0); if(!window) return -1; ShowWindow(window, SW_SHOW); UpdateWindow(window); MSG msg; while(GetMessage(&msg, 0, 0, 0)) { TranslateMessage(&msg); DispatchMessage(&msg); } return 0;}LRESULT CALLBACK StdWndProc(HWND window, UINT message, WPARAM wparam, LPARAM lparam){ switch(message) { case(WM_CREATE) : { HWND stbox = CreateWindowEx(0, TEXT("STATIC"), TEXT("IDRES_STBOX"), WS_BORDER | WS_CHILD | WS_VISIBLE | SS_BITMAP, 10, 10, 350, 147, window, 0, basead, 0); if(!stbox) return -1; break; } case(WM_DESTROY) : { PostQuitMessage(0); break; } default : return DefWindowProc(window, message, wparam, lparam); } return 0;}stdres.rc#include<windows.h>IDRES_STBOX BITMAP "stbox.bmp";Quote:Original post by mattdGive us some hints :)What information does the crash give you? Accessing an invalid memory location? If so, what location? What line does the crash point to?Also, try putting your code in [source] .. [/source] tags.I am very new to win32 so I dont know whats wrong or where But I believe the problems would be occuring in lines:- 89 to 118 (line 89 is "header = LoadBitmap....")OR- 257 to 279 (line 257 is "BITMAP bm;")To explain what I am trying to do:- I am trying to display a scaled bitmap in the window called stBox using StretchBlt(), although I have never done this so I dont know whats going wrong & why.; Also to add to my previous post, if you need to stretch the image, you can useSS_REALSIZECONTROL with MoveWindow to control how the image is stretched. You don't need to call StretchBlt since the static control is supposed to draw and stretch the bitmap for you. ;Quote:Original post by yadangoThat is not the correct way to use SS_BITMAP. Currently, you are trying to render the bitmap in the static control from within the parent window's WM_PAINT, for which you should not do. That BeginPaint call you have there is probably why it is crashing, since you pass it a window handle that is not the one receiving the current WM_PAINT message.In general, the static control renders the bitmap for you and you shouldn't have to paint it yourself. See below for proper use of SS_BITMAP.Thanks for ur reply :) I have compiled your code but it does not show the bitmap?I understand what you are saying tho. If I load a bitmap to the main client window using the conventional method, is there a way to control its depth? What I mean is I want the bitmap to appear infront of a static rectangular control.Presently if I load & display a bitmap on the main client window, it is displayed behind my controls(gray rectangle, edit boxes etc) so thats why I tried to load a bitmap to a window in order to control its depth & make it appear infront of other controls.So to sum up, is there a way to make a bitmap appear above/infront of a control? ;Quote:Original post by grettyQuote:Original post by mattdGive us some hints :)What information does the crash give you? Accessing an invalid memory location? If so, what location? What line does the crash point to?Also, try putting your code in [source] .. [/source] tags.I am very new to win32 so I dont know whats wrong or where But I believe the problems would be occuring in lines:- 89 to 118 (line 89 is "header = LoadBitmap....")OR- 257 to 279 (line 257 is "BITMAP bm;")To explain what I am trying to do:- I am trying to display a scaled bitmap in the window called stBox using StretchBlt(), although I have never done this so I dont know whats going wrong & why.With a little hacking (defining values for the resource identifiers), I got your program to compile and run fine on my machine. One thing I did change was to use a built-in system bitmap instead of one from a resource file with LoadBitmap. Are you sure your call to LoadBitmap is working OK?Do you know how to use a debugger? (Are you using Visual C++?) You should run your program in a debugger, and see the exact line that it crashes on.What happens if you comment out the WM_PAINT handler - does it still crash then? Take note of what yadango posted above about how you don't actually do the painting yourself, and the possible reason for your crash.EDIT: Looks like you got/are getting this bit sorted, so the above might not apply anymore.As an aside, your code for handling WM_COMMAND is a little strange; the two switches could be merged into one. Also, you should prefer to use radio buttons for the C->F / F->C selection, so you don't need to code that mutual-exclusion code there in the first place :) ; Thanks for all the help.I have made some sucess, I have drawn the bitmap but its being displayed behind other controls.Any adviced on how to make it appear infront of other controls?A side note, maybe its just me but using Yadango's code, I cant get the bitmap to appear? it just shows the border of the window. ; in my resource file, i defined a bitmap called stbox.bmp, create a dummy bitmap with that name in your solution/project directory and you will see the bitmap.
Where do I get an artist from?
2D and 3D Art;Visual Arts
Hi!I've made a nice flash game, and now looking for graphics.I intend to pay.It's more about user interface graphics since it's a card game, so, no sprites whatsoever.Note that this is probably going to be considered "version one" graphics, and more work might come afterwards.Is there a recommended website/company/artist to get this from? Maybe someone in here wants to make some bucks?Questions/Clarification/Answers/etc' in here or private.Thanks!
If you're looking to recruit an artist, you'll want to post in the Help Wanted forum while following the mandatory posting template. Good luck! ; You can also try the pixeljoint forums. They have a ton of people who specialize in pixel art.I don't know what type of game you've made however...http://pixeljoint.com/forum(Hey Dave! Long time no see!) ; Thanks for the link jrjellybean, seem to be a good place as well!
Isometric engine
Graphics and GPU Programming;Programming
Hello,I have recently been working on a isometric engine in XNA. I have rendering working but on large maps (on my computer at about 500x500) is starts getting sluggish. The problem is the fact that all tiles are drawn regardless of whether they are on the screen.Right now I am looping through the entire array of tiles and checking whether the destination rectangle intersects with the graphics window rectangle. If so, then the tile gets drawn.I would however like to be able to determine beforehand which tiles are drawn and which are not so I don't have to loop through the entire array which is where I am losing the most performance right now.I haven't got a clue on how to start implementing this though. Any pointers would be greatly appreciated.Cheers!
You could implement some hierarchy like a quadtreeThis way, at the top level, you'll have 4 nodes to test for visibility, and rejecting one will reject 1/4 of all the tiles in your worldAlternatively, and probably a better approach is to calculate the tile at the top-left and bottom-right of the screen, and loop over those - that way you won't even need to test anything off-screen. Hopefully you can easily address tiles by X,Y so this is trivial
Problems rendering to a surface
Graphics and GPU Programming;Programming
I'm porting my 2D game engine from SDL/OpenGl to DirectX 9.0c. I need to be able to create bitmaps and blit stuff on them, so I figure I need to render to a surface.I'm using the ID3DXRenderToSurface interface to handle the details about rendering. Problem is, this is VERY slow. I suppose it happens because my texture does not have D3DUSAGE_RENDERTARGET specified so the interface has to render to its internal texture, then copy to my texture. So I try putting the render target flag, but now it complains that it is not in the default pool, and that's not exactly better because that would mean that I have to re-render everything when my device is lost, and I might need to lock too. (But it fixes the speed problem if I put default.)There's also another problem with rendering to a surface: the parts where nothing was rendered on gets garbage like what was previously on the screen the last time I ran the engine.I doubt I'm the first one trying to do a simple 2D engine with DirectX 9.0c, so how is this usually done?
Anyone? I'm sorta blocked on that issue. ; Render on the D3DPOOL_DEFAULT surface, then copy it to a D3DPOOL_SYSTEMMEM surface yourself when you need it.And clear the surface after setting it before you do any rendering on it to avoid seeing video memory dumps.
C/C++ programmer wanted for 2D SRPG project
Old Archive;Archive
Team NameCurrently untitledProject NameCurrently untitledBrief DescriptionA relatively small 2D fantasy SRPG project influenced by Exile, Fallout, Disgaea, Diablo, the Elder Scrolls.Target AimFree and possibly open source (will be discussed).CompensationExperience and an addition to your portfolio!TechnologyTarget platforms: Windows 98+, Mac OS X 10.0+, GNU/LinuxLanguages: C/C++ (engine), Lua (game logic)Graphics: OpenGL 1.1Audio: waveXxx/midiXxx (win), Core Audio (mac), OSS (lin)In addition, several open-source libraries will be used.Talent NeededC/C++ programmer for help with engine programming.Lua experience would help but is not required.Team StructureWe currently have a programmer (me), a story writer, an artist, a composer, a foley artist, a mapper, and everybody contributes to design via a wiki.Web SiteWe don't currently have a web site, as the team has just recently been formed. But I plan to make one in the near future. It will at least include a wiki and forums. With such a small team, SVN will not be necessary.ContactsMe: [email protected] Work by TeamNone. This is a new team.Additional InfoWe already have most of the game mechanics figured out. The design is currently (sloppily) contained on a pocket wiki, which will be merged (in a more organized manner) into the online wiki. The story is pretty early in development, but the main focus as of now is writing the engine. The engine will be written in C/C++, and the game logic will be written in Lua. I was going to write the engine by my self at first, but it's proving to be a bit too much for me to handle on my own.For easy distribution, the game is contained in only two files: the engine executable, and an archive containing all Lua scripts and content. The game will first be released for Windows as .msi/.exe/.zip, then .app/.dmg for OS X, then finally .deb/.rpm/.tar.gz for Linux.FeedbackAny constructive feedback is welcomed. If you have any questions, or if you wish to help out, please email me, PM me, or reply to this thread. I will be checking all three frequently. Thanks for your time!

No dataset card yet

Downloads last month
13