|
I've been using pygame for a roguelike I've started to develop and notice a little flickering everytime I update the screen. I might take a look at pyglet. As for windows binaries, py2exe has been my best friend for showing off my work to my brother. All you have to do is write a small 10ish line setup.py file and then go to console with: "python setup.py py2exe" It builds a distribution folder with all dependencies taken care of. My brother unzips the folder I send him and double click my .exe
|
# ¿ Jul 21, 2008 00:42 |
|
|
# ¿ Apr 28, 2024 16:56 |
|
more falafel please posted:Either you're running that on a 386 or the problem is not with PyGame, it's with your code. Could be the code, but seriously, it's like 150 lines of code max. All I'm doing is placing strings on a surface, blit, and flip. Am I missing something to cut down on the flicker?
|
# ¿ Jul 21, 2008 18:52 |
|
poemdexter posted:Could be the code, but seriously, it's like 150 lines of code max. All I'm doing is placing strings on a surface, blit, and flip. Am I missing something to cut down on the flicker? Figured it out. I was creating a new Surface everytime I wanted to print something to the screen. I moved my Surface initialization to my __init__ and reuse it to print to screen. Flicker gone. quote != edit
|
# ¿ Jul 21, 2008 19:39 |
|
I'm not sure this goes in here but I'll take a stab. I've currently been modding minecraft using a plugin system introduced by another user who rolled his own API for this game. I've written some pretty cool stuff like floodgates, hearthstones, fishing, and an in game economy. The problem is that I know poo poo all about game design and I'd really like things to be balanced. Are there any really decent texts on the game design aspect? I want the game to be fun but I don't want users to play for 8 hours and end up with a boat load of cash. My in game store really isn't pulling as much money out of the world as I thought it would.
|
# ¿ Oct 11, 2010 15:04 |
|
hayden. posted:Give me your email, I got stuff for you. poemdexter at gmail
|
# ¿ Oct 11, 2010 15:32 |
|
pseudorandom name posted:When they have a boatload of diamonds and steel and whatnot spawn an army of Creepers. An excellent suggestion, but I was looking for more balancing suggestions instead of just killing everyone on the server. I can already spawn creepers at people's positions modded in.
|
# ¿ Oct 11, 2010 20:11 |
|
The Cheshire Cat posted:Thanks for this link, it's exactly the kind of thing I was looking for! If you're going the python route, look at the pygame library. It's a handy library for handling windows and buffers and drawing. More pertinent to you is the fact that you absolutely can write a roguelike in python since I've already done a very very very proof of concept type thing in college. http://roguebasin.roguelikedevelopment.org/index.php?title=How_to_Write_a_Roguelike_in_15_Steps I'm still searching for a cool written guide on how to generate a dungeon dynamically that I used. It has no code examples but just outlines the techniques you need to use.
|
# ¿ Mar 23, 2011 15:00 |
|
Mustard Snobbery posted:Perhaps this is what you were looking for? While equally awesome, this was some wiki page or something that had like X amount of steps to create a roguelike dungeon. It drew hallways and then created rooms. I can't find it to save my life.
|
# ¿ Mar 24, 2011 00:12 |
|
Me and a buddy are working on a multiplayer asteroids game together for fun using XNA. We've really never ever messed with netcode before and are really completely lost as to what best practices are for what data the player should be sending to the server. We plan on having a dedicated server. So far we kinda think the client should send it's new position vector to the server, but we're not sure if we should take it a step further back and just send the server keyboard input. We figure we'll use UDP but we just need some simple documentation/book/blog posts/etc just to get us started. Our most pressing questions would be: 1. For a very simple asteroids game, what should the client be sending the server? 2. What is ok for the client to handle and what should the server handle? 3. I assume we should be limiting the packet sending somehow in the main game loop so it's not pushing packets out as fast as the game loops. Another generic XNA question would be does the XNA library handle timing by itself natively? As in, will we need to add some timing functionality so that the clients run at the same speed across all hardware?
|
# ¿ May 18, 2011 18:59 |
|
PnP Bios posted:I've been working on a 2D graphics library in C# that will work well with OpenTK. I'm fine tuning the sprite batching, but the cool thing about mine is how it handles drawing the sprites. I really like this idea instead of having a draw method that is overwritten like 7 times and takes anywhere from 1 to 9 parameters.
|
# ¿ May 23, 2011 15:27 |
|
Another game networking question. We want to keep the game logic seperate from the networking logic So our dedicated server will create 2 threads, a networking thread that handles incoming and outgoing messages and a game logic thread that will handle each tick of game and updating objects in the game. The two will talk to each other via event handlers/delegates. This is all XNA/C# with the libgren lib for networking (not using the built in networking since we aren't doing GFWL). My question is this: Is this the best way to do a dedicated server? We've been looking for dedicated server architecture examples or tutorials or blog posts or something, but we're coming up short.
|
# ¿ May 26, 2011 17:44 |
|
Paniolo posted:I don't see that working very well. Not only would you need locks everywhere but you would need to code your entire game engine with the assumption that state can change at any given time which is pretty much impossible. Look into using buffered states or message queues instead. each thread would use events to fill each other's message queue. How's that?
|
# ¿ May 26, 2011 19:26 |
|
OneEightHundred posted:What kind of game is this? It's multiplayer asteroids with a dedicated server and clients that act like dummy terminals sending keyboard inputs to the server. I understand the architecture of how things work. I'm actually just looking for implementation guidelines/best practices. Server with 2 threads? Server with no threads and 2 objects inside a loop? Event handlers for recieving messages passing messages between objects or just straight up call a updateGame() method passing what I'm parsing from messages?
|
# ¿ May 26, 2011 21:08 |
|
Twernmilt posted:You don't need to lock anything if you use message passing to have the network and game logic communicate and avoid mutating those messages, which isn't difficult. It sounds like that's what he's doing with handlers. I saw that wiki as well! I understand the why for networking, just need a little guidance on the how.
|
# ¿ May 26, 2011 21:09 |
|
Right, so for just the Server part, would you separate your two parts listed into separate threads with messaging? Would you mash them together inside one object and just handle inputs as fast as possible while ticking and updating players?
|
# ¿ May 26, 2011 21:52 |
|
I guess a better question would be how would YOU implement a dedicated server? What classes/objects/threads/etc would you create and how would the interact with the client and each other?
|
# ¿ May 26, 2011 22:10 |
|
Money. That's just the sort of thing I was looking for. I guess we needed to dip a little deeper into exactly what goes into networking games. This stuff is pretty complicated! You've been a tremendous help 1 800.
|
# ¿ May 27, 2011 00:13 |
|
XNA? Things are simple enough and then all you'd do is a matrix transformation to jerk your camera 45 degrees for the isometric part.
|
# ¿ Jun 19, 2011 06:26 |
|
http://blog.spacestro.com/ There. You guys have convinced me to do it. We just hit milestone 2 which was too god drat long and we didn't feel like refactoring at the end. However, for milestone 3, we're just going to implement a small amount of features so we're not bogged down with too much and still have the mental fortitude to clean up code. Here, have a screenshot.
|
# ¿ Jul 7, 2011 06:01 |
|
The Fool posted:Isn't that also an issue with java? And any other language that uses "virtualized" machine code? You are correct.
|
# ¿ Aug 16, 2011 21:08 |
|
Physical posted:
Is this true? I thought if the first statement was false then it didn't bother to check the second statement after a && because the whole thing is false if the first statement is false. I do this in javascript all the time to save time doing validation. Is this not true in other languages?
|
# ¿ Sep 7, 2011 23:35 |
|
Physical posted:Oh cool. Well how would I do it if c# wasn't so nice. Basically what you posted as "want to avoid."
|
# ¿ Sep 7, 2011 23:57 |
|
Physical posted:Oh cool. Well how would I do it if c# wasn't so nice. True if either entry returns true, but remember if the first is true, why even bother checking the second? It's a waste of resources.
|
# ¿ Sep 8, 2011 00:14 |
|
Physical posted:Oh ya durp I was only thinking of falses. Yes, the statement you were hung up on. Are you looking for the magical 3rd option that isn't the efficient way or the nested if statement way? I'm sure someone can write a one line zinger that uses threads and flipping bits or something.
|
# ¿ Sep 8, 2011 00:19 |
|
Physical posted:I want them to both share the same else statement. Like if there is a failure it collapses to the same else (kind of like a switch statement without a "break;" for a couple of the cases in a consecutively. Bah, don't use try/catch like that. Really, the "hung up" code is the best since it fills your requirements of "on false of either, go to else". I'm interested to know if ANY language actually executes both statements in an && or || situation where the first statement is false or true respectively.
|
# ¿ Sep 8, 2011 00:48 |
|
Rocko Bonaparte posted:More questions about my favorite topic in this thread: component-based design. I now have entities and components and they're working together for the most part. I foresee some dependency problems though. I have one component that represents position and some other components are interested in position within the entity. I define the position first, so I get lucky here, and I also try to make sure any components relying on information from other ones will not fall apart if the information is not there yet. I wondered at a more general design level if there's something better I could be doing. You can always force a certain order when loading from templates. Also, most of the components that need to know about each other can be handled with the actions. So player.do("TakeDamage", 5) would do the TakeDamage Action which would go through and modify the player HP component as well as take into account if the entity has a shield or resistances or whatever other components. And all of that is just if this.getComponent("Shield") != null. For other dependency issues, you could create managers like a Collision manager that would fire off the needed actions that modify velocity, acceleration, and HP for collided entities on impact. So instead of trying to fire off these yourself, you can have a manager have a method called checkCollision(entity a, entity b) and then handle all your dependency stuff inside so the components never need to worry about other components since that's the method's job to make sure they exist or handle cases where something might not exist.
|
# ¿ Sep 8, 2011 19:21 |
|
Hughlander posted:One consideration for that specific issue though not the problem itself. Many proponents of an entity system place the position in the world in the game object, not in any of the components. I remember reading one paper where it was basically "Position, and list of components" was the entirety of the object. Interesting. But what about inventory items? Or NPC chat messages, or things that don't require a position?
|
# ¿ Sep 8, 2011 20:11 |
|
Rocko Bonaparte posted:More component-based design stuff, but I think this is more in the fun realm than anything else. I was curious for some examples of how people are splitting up things into components. With your components you have actions right? Should probably discuss both. My setup is similar to yours but my game is a roguelike so no need for much physics. Health: Hp yah, has actions that heal or take damage. AnimationState: This is a biggie for me. It stores the sprite or sprite sheet for the character as well as the direction it's facing. Also says if it's animated and if it loops (torches on walls flicker). So a player moving in the opposite direction will have it's sprite flipped so it's facing the other direction. Position: Pretty standard. Has actions to change position by delta (move up 1) or completely move (teleport). HumanControl: This is something I might look into later. Right now I let XNA's keyboard stuff worry about moving and just tells the player entity to do an action for the position component. Of course my only keys at the moment are up,down,left, right so this might get changed later. AI: Mobs have a component for the A* pathfinding. the action is "MoveTowards". It takes an argument of the target position (in case i want mobs to pick up gold and not just steam towards player). The action will actually do the pathfinding and the tell the position component to move. The next part of development will be the actual combat so I'm sure I'll have weapon and armor components that will talk to the HP component to determine actual damage taken.
|
# ¿ Sep 13, 2011 20:27 |
|
Staggy posted:I gave a component-based system a go after seeing your earlier posts poemdexter, and it was fun - until I got things all tangled up together. When I create the entity, I add components and actions. That way when i say player.Do("TakeDamage", 5) the action does all the important stuff. And by important stuff, I mean the action will go through the entity checking for other components it might need to determine what kind of damage it will actually take. This keeps components separate from one another so that no component needs to know about another component. The actions do all the heavy stuff. If you're talking about messages across all the entities, I have an entity manager for each level of the dungeon. In this manager, I have a dictionary of doors and door locations. I also have a list of monsters and a list of items on the ground. If the player moves, then I just enumerate the list and tell each entity which action they need to take depending on what state they are in. I think this answers your question. It doesn't seem you have actions like I do to go along with your components. Just some messages with an id that says "do this if you see this string". But then you run the risk of having components being dependent on other components to do things.
|
# ¿ Sep 13, 2011 20:46 |
|
Your Computer posted:I don't really "get" component systems (because I've never seen them used, and never tried it myself), but I don't see how it's easier to do string parsing and error-checking then delegating method calls to different components instead of just subclassing and calling, say, 'player.takeDamage(5)'. I see it as more of a way to get away from crazy inheritance trees. I'm sure delegating methods to different pieces of classes would work just fine. It's really just a different way of doing it when you know you're going to have a giant mess of different objects in the game that are sorta related but not quite and really gives you the power to create some pretty interesting creatures on the fly without having to figure out where it fits on the inheritance tree or worse, creating a new subclass to extend. As far as tutorials go, I just use this barebones project and expanded on it: http://dl.dropbox.com/u/11893120/EntityPrototype.zip You can also google "component based game development" and find more links than you could possibly want. Most of it is pretty abstracted out so it's hard to find concrete examples, but that EntityPrototype project should be pretty good at showing what it does.
|
# ¿ Sep 13, 2011 21:39 |
|
Rocko Bonaparte posted:I didn't do actions--I think. I guess we should make sure I understand the nomenclature here. By "actions," I am assume code that is applied to an entity that does whatever with the components. I think with everything I have in place I could, but it didn't really cross my mind as a thing to do. Instead, I'm doing stuff with signals and requests. When components are added to an entity, it registers signals it cares about, and requests it can accommodate. So eventually another component may request a signal, and the servicing component gets notified with the request ID, and it sends back a message containing the relevant data. Yah, I think we're on the same page. I actually have an action class that all actions extend but they pretty much operate in the same fashion as your signals and requests.
|
# ¿ Sep 14, 2011 13:41 |
|
Rocko Bonaparte posted:I thought I would update the thread--and particularly you for expressing some interest--in what came up while I was getting HumanControl working. It gets a little hairy when it comes to activities that could get cancelled. It seems kind of ugly, but that's probably how I'd do the animation honestly. I'm lucky enough where I'm only dealing with sprites in a roguelike so your problem is a little out of my scope. For A*, you'd definitely want some sort of waypoints in your game. The more waypoints you use, the more interesting the movement of your AI can be. Also remember that you have the option to add weights to your points so that the AI might go around a puddle of mud instead of walking through it if it turns out it's faster to go around. http://www.policyalmanac.org/games/aStarTutorial.htm I love this link. It explains everything very very clearly and even has some images so you can follow it along. There's no code examples so don't worry about trying to parse java to C++ or anything like that. Personally, I have a "move via AI" component. You pass the target to the entity and it gives you the queue of moves you need to take to get to the target. Very handy.
|
# ¿ Sep 18, 2011 23:52 |
|
Internet Janitor posted:The one thing to watch out for in this type of system is to make sure the queue of moves doesn't go "stale" as things in the world move around and change the paths that are available. Ask me how many times I've created bugs that centered around this! I do the exact opposite and refresh the queue every turn. I'm banking on the fact that roguelikes don't have that many monsters at the player at once as well as being small rooms and hallways making the A* not take long at all. So far so good.
|
# ¿ Sep 19, 2011 13:55 |
|
Internet Janitor posted:Oh. Well usually I do the same but I just return a single delta that will move you toward the target. If the path is regenerated every tick you don't really need to return a queue at all. If you aren't generating an entire path you can potentially speed things up a lot by first walking a low-rez graph of components in the map, possibly representing rooms. In a dungeon-like maze there will be a lot of rooms that are only accessible from a limited number of small chokepoints. Then if you know a sequence of rooms is in the optimal path you can do a normal A* to the closest chokepoint leading you along that path. I think Dwarf Fortress does something along these lines, but I think the DF implementation loses path optimality. Hmmm. That's actually pretty interesting! However, all mobs are docile until the player opens the door. So even then, there's maybe max 10 spaces the mob needs to traverse to get to the player. I probably will switch up the method to return a single point to move to howevever, it's one extra line of code and not a big deal at the moment.
|
# ¿ Sep 19, 2011 15:10 |
|
Internet Janitor posted:poemdexter: Totally. Always go with the most straightforward implementation of pathfinding you can and then add complexity when you realize performance is becoming an issue. Often it never is. The main advantage of just returning a single delta is that it's a weaker contract and thus gives you more flexibility for changing the underlying pathfinding algorithm later without disturbing your consumers. Agreed on straightforward implementation. The developer for Braid had a talk at some college and the audio was on the internet and he talked a lot about just putting your mechanic in in the most simple way possible and then dealing with performance ONLY when it is an issue. I'm looking for it now but a lot of the media is blocked on company firewall so I'm not sure which it is.
|
# ¿ Sep 19, 2011 17:05 |
|
Fren posted:Does anyone have experience distributing games, in Python (using OpenGL) on multiple platforms (Linux, OS X, Windows XP/7)? I'd like for each platform to have a one-click application that simply runs the app and doesn't gently caress with the user's system; and for the Python to be compiled as at least one level of obfuscation preventing users from simply seeing the source code. py2exe As for the component stuff, I agree with Unormal. Have components be completely independent of one another and mutable and attached to the Entity in whatever way you wish. Personally, I also register actions with the Entity where all of the logic sits. Any dependencies I have are within the Action and it's my responsibility that I have the correct components attached for any actions I attach.
|
# ¿ Sep 21, 2011 22:04 |
|
The Cheshire Cat posted:A good safety net here would be that in your EntityFactory, the final step could be to scan through the list of actions you've attached to the entity, and have it automatically add any required components for those actions that the entity is missing, whether or not those components are specified in the entity description (you could document it as those actions imply those components, so any entity that performs those actions can implicitly be said to have those components - just make sure you set up your dependencies so that it always makes sense). Oh that's a good idea. I'll definitely do this!
|
# ¿ Sep 21, 2011 23:57 |
|
Silver Alicorn posted:Here's the short version: Is this something that has be be run like an application or is it something that can be modified to just run as sorta a background image that plays itself?
|
# ¿ Sep 26, 2011 18:14 |
|
The Monarch posted:I'm having a weird issue with XNA. I'm trying to load a Texture2D, but it's not working for some reason. Is there a reason you aren't using the Content portion of your solution and using direct paths instead? All of that can be condensed into a single line (or more if you're passing ContentManager around). code:
|
# ¿ Oct 11, 2011 13:26 |
|
|
# ¿ Apr 28, 2024 16:56 |
|
2D is a little boring for me and I'd love to dabble in some voxel based terrain stuff ala minecraft world generation. However, I know absolutely 0 about drawing anything in 3 dimensional space or what's required by XNA (I know 2D XNA way too well). I'm looking for some direction, maybe a few tutorials on drawing something in XNA in 3d as well as maybe some guide from going from a cube to a world. I can read all the wiki articles in the world as well as blogs but I just don't know anything about ray tracing or 3 dimensional points. My basic assumption is this: 1. There's a 3 dimensional array of values (at least bool). 2. Fill this array by hand or use some algorithm to do it (perlin noise heightmap is probably what I'm looking at first since it's easiest.) 3. A ray tracer points from somewhere within or outside the cube of values. 4. If a ray hits a surface of a 'true' value, it renders the face of the voxel. 5. Poof you now have some landscape! Am I close on this? If so, should I look at implementing some ray tracer first? Help!
|
# ¿ Jan 18, 2012 05:58 |