• Content count

  • Joined

  • Last visited

Community Reputation

195 Neutral

About Freeky

  • Rank
  1. Hi,   I have a console application that runs an 'infinite' main loop. Now I want to add a Form to it to serve as GUI.  My problem is, that if I run the Form first, and then start the main loop, it never reaches the main loop until the Form is closed because it freezes the thread. If I do it the other way around, it never reaches the part where I run the form of course.   I've tried some other things, like using Form.Show() and then enter the main loop. But even though the form appears and the main loop works, the form becomes unresponsive.   Does anybody know another way to do this? I've tried some multithreading, but I can't seem to make communication between the Console app and the Form.   Thanks in advance, Freek
  2. 3D Graphics with C#

    I do this for fun and practice, and as a nice change on Unity3D which I use for school.    I'll stick to OpenGL for then, and I'm going to check out OpenTK now!   Thank you
  3. 3D Graphics with C#

    Hi,   I want to make a game with simple 3D Graphics in C#. With simple I mean that the graphics will only cosist of basic shapes with a texture and that I don't need to load models, nor do I need fancy effects.   I have made 2d games with C# before using the built-in Graphics class. I've also made 3D games with Java and OpenGL (With the LWJGL).   Now my question is: What kind of library should I use?   I'm not sure if I want to use OpenGL or DirectX. DirectX seems to be the most commonly used with C# but I happen to have experience with OpenGL so that might be a good choise too.   I'd like it to be easy to set-up, and not way too difficult to use. I've found a tutorial series for OpenGL and C# where you had to write your own shaders, and that's not what I'm planning to do. I don't need to have maximum control about everything, I'd rather have it a little bit abtracted.   I head they stopped updating XNA some time ago, so I guess that one is outdated and I read that it's difficult to set it up for 3D.   Thanks in advance!   Freek
  4. Soccer AI

    Thank you.   I have been observing many different soccer AI's, including RoboCup. Although I've noticed that RoboCup AI's are way more complex than most (retro) game AI's. For what I'm planning to do, I'd like to keep it as simple as possible.   The system I've used in my first prototype is the one I told about earlier. Only a few players on the field are 'active': The ones from each team that are closest to the ball, and a player that is about to receive a pass. For the rest I loop through many positions on the field placed in a grid, and apply points to them based on many different factors.   For example some of these factors are:  - Can I receive a pass from the player with the ball from this position  - Is this position close to my home position (So that not all players will go to the same position)  - Can I shoot on goal from here?  - Are there no opponents to close to this position?  - Isn't there a teammate already at this position?   These are all for the team that has the ball, the defending team of couse has other factors, wich I still need to work on a bit more.   A similair strategy is also used to find the best player to pass to.   I like how it looks so far, but it still needs a lot of tweaking. I've seen players pass back to the keeper when they could also have shot at goal for example.    The formation database system Hodgman talked about (and wich apparantly is also used in FIFA and PES) would probably be better, but it will be much more complicated and I'd seriously have so study soccer tactics. Also, I like how chaotic my current system is. :)   Thanks again, and more tips and suggestions are welcome!
  5. Soccer AI

    Thanks for your reply!   I have heard about flocking before, but never thought that it could be usefull for something like this. I will definately have a look at it.   The formation database system would be the most complicated part by far, since the players should find a balance between keeping to their formation, and wandering off to mark an opponent, or to get to the ball or wathever. (And of course to keep in more interesting)   Passing is indeed also a problem. I think I'm going to do that by looping through all teammates and giving each of them a 'score' for how good it is to pass the ball to them. Then pass to the one with the highest score. I was also thinking about using this system for positioning the players in some ocasions.   Player spesific skills and characteristics is something for later. I first want to focus on making some identical players play a game of soccer, then I'll make different players/teams.
  6. Soccer AI

    Hi,   I want to make a retro-ish soccer game. I want to keep it as simple as possible. I thought about basing it on 'Exciting Soccer' (video) or 'Nintendo World Cup' (video).   The only problem is making the AI. The ideal scenerio would be that I can first make the game AI only (so it basically plays itself) and later add an option for the user to take control of one player.   I'm not aiming for a super intelligent AI, but rather for a 'kind of interesting to watch' AI.    I am aware of the book 'Programming AI by Example' wich has a whole chapter on this topic. And I don't own the book, but I have seen videos of the result and I'm not really impressed. If you look at this video you might understand what I mean. It seems like only the players closest to the ball are doing anything. Also note what players 4 and 7 are doing at 0:14.    I find the AI of Exciting Soccer way more interesting, although it's actually very stupid. I just like how all the players are moving along with the ball and the game.   So my question is: Does anybody have any advice on how to make this? How do I make a fun-to-watch game of (seven a side) soccer where all players in the team seem to be playing together?   Many thanks!   Freek
  7. Drawing entities from back to front

    I just found out I could just do this: glAlphaFunc(GL_GREATER, 0.1f); glEnable(GL_ALPHA_TEST); This does exactly what I wanted.
  8. Drawing entities from back to front

    I just did something like this. I just sorted all entities by the distance to the player, but when I turn the camera slightly, sometimes the transparent pixels still overlap.   By the way: The sprites only have fully transparent and fully visible pixels, so nothing in between.
  9. My last problem has barely been solved and I have already encountered the next one.   I am making a simple 3D first-person game. I made trees by rendering 2D sprites in my 3D world wich are always turned toward the player.   The tree sprites have some transparent pixels in them. When a few of them overlap, sometimes, a part of the fruthest tree is not rendered behind the transparent pixels of the one in front of it. It's hard to explain so here is a screenshot:   Anyway, I did some googling around and found out that the best solution would be to make sure everything is rendered from back to front.   Everything visible in my game is an entity and I just loop through them all every frame to render them, but now I'm going to have to make sure they are all rendered from far away from the player -> close to the player. That order could theoretically change every frame.   I wonder what would be an efficient way to make sure all entities are rendered ordered by their distance to the player? The height coordinate (Y-axis) does not matter in this case, because this is 0 for every entity.   Many thanks in advance, Freek
  10. How to avoid depth fighting

    Many thanks!   Though I have no idea what the parameters 'factor' and 'units' actually mean, setting them both to -1.0f seemed to do the trick and the depth fighting has now totally dissapeared. (:   Now I'm gonna have a look around on the internet to see what it is I just did.   Thanks again.
  11. How to avoid depth fighting

    Yeah, maybe you're right, I guess that would be pretty simple. I was just happy about my current system and hoped I wouldn't have to turn it all around.    The current wall texture is 16*16 pixels, wich is repeated over the entire wall. (Two times vertical and horizontal depending on the length of the wall (the distance between the two wall positions)) The house consists of four walls. This means I can just break up the wall on wich the door is placed into 2 walls: The part left and the part right of the door. Then I would simply place the door right between the 2 walls. This would only cost 1 line of code, so that's not the problem. I was just wondering if there was some kind of way to force OpenGL to 'override' the previously rendered stuff and to force one texture to win the depth fight. Sadly this is not the case so I'll have to do it the way I just explained.   Thanks for the help guys, I really appreciate it. ;)   Freek
  12. How to avoid depth fighting

    Thanks for the answers.   I currently render the door 0.001 outside of the wall, and depth fighting now only happens when I'm far away from the wall. So it works, but it's not a permanent solution.   Both the walls and the door are just entities in my game. Only the wall takes 2 position parameters intead of 2 (the wall being rendered from the first to the second position) and I really like the simplicity of that but I'm afraid I'm gonna have to come op with a more complicated system.   Is there a way in openGl to 'draw' a hole in something? It would be a great solution for this and some other problems I will encounter. For example: can I tell OpenGL to draw a rectangle (using GL_QUADS) from 0,0,0 to 20,0,20, and then tell it to 'dedraw' a rectangle 5,0,5 to 10,0,10? It would be great but I don't think this is possible this way except by breaking up the first rectangle into 4 rectangles surrounding the hole.   And Sik, I understand what you mean, but I was actually trying to avoid adding detail as much as possible to keep this project simple. That's why I chose a retro-look and made the player unable to look up and down. (The camera can only turn left and right)   By the way, it won't be possible to open the door, you just press the action key when you're close enough and will be teleported to the inside of the house, wich is just a seperate room.
  13. Hello,   I am creating my first 3d game in java using the Lightweight Java Game Library and OpenGL.   I'm afraid I have just encountered the first problem so far for wich I can't find the answer on Google, so I decided to ask it here.   I have drawn four textured walls wich represent a house, and this works perfectly fine. However, Now I want to add a door to my house. A door in my game is an entity wich is rendered as a rectangle just as heigh as a wall but with a door texture on it.   I was hoping that by drawing it later than the wall, it would just 'override' that part of the wall. This was not the case and the door and the wall started z-figting. So now it looks like this: The door starts to flicker when the camera changes position.   If I disable GL_DEPTH_TEST, it looks fine from the right side, but if I stand on the other side of the house, I'll still see the door through the house, like this:   I understand this can be solved by drawing the part left and the part right of the wall seperately with the wall in between them, but I was hoping there is another way to solve this problem.   Many thanks,   Freek
  14. Playing with a theme for a game

    Well, a plot twist seems like a good idea to me. But how about this: In the end it turn out that the only reason the players were send on that mission was because they wanted to get rid of them. or at least to keep you busy for a while. They won't discover that until the end. However, in the end the mission seemed to be useful after all. Maybe because the player has discovered something important or destroyed something witch would have caused a lot of trouble if it was not destroyed on time.   Just throwing some ideas here. Perhaps it might help you. ;)   Freek
  15. Best way to manage items?

    [quote name='adt7' timestamp='1349785894' post='4988315'] What is the purpose of your IDs? Does an item need to know it's ID? Why can't you just retrive items by name? [/quote] It's used for saving and loading: I save the item id's of the items that are in the inventory to a file. This means that I need to be able to find items by their id's, and to get the id of each item. The name will be shown in-game. I don't want to use it instead of an idea because I would like to leave the possibility for duplicate item names open. [quote name='Bartley' timestamp='1349796409' post='4988382'] On creating items, I created a Utility class which has a static spawnItem method, which sends the variables to the relevant constructor in the relevant item class. Then I populated txt files (one for melee, one for ranged, etc) with the items stats. To create a particular item, you just have to send the item's text file, the row which contains the variables, and the amount of items you want, to spawnItem, which constructs the item, then place it in the relevant item arraylist. This worked, but there are doubtless easier ways to handle this. [/quote] Good idea. I want to implement something like this so I can easily implement item states, Like enchanted or sharpened. But I don't feel like using text files. [quote name='Josh Petrie' timestamp='1349797950' post='4988387'] To solve this problem in a better fashion, you need to analyze every dependent interface -- everywhere you "need" to pass the ItemManager -- and determine why that interface actually needs it and if/how you can eliminate it. Chances are very good you can -- why don't you try listing some of the places you currently require the ItemManager and what they do with it. [/quote] [quote name='Josh Petrie' timestamp='1349797950' post='4988387'] Also, thus far this interface does not do anything I'd consider "management" at all. It just holds on to a bunch of data. The term "manager" is a vague/azy and consequently makes for a poor choice in interface names. I'd instead call this interface and ItemCollection or ItemDatabase, depending on the eventual operations you support with it. [/quote] Thanks for the tip. I renamed it to ItemDatabase.