[QUOTE=Fourier;48215789]That is actually quite nice!
Just fix formatting so people don't go "WTF"
[code]
( classType == Class.Warrior ? MeleeAttack
: classType == Class.Wizard ? MagicAttack
: classType == Class.Archer ? RangedAttack
: (Action<Entity, Entity>) NoAttack
)( player, enemy );
[/code][/QUOTE]
More traditionally:
[code]
Action<Entity, Entity> value = null;
switch (classType)
{
case Class.Warrior:
value = MeleeAttack;
break;
case Class.Wizard:
value = MagicAttack;
break;
case Class.Archer:
value = RangedAttack;
break;
default:
value = NoAttack;
break;
}
value(player, enemy);
[/code]
[QUOTE=Nabile13;48216401]More traditionally:
[code]
Action<Entity, Entity> value = null;
switch (classType)
{
case Class.Warrior:
value = MeleeAttack;
break;
case Class.Wizard:
value = MagicAttack;
break;
case Class.Archer:
value = RangedAttack;
break;
default:
value = NoAttack;
break;
}
value(player, enemy);
[/code][/QUOTE]
Sure, but with the first variant you avoid the explicit assignments in every case, since the ternary is an expression and not just a statement. Though you still repeat yourself in the conditions there, sure.
I always wish more things were expressions in C#, like in Rust where everything is :v: (also pattern matching).
[code]
let value = match entity {
Class::Warrior => MeleeAttack,
Class::Wizard => MagicAttack,
Class::Archer => RangedAttack,
_ => NoAttack,
}
[/code]
Not entirely sure if that was accurate rust code, but it should be somewhat accurate for the form of the match macro at least :v:
[QUOTE=Fourier;48215789]That is actually quite nice!
Just fix formatting so people don't go "WTF"
[code]
( classType == Class.Warrior ? MeleeAttack
: classType == Class.Wizard ? MagicAttack
: classType == Class.Archer ? RangedAttack
: (Action<Entity, Entity>) NoAttack
)( player, enemy );
[/code][/QUOTE]
This is nicer imo (and supports caching so it won't do any allocations when you use it): [code]
var actions = new DefaultingDictionary<Class, Action<Entity, Entity>>(NoAttack){
{ Class.Warrior, MeleeAttack },
{ Class.Wizard, MagicAttack },
{ Class.Archer, RangedAttack }
};
actions[classType](player, enemy);[/code]
You need a little boilerplate code though: [code]using System.Collections.Generic;
// This is a very minimal (and somewhat lacking) implementation.
class DefaultingDictionary<TKey, TValue> : Dictionary<TKey, TValue>
{
readonly TValue _default;
public DefaultingDictionary(TValue @default)
{ _default = @default; }
new public TValue this[TKey key]
{
get
{
TValue value;
return TryGetValue(key, out value) ? value : _default;
}
set { base[key] = value; }
}
}[/code]
You can also alias that long class name with a [I]using[/I] directive or as [code]class AttackList : DefaultingDictionary<Class, Action<Entity, Entity>>
{ public AttackList(Action<Entity, Entity> @default) : base(@default) { } }[/code] if you use it often.
[editline]16th July 2015[/editline]
[QUOTE=Nabile13;48216401]More traditionally:
[switch][/QUOTE]
This only works if [I]classType[/I] can be switched on, which is usually not the case if the program is extensible.
I added anaglyph 3D support into my pathtracer.
For some reason this was higher priority to me than adding linear texture interpolation. ¯\_(ツ)_/¯
[t]https://i.imgur.com/YQESOOk.png[/t]
So, when I have to choose one thing from a group of many, and it's a difficult choice for me, I tend to make the decision through a bracket system. I simply pair items together, choose which I prefer between the two, and continue this process until one item remains. That item is then the victor.
As you can imagine, this is a bit of a dick to pull off with large sets.
So I shat together a really terrible and completely checkless C# program in 40 minutes to do it for me.
Seems to work okay, though.
[img]http://i.imgur.com/BwUzbpz.png?1[/img]
It basically has three distinct phases:
1.) [b]Input.[/b] Currently the user just types every item in one at a time, and ends the list with -x.
2.) [b]Bracketing.[/b] Once input is finished, all of the input is shuffled (disabled for this test), and then is paired off into brackets of two elements. If there is an odd element, then the last element is given its own bracket and automatically wins it. When the user makes a decision on every bracket, it then pulls the winners out of each bracket and makes a new bracket and repeats. It continues this until it only pulls 1 element - the winner.
3.) [b]Output.[/b] Each tab represents a bracket level. It simply lists the candidates of every bracket, with a special exception to listing explicitly the winner first. Basically, the output is the same as the above image, but mirrored and without the lines.
Now I just need to make this thing not a complete pain in the ass to use. And make it safe from user error. It doesn't even check if the index you type in is a valid number, let alone in the index range. :v:
[QUOTE=Darwin226;48215690]Oh no! A new idiom that can reduce repetition and produce more maintainable code!
I'm so frustrated with this whole "code should be so simple that my mom could read it" bullshit. No. It shouldn't. It should be easy to maintain and non-repeating. Don't get what's going on at first glance? TAKE ANOTHER FUCKING GLANCE! Congratulations, now you know a new pattern.
It's exactly this mentality that produces things like Go. "Oh no, we can't have generics! I tried explaining them to my hamster last night and he just couldn't get it. It's obviously too complex for us programmers!"
/rant
If you're talking about performance issues then disregard the above.[/QUOTE]
Hmm...
[QUOTE=Darwin226;48114737]A mutable linked list in Haskell.
[code]
withPointer :: Bool -> LinkedListNode s a -> (Maybe (LLN s a) -> ST s (Maybe (LLN s a))) -> ST s ()
withPointer b (LinkedListNode _ p n) f = do
old <- readSTRef (if b then n else p)
new <- f old
writeSTRef (if b then n else p) new
[/code]
[/QUOTE]
Oh, alright, this guy writes Haskell. Move along.
(Jokes, jokes.)
[IMG]http://i.imgur.com/DBSwFaV.gif[/IMG]
Working on a level editor
[QUOTE=Sam Za Nemesis;48216629]It's been a while since I posted here, I've got back on my project and I'm revamping all of it's UI for a presentation, I have implemented CEF in the Alien Swarm engine and also added a bunch of hooks between the pages and the engine, hopefully in an effort to completely replace what I have left in VGUI, things still look a bit wonky, [url=http://image.noelshack.com/fichiers/2015/29/1437006587-untitled.png]a lot of things I wanted didn't work because I haven't been able to get CSS transformation working on the wrapper[/url]
[vid]http://my.mixtape.moe/zkfcoc.mp4[/vid][/QUOTE]
That lobby menu tastes exactly like Halo 3, and I [I]love[/I] it.
[QUOTE=chimitos;48217502]That lobby menu tastes exactly like Halo 3, and I [I]love[/I] it.[/QUOTE]
[I]Smells[/I] like it too!
[img]http://i.imgur.com/91dfSjB.png[/img]
All placeholder textures for now.
I have a level loading system and several types of enemies. Just added a scrolling background.
I'm getting close to having enough content to start actually building levels!
How hard should I be making it? The controls aren't exactly easy but that's the whole point. (It's like a smoother version of flappy bird).
I'm not sure if I want it to be ironically hard like Not Tetris or more like a standard mobile game.
[img]http://i.imgur.com/LICMbfo.gif[/img]
spent a couple hours throwing together a new enemy type
[img]http://i.imgur.com/uYjiybD.png[/img]
scissor lift best lifts
[QUOTE=Isaac96;48217484][IMG]http://i.imgur.com/DBSwFaV.gif[/IMG]
Working on a level editor[/QUOTE]
It looks like your walls all have slight variations that you randomize on creation (I assume you're recreating the entire map while you have the add/remove buttons held down). It's having a cool shaky effect as you're dragging your mouse around. I kinda like it and it might be worth always doing that just for the aesthetics.
Was trying to decipher the logic behind Terraria's tile system. Finally found an [url=http://seancode.com/terrafirma/uvs.html]article about it[/url]. Christ.
[QUOTE=icantread49;48217396]Hmm...
Oh, alright, this guy writes Haskell. Move along.
(Jokes, jokes.)[/QUOTE]
While there's a lot of truth to what you're implying, it's really not a Haskell thing. You can find these kinds of circle jerks everywhere. It's especially hillarious when you have these strong communities that have been using certain techniques successfully for ages and then instead of those useful methods spilling over to other, more mainstream languages, they get shunned because they're somehow "against the doctrine".
A prime example of this is clicking on any thread about the Java stream API and reading the comments. "To me using a loop is much clearer..." yada yada. On the other hand, a C# programmer would probably rather give up his firstborn before giving up LINQ despite the use cases (and the languages themselves) being nearly identical.
[QUOTE=Zwolf11;48218899]It looks like your walls all have slight variations that you randomize on creation (I assume you're recreating the entire map while you have the add/remove buttons held down). It's having a cool shaky effect as you're dragging your mouse around. I kinda like it and it might be worth always doing that just for the aesthetics.[/QUOTE]
It reminds me of the animation from Ed Edd n Eddy
[QUOTE=Zwolf11;48218899]It looks like your walls all have slight variations that you randomize on creation (I assume you're recreating the entire map while you have the add/remove buttons held down). It's having a cool shaky effect as you're dragging your mouse around. I kinda like it and it might be worth always doing that just for the aesthetics.[/QUOTE]
yeah it looks cool as fuck
i just thought that the game was paused when you're not holding the mouse down
Having now tested and developed for the HTC vive I can safely say that it is the most accurate VR system out there at the moment.
What was so nice about the jam is that your demo wouldn't be allowed to run if your game didn't hit vsync at 90fps. I now think this is a very nice thing. It all felt so smooth.
We made a warioware meets job simulator jam game and people enjoyed it very much.
Once scenario in the game made you pick up a frying pan and flip a pancake, in less than 5 seconds.
Went to Nandos and drinks afterwards with Chet from Valve and someone from HTC. They really REALLY know what they are talking about when it comes to VR and I know now that the future of VR is in good hands. We also had Unity, Unreal and nVidia devs at the jam. Seeing the industry work together that tight was really inspiring.
The HTC vive and the lighthouse tech still has some issues, but not big ones. At the moment I can see why it's for "devs" only. It requires some fiddling when things go wrong. It's a prototype alright, but I can see it releasing next year.
Added support for local co-op to my game. Pressing START on a controller adds them in as a new player and they can select their player. If you press start on controller 2 first, it let's player 1 use the first controller.
For walking around on the map in local co-op, I simply made the other players follow the first player around.
[video=youtube;P2FAhAOkE-k]http://www.youtube.com/watch?v=P2FAhAOkE-k[/video]
[QUOTE=Torrunt;48219803][...]
For walking around on the map in local co-op, I simply made the other players follow the first player around.
[...][/QUOTE]
You could try making that dynamic, those who currently don't steer follow the player(s) that do(es) (or something like that).
I'm not sure about how to resolve conflicts, but letting players give control to any of them during single player parts would be pretty nice I think.
[img]http://i.imgur.com/Rq90S8F.gif[/img]
Added bitmap font to my game, it uses the three-bmfont-text library which renders the text into a mesh. It was extremely difficult to work with. I'm so happy that it finally works.
I don't think there's any benefit to this, I just forced myself into a corner by using Three.JS for a 2D game lol...
edit: oh yeah and that's a demo with automatic word-wrapping so thats a plus
[QUOTE=Tamschi;48219882]You could try making that dynamic, those who currently don't steer follow the player(s) that do(es) (or something like that).
I'm not sure about how to resolve conflicts, but letting players give control to any of them during single player parts would be pretty nice I think.[/QUOTE]
Thought that was an alright idea, so I implemented it. Made it so if a player is already moving another player can't start unless they are player one. Could be useful if player one doesn't know where to go but another player does.
[vid]https://dl.dropboxusercontent.com/u/7113767/Videos/Follow%20the%20Leader.webm[/vid]
[QUOTE=Torrunt;48220524]Thought that was an alright idea, so I implemented it. Made it so if a player is already moving another player can't start unless they are player one. Could be useful if player one doesn't know where to go but another player does.
[vid]https://dl.dropboxusercontent.com/u/7113767/Videos/Follow%20the%20Leader.webm[/vid][/QUOTE]
This game looks awesome. Nice work on the art.
Don't want to get too offtopic, but some of you guys may have seen andrew mcwatters post a while back about his site being featured on awwwards or something.
I looked into it and it's a hilariously ridiculous scam.
I submitted Scrap.TF to it for shits and giggles.
1. You need to pay $50 to submit a site.
2. It's really a place for people to find designers to make a site; the awards are just clickbait bullshit to get egocentric people to pay to get "recognized."
3. Most of the judging is done by other users.
4. They encourage you to place a sticky logo and link on the side of your website that links to awwwards to "show off your nomination" or some shit. Yeah, fucking right.
[editline]16th July 2015[/editline]
Not to shit on amc's accomplishments -- however much I dislike the guy, he's not a bad web designer.
[QUOTE=geel9;48221686]Don't want to get too offtopic, but some of you guys may have seen andrew mcwatters post a while back about his site being featured on awwwards or something.
I looked into it and it's a hilariously ridiculous scam.
I submitted Scrap.TF to it for shits and giggles.
1. You need to pay $50 to submit a site.
2. It's really a place for people to find designers to make a site; the awards are just clickbait bullshit to get egocentric people to pay to get "recognized."
3. Most of the judging is done by other users.
4. They encourage you to place a sticky logo and link on the side of your website that links to awwwards to "show off your nomination" or some shit. Yeah, fucking right.
[editline]16th July 2015[/editline]
Not to shit on amc's accomplishments -- however much I dislike the guy, he's not a bad web designer.[/QUOTE]
Without the admission fee it would probably be fine (and technically it's probably still a decent deal for him due to working as web designer).
The back-link possibly works as advertising for him too.
I agree that linking back there is a bit silly in most other cases though.
[QUOTE=Tamschi;48221757]Without the admission fee it would probably be fine (and technically it's probably still a decent deal for him due to working as web designer).
The back-link possibly works as advertising for him too.
I agree that linking back there is a bit silly in most other cases though.[/QUOTE]
The implementation they give doesn't link to your submission. It just fucking links to awwwards.
eh the submission fee is probably there to keep most of low-effort shit out like greenlight
[QUOTE=geel9;48221686]
1. You need to pay $50 to submit a site.
2. It's really a place for people to find designers to make a site; the awards are just clickbait bullshit to get egocentric people to pay to get "recognized."
3. Most of the judging is done by other users.
4. They encourage you to place a sticky logo and link on the side of your website that links to awwwards to "show off your nomination" or some shit. Yeah, fucking right.
[/QUOTE]
1. That's a filter to keep terrible websites out. A 50$ scam is a pretty bad scam, why not 100/200$?
2. The awwwards are actual awards if you are good enough [url]http://conference.awwwards.com/amsterdam-2016/[/url]
3. Most of the judging [I]should[/I] be done by other users.
4. This is so standard practice, nothing to see here.
What's wrong with people trying to get good publicty on their hard work? How big does a website need to be for you to think it's not a scam?
Got Intellisense in Visual Studio working for Jet. It's not super smart yet, but at least it works :D
[img]http://i.imgur.com/28FyBW1.png[/img]
The C# -> C interop with my compiler was surprisingly tricky to get right, thanks Cra0kalo for helping me out with that.