Samapico Posted January 3, 2008 Author Report Posted January 3, 2008 If you only need animation, don't use threads -- that is not a good use. Instead use a Windows.Forms.Timer. Threads are better for background tasks. Alright... I'll do that Apparently, as doc said, updating the UI can only be done from one thread. Or one thread at a time, actually, but since both work at the same time, !@#$%^&* happens. Quote
Samapico Posted January 3, 2008 Author Report Posted January 3, 2008 NEATO So much easier with timers... lol. quite a lot of flickering though Quote
tcsoccerman Posted January 3, 2008 Report Posted January 3, 2008 I've run into flickering on some of my past projects as well. I am not sure how to fix it. Yeh, Invilidate() is commonly used in usercontrols when property's change. Here's what i found out about invalidate:"Invalidates the entire surface of the control and causes the control to be redrawn". Here's an example of invalidate i found in a scrolling text control:public string ScrollText { set { text = value; this.Invalidate(); this.Update(); } get { return text; } } Doc:How would it be possible to have unlimited weapons and ability's? A standard keyboard doesn't have unlimited keys...? Quote
Hakaku Posted January 3, 2008 Report Posted January 3, 2008 Doc:How would it be possible to have unlimited weapons and ability's? A standard keyboard doesn't have unlimited keys...?I would assume the same way other games have it; you could select from a menu, or rotate your weapons using a single key (same would go for abilities). Not only that, key combinations and the mouse can help as well. (Are you guys going to give the mouse any functions other than selecting on the main interface and menu?) But it will be up to the zones to decide on their limit of weapons and abilities. Quote
Samapico Posted January 3, 2008 Author Report Posted January 3, 2008 I'm already using Invalidate(); But I'm not invalidating the whole form, there's an Invalidate(Rectangle area) method as well. And the redrawn portions are flickering Quote
rootbear75 Posted January 4, 2008 Report Posted January 4, 2008 Wee, was able to see something animate...But now I'm getting some conflicts between threads about objects that are already in use in another thread... blehyou should be able to copy that one object into another variable... only problem thats going to cause is that you eat up more and more memory space by doing that... and that the variables arent syncronized unless you set them equal to each other every so often Quote
tcsoccerman Posted January 4, 2008 Report Posted January 4, 2008 (edited) Forgot about that.(Double Buffering) Edited January 4, 2008 by tcsoccerman Quote
Samapico Posted January 4, 2008 Author Report Posted January 4, 2008 yeah, I did read an example with double buffering... I'll check into that.......................later. Quote
»doc flabby Posted January 4, 2008 Report Posted January 4, 2008 (edited) Wee, was able to see something animate...But now I'm getting some conflicts between threads about objects that are already in use in another thread... blehyou should be able to copy that one object into another variable... only problem thats going to cause is that you eat up more and more memory space by doing that... and that the variables arent syncronized unless you set them equal to each other every so oftenAcctually waht you should be doing is to is lock the object before changing it, this ensures no other threads read/write to it while you make changes. lock(obj) { //change object here obj.x= 4} Edited January 4, 2008 by doc flabby Quote
Samapico Posted January 4, 2008 Author Report Posted January 4, 2008 Yeah, I did try to lock, but I didn't really understood how I could do it in that case, cause the object in question seemed to be 2 different objects to me... And it didnt want to lock it how I had it anyway. But anyway, works fine with timers Quote
Samapico Posted January 4, 2008 Author Report Posted January 4, 2008 Hm, turns out double buffering is easier than I thought... Just gotta set some properties to true. It's smoooooooooth now Now I want to make methods for fading a single image, and scrolling them from any direction Quote
tcsoccerman Posted January 4, 2008 Report Posted January 4, 2008 (edited) There's a scrollingtext control that you could LOOK at. I'm not saying to use it, but just to see how this person did it. Edit:And for fading...try adding opacity property? That would be the best long-term solution. You could use opacity in other ways than just fading as well..DougScrollingText.cs Edited January 4, 2008 by tcsoccerman Quote
Samapico Posted January 5, 2008 Author Report Posted January 5, 2008 Scrolling will be easy.Haven't checked much for fading yet, but I should find some examples easily. Quote
»D1st0rt Posted January 5, 2008 Report Posted January 5, 2008 Don't want to step on any toes here but you may want to give CEGui a look (C# bindings here) Quote
Samapico Posted January 5, 2008 Author Report Posted January 5, 2008 .....the tutorial page is full of virus-infected links and crap lollooks like it has interesting features... but all their wiki pages are vandalised with spam so I don't know if I can trust that And it would take away all the fun of coding stuff Quote
tcsoccerman Posted January 5, 2008 Report Posted January 5, 2008 (edited) Ok here's my idea on a few things: 1. Weapons, abilities, and key defsFor this i agree that each zone can have as many weapons and abilities for as many ships as they want.Each ship has x weapons, each uniquely defined in my new Weapon Class. To toggle b/w them you press the "ToggleRight" or "ToggleLeft"(user defined). Then i thought..."What if i want to use 2 weapons at the same time?". That's when i came up with slots. Basically, It allows you to have 2 weapons at a time and toggle b/w the weapons of each slot. All that is same with abilities. Now we just need to figure out how to display the slots, and how many. (That's where i started to compare to WOW and the button things.) 2.Key Configuraton:We can have "Toggle Right" and "Toggle left" like i mentioned in idea 1, and with that a FireSlot1, FireSlot2, FireSlot3 buttons. That would allow for unlimited weapons/abilities. 3. MouseAn important factor in this is determining if we were to have a mouse in the game or not. Quick Thought: Instead of having 2 slots for weapons and 2 slots for abilities (2 is a randome number), we could have 4 slots for weapons or abilites. That way you could have out 4 weapons, or 3 weapons 1 ability, or all abilities, etc. Now that i'm done i feel i explained horribly. Edited January 5, 2008 by tcsoccerman Quote
Samapico Posted January 5, 2008 Author Report Posted January 5, 2008 Main weapons (aka guns and bombs) shouldnt be part of these slots though So you could have, for example: Fire Primary Weapon: CtrlFire Secondary Weapon: Tab Toggle Firing Mode: Delete Fire Auxiliary Weapon 1: Shift+TabFire Auxiliary Weapon 2: Shift+Ctrl Use Special Weapon 1: Shift+InsertUse Special Weapon 2: Shift+Delete Use Special Weapon 3: F3Use Special Weapon 4: F4Use Special Weapon 5: F5Use Special Weapon 6: F6 Select Special Weapon 3: Shift+F3Select Special Weapon 4: Shift+F4Select Special Weapon 5: Shift+F5Select Special Weapon 6: Shift+F6 Warp: Insert ----For more than 4 abilities:Toggle/Use Ability 1: HomeToggle/Use Ability 2: End Select Ability 1: Shift+HomeSelect Ability 2: Shift+End ----For 0 to 4 abilities:Toggle/Use Ability 1: HomeToggle/Use Ability 2: EndToggle/Use Ability 3: Shift+HomeToggle/Use Ability 4: Shift+End That setup even allows for classic keyboard layout. And it has 4 fixed weapon slots, plus 2 fixed special weapon slots, so you should not have to do alot of item swapping... In fact, you wouldn't have any swapping to do for ANY of the current zones Basically, it IS the current layout, except abilities and special items have 4 slots eachWould be nice to be able to switch primary/secondary weapons too, though... Well, since each zone will be different, as we said, they will provide a keyconfig... So..... we could have an infinite number of keys too.For example: Toggle/Use Ability (1) : [ Not defined ] When you assign it, you'd get: Toggle/Use Ability (1) : [ F5 ]Toggle/Use Ability (2) : [ Not defined ] So you could setup as much as you want. There could be a warning if your key config is not compatible with the zone, like if there are some items you won't be able to use. Of course we could max out the number of slots to like 10 because we won't be able to display them at some point. But hiding unused keys like that would make the key config window clearer; like there won't be 300 'undefined' keys all the time. And yes the mouse should be allowed. But the mouse button shouldnt be mappable... it should be used to click around on the interface to fire stuff or toggle stuff (just like if you pressed the key), and do stuff on the chat (click links, select text...), right-click on people -> add to friends, or -> view stats, or stuff like that Quote
tcsoccerman Posted January 5, 2008 Report Posted January 5, 2008 (edited) Hmmm... thats a long post. Let me use an example and i may be more clear that way. Lets say we have these Weapons:Homing missle, Bullets, Bombs, ProxBomb And these abilities:Xradar, cloak, stealth. For each weapon slot (lets say 4) we add all the weaASSS i mentioned. For each abilitie slot (lests say 2) we add all the abilities mentioned. Each slot has a trigger button, : (Weapon Slot = WS, Ability Slot = AS)WS1 = a;WS2 = b;WS3 = c;WS4 = d;AS1 = y;AS2 = z; Each slot has every single weapon or ability depending on type of slot. Now you can visually toggle through each slot with arrow buttons. When Each slot has the ability you want you can fly around pressing a, z, c , y, etc... You can change the slots in-game anytime. Edited January 6, 2008 by tcsoccerman Quote
Samapico Posted January 6, 2008 Author Report Posted January 6, 2008 fading works I'll try to get some panels working (i.e. click on Stats, and a stat panels pops or fades in), then we should be able to build a very neat interface. I'm wondering if I should even bother with skins... with this system it will be very easy to hard-code alternate skins, and since it's open source and all it will also be easy to distribute these skins I guess. Quote
Samapico Posted January 7, 2008 Author Report Posted January 7, 2008 Small problem with fading: The form has a transparey key, which is the color that defines its transparent areas.When fading from the background to an image over a transparent area, as soon as the color is different from the transparey key, that area becomes totally opaque. Apparently the forms' variable opacity is a Windows feature...So if you want to fade in a black rectangle over a transparent area of the form, it should do:Transparent -> Less-transparent, grey-ish -> black But now it does:Transparent -> Totally opaque as soon as it starts, same color as form transparency key (i.e. pink) -> Gradually fades to black Fading over something else works perfectly though... But to have perfect fading, I'd need to grab an image of the screen (only part of it), then blend the fading image on that. However, the only way to do this seem to be by using gdi32.dll API calls (BitBlt, more precisely). But that thing is Windows only right? :SActually I just need to get the screen's hDC or something... hmm... Does OpenGL have feature to access the screen's data directly (via the gfx card, I guess)? (link) Test the current splash project in my branch if you don't understand what I'm saying Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.