Jump to content
  • Advertisement

Cybrosys

Member
  • Content Count

    212
  • Joined

  • Last visited

Everything posted by Cybrosys

  1. Since i'm bored out of my mind, i descided to try and tackle physics. To write the most simplest of implementations of a sphere rolling, the rotation of the surface, cubes.. and such. But, for starters i was just thinking about a stick. Let's say it's angled at 45 degress, one end firmly on the ground. Gravity is going to push down the upper and lower part of the stick, the problem is that the lower part can't move downwards to match the upper, the upper stick is going to exhert a force down the shaft of the stick. What i'm wondering, is how much force is going to be exhert down the shaft towards the lower end of the stick? Let's say there's no friction so the other end is going to shoot sideways instead because the height force is being nullified by the ground. So, in other words: the bottom part of the stick will shoot to the side while the top end of the stick will drop to the ground. The distance between the two points can never change. So to recap, F=a*m (m = 1 for the stick), the top part is being dragged down with the force of gravity, but how much of this force is being exherted downwards through the shaft? F*dot product of the shaft vector and gravityvector? In other words, at 45 degrees -> 50%?
  2. Well, thank you again. I was going insane over the problem :)
  3. What I'm trying to do is find where to, for example, shoot in order to hit a moving target. A solution may not always exist of course. I did a search on the forum and found a solution but i didn't understand his math or what it was he was calculating having variables called: a, b, c and d. The formula that i have is pretty simple, except that there's two unknowns and i don't know how to break em out, solve the equation in other words. Formula: targetPos - projectilePos + targetDir * time = projectileDir * projectileSpeed * time The variables are vectors except for the time scalar. The length of the projectileDir is 1 in the formula if the time variable was correctly chosen. The problem is i don't want to have to increment the time variable and check the length of the projectileDir to see if it's equal to about 1, and if not continue to increment and check. What my limited math skills won't allow is for me to somehow tell the formula that the |projectileDir| has to be 1 or the projectileSpeed if we want to move it out of the equation. Please help me, the search result i mentioned above refers to this post: http://www.gamedev.net/community/forums/topic.asp?topic_id=122528
  4. Thank you, you've been very helpful :) (Rate++) I'm reading through your post and checking the math, the only thing that caught my eye so far was that you stated that: VPx = (Sx + t * VTx) / t when a simpler one is: VPx = VTx + Sx / t Was there a reason for doing so?
  5. Thank you for the reply. The problem is that there are 2 unknown variables, time and the DT and because of that all i could think of was to start time at almost 0 and increment it and checking how long the DP vector is. If it's less than 1 then i know we've overshot and should decrement the time with more accuracy and while it's longer than 1 continue to increment it until it's as close to 1 as we will accept. Sometimes there won't be a solution of course, depending on where the objects are and what velocities are chosen. Seeing as you seem to have a better grasp of math, did you read the other thread? Maybe we could somehow calculate the time variable if we assume that there exists a solution seeing as the ratio between the distances needed to travel is the same as the ratio between the two objects' speed.
  6. Cybrosys

    D* pathfinding algorithm

    There is no specific application, i was planning on implementing the algorithm as dynamically/abstract as possible for future usage.
  7. I've been trying to find some information about the D* algorithm but i haven't been able to, through google, find any information about it and/or it's implementation. I would appreciate it if anyone could post information about the algorithm and it's implementation.
  8. Cybrosys

    D* pathfinding algorithm

    I've just started reading about D* Lite and if possible I'll make an implementation of the algorithm plus A*. I implemented A* a long time ago and decided to implement it once again (code has a habit of disappearing) when i came across a mention of D*. I'm very curious as to your statement that each agent needs it's own copy of the map in order for the algorithm to work, so I'd love it if you could send the report you did to the email address that I've PM:ed you.
  9. Cybrosys

    D* pathfinding algorithm

    I thank everyone for their replies.
  10. I created a WebUserControl which i named NewsControl. This control consists of 2 panels, 2 labels and 1 text box. When i add the control manually to any page using <news:NewsControl ID="NewsControl1" runat="server" /> It displays and works just fine, the problem is i want to add them dynamically. I added a <asp:Table ...>..</asp:Table> to a page and in that page's Page_Load function i wrote the simple lines: List<News> news = NewsController.GetNews(); int count = 0; foreach (News entry in news) { TableRow row = new TableRow(); TableCell cell = new TableCell(); NewsControl newsControl = new NewsControl(); newsControl.ID = string.Format("NewsControl{0}", count++); cell.Controls.Add(newsControl); row.Cells.Add(cell); TableNews.Rows.Add(row); } No major complicated problems with that code, except that the NewsControl objects doesn't get drawn when i view the page! That's right, when viewing the page source code the table is empty! The code gets called without problems. If i changed my NewsControl to a simple Button instead, it gets drawn. So apparently there's something seriously wrong with asp.net, any ideas on how to get this to work?
  11. Thank you for the reply! I will test what you're proposing, hopefully it will work. I seem to remember seeing other ways than my own way, to instantiate custom user controls. Though i fail to see why my original code doesn't work. It's as if it's only instantiating the Code-Behind part of the object and completely ignoring the asp.net part somehow. This might be because, opposed to for example the Button object, mine is a collection of controls. Maybe i just need to define a custom constructor for my control and somehow force the instantiation of the asp.net content... but I'm just rambling on, thank you for the help and I'll post whether or not it worked. Thank you.
  12. Hi all, i'm currently trying to create a new TabControl since the one that exists is very limited. The thing is, I'm using a List<TabPage> tabPages = new List<TabPage>(); as storage for the tab pages. I've got a simple get property in the class with [Browsable(true)] so that the list is visible in the properties window. The thing is, when i add pages through the property window, they get allocated in the form but, when i click the collection in the property window later after deselecting my control, they're gone from the list, BUT, they're still in the form code. I would love it if someone please could tell me why the list gets emptied, or reallocated when the allocation of the list isn't even in the constructor but outside just to be sure. It feels as if creating a simple usercontrol requires more knowledge of all the attributes and settings in visual studio than actual coding experience :S
  13. Does anyone know if a TcpClient's NetworkStream closes the connection if a packet fails to be delivered, that is, even if resend fails that's built-in to the tcp protocol.
  14. I have a question regarding sockets, tcpclient, udpclient, tcplistener etc. The problem concerns how to send "objects" intead of just strings or such. What i want to do, or is trying to do is simply to define classes/structs and send those as objects. Each class will have a header at the top, the first x num bytes. So that when i'm receiving data i'll always start by reading the first few x bytes and parse them into the message header class/struct so i know what data is in the buffer. First of all, i need to know the size of the message classes or structs, but sizeof doesn't work so i have to get the size some other way(?). Could anyone direct me to information or how i should send information properly using *clients and sockets?
  15. Yes, you are correct about the c/c++. The thing is, what if i serialize two objects and send them across the network... The TcpClient recieves the two objects, but how should it know what objects it has recieved etc? Will two *.Write calls always be handled on the server/client side as, for example, 2 BeginReadComplete events? The examples i've found has always involved someone sending a string or reading strings from a file and sending them over the network. I haven't seen any examples of actually sending "objects" over the network. The only example of that is a Remoting example but i'm worried that it's not that performance wise. Btw, does the TcpClient objects handle disconnection events, client lost etc or do i have to monitor that my self by, for example, ping messages?
  16. Well i know of the Serializable attribute, but the problem of knowing the size of an object still remains. And would remoting be a wise choice? I haven't done any test with it and just to mention it, the networking will be for a game. Nothing too fancy, just some tcp data transfers for important stuff ie client information and udp for movement packets etc.
  17. I was curious about different debugging methods, and by debugging i don't mean stepping through your code. I was more interrested in what built-in features there are in .net and vs that allows me to print out debug messages in different ways without having to create a class of my own for debugging. [Edited by - Cybrosys on June 14, 2006 8:49:22 AM]
  18. Hi, thanks for the reply. I installed the project to a folder in my projects folders and copied the common and media folders directly from the sdk and compiled everything, but i still get the same error as in the jpeg i listed above.
  19. Hi, i searched up an earlier thread in hope of finding out what was the problem but i'm guessing it was a different problem. The sample browser offers me two empty projects to install, one using .net 2.0 beta and the other is the old Empty Project. Trying to install any of the samples and running them will result in a failure in the dxutmisc files etc that the samples are based on. I can execute the pre-compiled ones but i can't execute my own compilations properly. When booting up my compilation i get a device creation failed, null reference exceptions etc. Does anyone know anything about this or is it because of dx10/xna that's caused instability in the code base of the older sample source codes? I'm guessing my only solution is to download an older version of the sdk? I was realy looking forward to start using the new directx :/ The first problems i've narrowed down to the ResourceCache. [Edited by - Cybrosys on May 24, 2006 6:09:55 AM]
  20. I've reinstalled it but no change. I can compile the code but when i try to run it, i get this error. http://www.isk.kth.se/~mnensen/error.jpg The .fx file is empty and i've tried swapping it for another but it doesn't solve the problem. I've even installed other solutions but they result in other errors such as the ResourceErrors which i talked about earlier when trying to run the other Empty Project. I've tried to compile and run the UI samples as well but they result in errors. Oh, and just for the record, i do have .Net 2.0 installed. UPDATE: Has anyone else tried to install the projects, compiled and tried to run them? Could it be that everyone that's tried the new sdk has just converted their projects and not used the Empty Project solutions, which would mean that the dxutil code files are full of bugs? :/ UPDATE #2: I downloaded and installed the December 2005 and the samples still give me the errors, i think the october one was the last one i tried that didn't have these problems with the samples. [Edited by - Cybrosys on May 23, 2006 4:31:12 PM]
  21. Is it possible to sarch substrings of a string using wildcards, for example if i wanted to find out if a string contained "santa*. Rides" ?
  22. Okay, i don't know what's wrong but i destinctly remembered being able to create a custom control that inherited for example ListView. When i try to pick one of the inherited options in add a new item all i get is to inherit it from a dll or a form that's already in the project. How can i create a class that inherits the ListView without having to create the class manually since that's only a work-around. :/ [Edited by - Cybrosys on May 19, 2006 4:51:10 PM]
  23. When i inherit, the class stops being a User control and becomes a Component and i lose the ability to add it to a form from the toolbox.
  24. What is the proper way of doing it if i want to add functionality to the ListView control?
  25. Answer to post #1: Yeah i found that earlier but didn't like it so i wrote my own. This is for searching inside my own little database that i'm writing for a program. Might not be the most optimised but it's simple. public File[] Search(string searchPattern, bool ignoreCase, DatabaseSearchOptions searchOptions) { List<File> findList = new List<File>(); // We'll split up the searchPattern using the wildcards. string[] wildcards = { "*", "?" }; // Check the logic. if (ignoreCase) searchPattern = searchPattern.ToLower(); // Split up the search pattern using the wildcards. string[] comparers = searchPattern.Split(wildcards, StringSplitOptions.RemoveEmptyEntries); // We need it for the search logic. bool found; string checkAgainst; foreach (File file in fileList) { found = true; // Having a switch inside a loop isn't something that's recommended performance wise. switch (searchOptions) { case DatabaseSearchOptions.NameOnly: checkAgainst = file.Name; break; case DatabaseSearchOptions.PathOnly: checkAgainst = file.Path; break; case DatabaseSearchOptions.NameAndPath: checkAgainst = file.Path + "\\" + file.Name; break; default: checkAgainst = file.Name; break; } if (ignoreCase) checkAgainst = checkAgainst.ToLower(); // Compare the string against the comparers. foreach (string c in comparers) { // No occurence found. if (checkAgainst.IndexOf(c) == -1) { found = false; break; } } // We found a match. if (found) findList.Add(file); } return findList.ToArray(); } Post(s) 1+: Thanks, i'll look into it :)
  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!