• What are you working on? v15
    5,001 replies, posted
[QUOTE=Frugle;28152651]Shit.. I had no idea about those.[/QUOTE] What I did was this: [csharp] static class Settings { /// <summary> /// Gravity of the game. /// </summary> public static Vector2 Gravity = new Vector2(0,9.81f); public const float MeterInPixels = 1 / PixelsInMeters; public const float PixelsInMeters = 64f; #region Pixels -> Meters public static float ConvertToMeters(float pixels) { return pixels * MeterInPixels; } public static Vector2 ConvertToMeters(Vector2 pixels) { return pixels * MeterInPixels; } #endregion #region Meters -> Pixels public static float ConvertToPixels(float meters) { return meters * PixelsInMeters; } public static Vector2 ConvertToPixels(Vector2 meters) { return meters * PixelsInMeters; } #endregion } [/csharp] And everytime I need to convert I use those static methods.
[QUOTE=ZeekyHBomb;28152406]The content, yes. However you can't guarantee the same memory address when restoring it. And apparently weird stuff can happen if you just move memory around to create a non-POD type instead of using the appropriate constructor or operator. Can't tell you specifics, though I remember Chandler saying that for classes with vtables that table could be destroyed.[/QUOTE] Not destroyed, it's just that how a vtable is stored, and read, in a binary varies from platform to platform. On some platforms, the vtable isn't stored as a pointer, but as an offset within the binary. Move the object, and the vtable is "dropped", as the offset is now incorrect. There's a whole bunch of black magic. Sometimes it works, sometimes it doesn't. It's best to just avoid the whole thing, and either use a POD, or plain old C. (Or another language :v:)
[QUOTE=Richy19;28151020]What are you doing this in OpengL or DirectX? Also is this for a school/uni thing or are you using tutorials? If you're using tutorials could you link please?[/QUOTE] It's just a small school project in DirectX. Need tutorials? I recommend this web page [url]http://www.d3dcoder.net[/url]. You will find both books and code examples.
If we're briefly posting tutorial websites, take a gander at [url=http://www.falloutsoftware.com/]this one[/url]. They seem to have a decent selection. :)
[QUOTE=BlkDucky;28151821] I'm going to assume you meant to quote Sakarias88 and misclicked or something because that stuff is a lot more impressive. :v: Edit: Wait, are you agreeing that the font fits well or because I'm not amazing? :saddowns:[/QUOTE] No, I meant you. Seriously. Rogulike-esque games like that are awesome.
[QUOTE=commander204;28152800]What I did was this: And everytime I need to convert I use those static methods.[/QUOTE] Doesn't work.. I don't get this. Edit: Okay it works now.. almost. The positions are bit off.
[QUOTE=Sakarias88;28153688]It's just a small school project in DirectX. Need tutorials? I recommend this web page [url]http://www.d3dcoder.net[/url]. You will find both books and code examples.[/QUOTE] Are those books any good for starting out with DirectX?
A link for you opengl people. "How to Know the Graphics Memory Size and Usage In OpenGL" [url]http://www.geeks3d.com/20100531/programming-tips-how-to-know-the-graphics-memory-size-and-usage-in-opengl/[/url]
I'm starting to rewrite parts of our game code in C# and OpenTK. It feels so nice to go back to C# :v: [editline]19th February 2011[/editline] OpenTK is also a LOT cleaner than the Android OpenGL ES bindings... GL.LoadIdentity(); instead of gl.glLoadIdentity(); and the Android version requires you to pass around a GL variable, which gets annoying (but I guess is necessary because of Activities and multitasking)
[QUOTE=robmaister12;28154896]I'm starting to rewrite parts of our game code in C# and OpenTK. It feels so nice to go back to C# :v: [editline]19th February 2011[/editline] OpenTK is also a LOT cleaner than the Android OpenGL ES bindings... GL.LoadIdentity(); instead of gl.glLoadIdentity(); and the Android version requires you to pass around a GL variable, which gets annoying (but I guess is necessary because of Activities and multitasking)[/QUOTE] Technically you don't have to use the gl variable, you can substitute it with GLES10, GLES11 or GLES20.
[QUOTE=Catdaemon;28151911]I got pissed off writing a font renderer in D so I've gone back to my original codebase :v: [img_thumb]http://img.meteornet.net/uploads/3s5lgax7p/ss.PNG[/img_thumb] Need to fix up the lighting because it's pretty slow at the moment. Then I'll move on to fixing the networking and then start embedding lua so I can get some gameplay going.[/QUOTE] You making a new version of space station 13?
[QUOTE=Overv;28155503]Technically you don't have to use the gl variable, you can substitute it with GLES10, GLES11 or GLES20.[/QUOTE] most of the tutorials (if not all) I've seen pass around the gl variable. That should clean up the game code quite a bit.
I'm still a total noob, but I'm making progress with learning SDL. [img]http://dl.dropbox.com/u/3864447/PICS/SDLstuff.jpg[/img]
[quote] Target: Basic enemies and combat Green jellies spawn on random floor tiles. Only visible if inside player FOV. Slight glitch in which jellies are visible 2 squares north of FOV. Need to add draw offset. Fixed FOV bug with monsters. Added red jelly, blue jelly, zombie, land jellyfish and dog to the placeholder monster list. Fixed a bug where monsters would spawn outside of the map. Fixed a bug where monsters would remain even after regenerating the map. Noticed a bug where monsters could spawn on top of other monsters. Added power, wisdom and agility stats. Basic combat. Enemies can die. Added text output. Sometimes crashes when attacking. No idea why. Fixed "crashing while attacking" bug. Found another bug. Crashed randomly. No idea why. Fo' real this time. Crashed while generating cavern. Never happened before. Fairly sure I fixed the generating crash. It was related to the "Empty" monster generating when it shouldn't and with ludicriously high stats. This may also have fixed the random crash I had earlier...? Fixed up the interface a bit. Rearranged everything. Shrunk the heart and armour displays. Stats are now visible. Discovered memory leak. God. Dammit. Discovered source of memory leak. Thank ye gods.[/quote] Today was a good day.
[QUOTE=AtomiC0l;28155629]You making a new version of space station 13?[/QUOTE] Not really a new version, more a new game based on it. The movement isn't tile based for example. [img]http://img.meteornet.net/uploads/23nfwi1/ss.PNG[/img] Been playing with the lighting code. I'm not entirely sure what about this looks off, I think the shadows are being cast too far away from the source. Ah well, time to put this away for the night or I'll go insane - Maths isn't exactly my strongest skill.
[QUOTE=>LEAD22<;28155865]I'm still a total noob, but I'm making progress with learning SDL. [img_thumb]http://dl.dropbox.com/u/3864447/PICS/SDLstuff.jpg[/img_thumb][/QUOTE] Using that good old tutorial, I see :3:
Does this seem good? [lua] -- Server.lua -- Listens on port 8484 and echos messages back local server = { } function server:Run() server.socket = AsyncSocket:New(8484) server.socket_map = { } -- Handlers server.socket:SetOnAccepted(server:OnConnect) server.socket:SetOnClosed(server:OnDisconnect) server.socket:SetOnRecieved(server:OnRecieved) -- Start server.socket:Listen() end function server:OnConnect(socket) -- Add the socket server.socket_map[socket] = Client:New() println("New connection from: " .. socket:GetRemoteEndpoint()) end function server:OnDisconnect(socket) -- Remove the socket server.socket_map[socket] = nil end function server:OnRecieved(socket, data, length) -- Echo the databack socket:Send(data, length) end -- Start the server server:Run() [/lua]
[QUOTE=Catdaemon;28156058]Not really a new version, more a new game based on it. The movement isn't tile based for example. [img_thumb]http://img.meteornet.net/uploads/23nfwi1/ss.PNG[/img_thumb] Been playing with the lighting code. I'm not entirely sure what about this looks off, I think the shadows are being cast too far away from the source. Ah well, time to put this away for the night or I'll go insane - Maths isn't exactly my strongest skill.[/QUOTE] Hmm i really do need to look up how dynamic lighting is done :v:
[QUOTE=Catdaemon;28156058]I'm not entirely sure what about this looks off, I think the shadows are being cast too far away from the source.[/QUOTE] Shadows should be softer, and also become softer when further away from the source. Probably hard to do, though.
[QUOTE=esalaka;28156182]Using that good old tutorial, I see :3:[/QUOTE] Lazy Foo?
[media]http://www.youtube.com/watch?v=0jF-Ci36M5g[/media] Pretty happy how my wrapper turned out. This took only few simple lines of code. Also, what would be the best way to iterate through a linked list while allowing dynamic insertion and removal of elements? Currently I'm doing [csharp]foreach (Type val in container.ToArray())[/csharp] But I don't think making a new array per update and per render is a good idea.
[QUOTE=Darwin226;28157301]But I don't think making a new array per update and per render is a good idea.[/QUOTE] Make a "toAdd" and a "toRemove" list, fill them up appropriately during the main loop, then loop over both of them and add/remove the object from the original list.
[QUOTE=Catdaemon;28156058]Not really a new version, more a new game based on it. The movement isn't tile based for example. [img_thumb]http://img.meteornet.net/uploads/23nfwi1/ss.PNG[/img_thumb] Been playing with the lighting code. I'm not entirely sure what about this looks off, I think the shadows are being cast too far away from the source. Ah well, time to put this away for the night or I'll go insane - Maths isn't exactly my strongest skill.[/QUOTE] Sorry to ask, but what is this being made in? Looks great by the way.
[QUOTE=Darwin226;28157301]Also, what would be the best way to iterate through a linked list while allowing dynamic insertion and removal of elements? Currently I'm doing [csharp]foreach (Type val in container.ToArray())[/csharp][/QUOTE] You could do some manual reference chasing, like so: [csharp] for(Node cur = container.Head; cur != null; cur = cur.Next) { // .. } [/csharp]
[QUOTE=Darwin226;28157301][media]http://www.youtube.com/watch?v=0jF-Ci36M5g[/media] Pretty happy how my wrapper turned out. This took only few simple lines of code. Also, what would be the best way to iterate through a linked list while allowing dynamic insertion and removal of elements? Currently I'm doing [csharp]foreach (Type val in container.ToArray())[/csharp] But I don't think making a new array per update and per render is a good idea.[/QUOTE] That's awesome. Could I have the source for that? I want to start learning OpenGL, and I think something like that would be a nice start.
Is there a way to change the origin with GDI+ in C# ? The top-left corner is (0,0) by default, and I would to make the origin the bottom left corner. [editline]e[/editline] Nevermind, I think I found. Graphics.TranslateTransform();
[QUOTE=DevBug;28156640]Does this seem good?[/QUOTE] Invalid syntax in couple places. For accessing table members, use a period, colon is only for calling member functions. You need to make the callback functions not methods, so declare them with a period instead of colon. Declaring with a colon makes the first argument passed to them an implicit variable, self, so the socket argument would be nil. Since I suck at explaining, examples: Your way was essentially this: [lua]function server.OnConnect( self, socket )[/lua] What you probably want is this: [lua]function server.OnConnect( socket )[/lua] You might as well make all the functions non-methods, since you're not using the self variable anywhere. Line 31 also has an error, you probably want server.socket there.
[QUOTE=limitofinf;28158076]Make a "toAdd" and a "toRemove" list, fill them up appropriately during the main loop, then loop over both of them and add/remove the object from the original list.[/QUOTE] But then there's a problem with removing from those lis... oh wait. I can just clear them. That could work. [editline]20th February 2011[/editline] [QUOTE=MightyHaku;28162631]That's awesome. Could I have the source for that? I want to start learning OpenGL, and I think something like that would be a nice start.[/QUOTE] I don't think that this would be a good OpenGL reference point. The goal of the whole thing is to hide away all OpenGL code so it's spread out in classes. I can give you the code if you want. It's C# btw.
[QUOTE=raBBish;28164366]Invalid syntax in couple places. For accessing table members, use a period, colon is only for calling member functions. You need to make the callback functions not methods, so declare them with a period instead of colon. Declaring with a colon makes the first argument passed to them an implicit variable, self, so the socket argument would be nil. Since I suck at explaining, examples: Your way was essentially this: [lua]function server.OnConnect( self, socket )[/lua] What you probably want is this: [lua]function server.OnConnect( socket )[/lua] You might as well make all the functions non-methods, since you're not using the self variable anywhere. Line 31 also has an error, you probably want server.socket there.[/QUOTE] Since he's calling the functions with the table as the first argument, it won't really matter.
Huh. We're near the end of this thread. I only just noticed.
Sorry, you need to Log In to post a reply to this thread.